diff --git a/MMM-text-clock.js b/MMM-text-clock.js index 3050173..25aea08 100644 --- a/MMM-text-clock.js +++ b/MMM-text-clock.js @@ -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}`); diff --git a/README.md b/README.md index b919091..4f441d0 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ Supported languages: - Japanese - Italian - Swiss German +- German ## Configuration @@ -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 diff --git a/locale/de/getActiveWords.js b/locale/de/getActiveWords.js new file mode 100644 index 0000000..59a3050 --- /dev/null +++ b/locale/de/getActiveWords.js @@ -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; +}; diff --git a/locale/de/gridColumns.js b/locale/de/gridColumns.js new file mode 100644 index 0000000..5b3fdc6 --- /dev/null +++ b/locale/de/gridColumns.js @@ -0,0 +1 @@ +module.exports = 11; diff --git a/locale/de/index.js b/locale/de/index.js new file mode 100644 index 0000000..436b74f --- /dev/null +++ b/locale/de/index.js @@ -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, +}; diff --git a/locale/de/letters.js b/locale/de/letters.js new file mode 100644 index 0000000..2400686 --- /dev/null +++ b/locale/de/letters.js @@ -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', +]; diff --git a/locale/de/wordMap.js b/locale/de/wordMap.js new file mode 100644 index 0000000..f08571f --- /dev/null +++ b/locale/de/wordMap.js @@ -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], +}; diff --git a/locale/index.js b/locale/index.js index 025cf74..80a99b2 100644 --- a/locale/index.js +++ b/locale/index.js @@ -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'); @@ -11,6 +12,7 @@ const nl = require('./nl'); module.exports = { ar, ch, + de, en, es, fi,