Skip to content

Commit

Permalink
feat: add german language
Browse files Browse the repository at this point in the history
  • Loading branch information
ricsic authored and ngnijland committed Dec 16, 2023
1 parent 16721ea commit e9e6654
Show file tree
Hide file tree
Showing 8 changed files with 225 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MMM-text-clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Module.register('MMM-text-clock', {
fullscreen: false,
},

supportedLanguages: ['ar', 'ch', 'en', 'es', 'fi', 'fr', 'it', 'jp', 'nl'],
supportedLanguages: ['ar', 'ch', 'de', 'en', 'es', 'fi', 'fr', 'it', 'jp', 'nl'],

start: function () {
Log.info(`Starting module: ${this.name}`);
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Supported languages:
- Japanese
- Italian
- Swiss German
- German

## Configuration

Expand All @@ -70,7 +71,7 @@ Config | Type |
:-----------------------------|:-----------------------------------------------|:---------------|:------------
`compact` | `boolean` | `false` | Compact mode only shows highlighted letters
`size` | `xsmall \| small \| medium \| large` | `medium` | The size of the clock
`language` | `ar \| ch \| en \| es \| fi \| fr \| it \| jp \| nl` | `en` | A language or list of languages to alternate through. Overrides config language.
`language` | `ar \| ch \| de \| en \| es \| fi \| fr \| it \| jp \| nl` | `en` | A language or list of languages to alternate through. Overrides config language.
`languageAlternationInterval` | `number` | `60` | Interval in minutes at which the language changes (> 0)
`fullscreen` | `boolean` | `false` | Fullscreen mode takes over your entire screen

Expand Down
60 changes: 60 additions & 0 deletions locale/de/getActiveWords.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
module.exports = function (time) {
const wordIndexes = [];
const display = this.displayTime(time);
var fullHour = false;

wordIndexes.push(this.wordMap.es);
wordIndexes.push(this.wordMap.ist);

if (display.minutes_to_display === 0) {
fullHour = true;
wordIndexes.push(this.wordMap.uhr);
} else if (display.minutes_to_display === 5) {
wordIndexes.push(this.wordMap.fünf);
wordIndexes.push(this.wordMap.nach);
} else if (display.minutes_to_display === 10) {
wordIndexes.push(this.wordMap.zehn);
wordIndexes.push(this.wordMap.nach);
} else if (display.minutes_to_display === 15) {
wordIndexes.push(this.wordMap.viertel);
wordIndexes.push(this.wordMap.nach);
} else if (display.minutes_to_display === 20) {
wordIndexes.push(this.wordMap.zwanzig);
wordIndexes.push(this.wordMap.nach);
} else if (display.minutes_to_display === 25) {
wordIndexes.push(this.wordMap.fünf);
wordIndexes.push(this.wordMap.vor);
wordIndexes.push(this.wordMap.halb);
} else if (display.minutes_to_display === 30) {
wordIndexes.push(this.wordMap.halb);
} else if (display.minutes_to_display === -25) {
wordIndexes.push(this.wordMap.fünf);
wordIndexes.push(this.wordMap.nach);
wordIndexes.push(this.wordMap.halb);
} else if (display.minutes_to_display === -20) {
wordIndexes.push(this.wordMap.zwanzig);
wordIndexes.push(this.wordMap.vor);
} else if (display.minutes_to_display === -15) {
wordIndexes.push(this.wordMap.viertel);
wordIndexes.push(this.wordMap.vor);
} else if (display.minutes_to_display === -10) {
wordIndexes.push(this.wordMap.zehn);
wordIndexes.push(this.wordMap.vor);
} else if (display.minutes_to_display === -5) {
wordIndexes.push(this.wordMap.fünf);
wordIndexes.push(this.wordMap.vor);
}

var hour =
display.minutes_to_display <= 20
? display.hours_to_display
: display.hours_to_display + 1;

wordIndexes.push(this.wordMap[hour]);

if (hour === 1 && !fullHour) {
wordIndexes.push(this.wordMap.s);
}

return wordIndexes;
};
1 change: 1 addition & 0 deletions locale/de/gridColumns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 11;
11 changes: 11 additions & 0 deletions locale/de/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const getActiveWords = require('./getActiveWords');
const gridColumns = require('./gridColumns');
const letters = require('./letters');
const wordMap = require('./wordMap');

module.exports = {
getActiveWords,
gridColumns,
letters,
wordMap,
};
121 changes: 121 additions & 0 deletions locale/de/letters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
module.exports = [
'e',
's',
'k',
'i',
's',
't',
'a',
'f',
'ü',
'n',
'f',

'z', // 11
'e',
'h',
'n',
'z',
'w',
'a',
'n',
'z',
'i',
'g',

'd', // 22
'r',
'e',
'i',
'v',
'i',
'e',
'r',
't',
'e',
'l',

'v', // 33
'o',
'r',
'f',
'u',
'n',
'k',
'n',
'a',
'c',
'h',

'h', // 44
'a',
'l',
'b',
'a',
'e',
'l',
'f',
'ü',
'n',
'f',

'e', // 55
'i',
'n',
's',
'x',
'a',
'm',
'z',
'w',
'e',
'i',

'd', // 66
'r',
'e',
'i',
'p',
'm',
'j',
'v',
'i',
'e',
'r',

's', // 77
'e',
'c',
'h',
's',
'n',
'l',
'a',
'c',
'h',
't',

's', // 88
'i',
'e',
'b',
'e',
'n',
'z',
'w',
'ö',
'l',
'f',

'z', // 99
'e',
'h',
'n',
'e',
'u',
'n',
'k',
'u',
'h',
'r',
];
27 changes: 27 additions & 0 deletions locale/de/wordMap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
es: [0, 1],
ist: [3, 4, 5],
fünf: [7, 8, 9, 10],
zehn: [11, 12, 13, 14],
vor: [33, 34, 35],
nach: [40, 41, 42, 43],
viertel: [26, 27, 28, 29, 30, 31, 32],
halb: [44, 45, 46, 47],
zwanzig: [15, 16, 17, 18, 19, 20, 21],
s: [58],
0: [94, 95, 96, 97, 98],
1: [55, 56, 57],
2: [62, 63, 64, 65],
3: [66, 67, 68, 69],
4: [73, 74, 75, 76],
5: [51, 52, 53, 54],
6: [77, 78, 79, 80, 81],
7: [88, 89, 90, 91, 92, 93],
8: [84, 85, 86, 87],
9: [102, 103, 104, 105],
10: [99, 100, 101, 102],
11: [49, 50, 51],
12: [94, 95, 96, 97, 98],
13: [55, 56, 57],
uhr: [107, 108, 109],
};
2 changes: 2 additions & 0 deletions locale/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const ar = require('./ar');
const ch = require('./ch');
const de = require('./de');
const en = require('./en');
const es = require('./es');
const fi = require('./fi');
Expand All @@ -11,6 +12,7 @@ const nl = require('./nl');
module.exports = {
ar,
ch,
de,
en,
es,
fi,
Expand Down

0 comments on commit e9e6654

Please sign in to comment.