Countdown 1.1.0 - Languages
Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
2
Countdown/CHANGELOG
Normal file
|
@ -0,0 +1,2 @@
|
|||
1.1.0
|
||||
- Add support for the languages en, de, fr, es and it
|
|
@ -20,6 +20,15 @@ if (widgetInputRAW !== null) {
|
|||
throw new Error('No Date set! Please set a Date via Widget parameter like 2020-12-31')
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const localeText = {
|
||||
default: ['Day', 'Days'],
|
||||
en: ['Day', 'Days'],
|
||||
de: ['Tag', 'Tage'],
|
||||
fr: ['Jour', 'Jours'],
|
||||
es: ['día', 'días'],
|
||||
it: ['giorno', 'giorni']
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
let backColor; //Widget background color
|
||||
let backColor2; //Widget background color
|
||||
|
@ -84,12 +93,14 @@ dayText.minimumScaleFactor = 0.5;
|
|||
|
||||
textStack.addSpacer(5)
|
||||
|
||||
const languageCode = Device.language().match(/^[\a-z]{2}/)
|
||||
const t = (localeText[languageCode]) ? localeText[languageCode] : localeText.default
|
||||
let postfixText;
|
||||
if (remainingDays === 1) {
|
||||
postfixText = textStack.addText('Tag')
|
||||
postfixText = textStack.addText(t[0])
|
||||
|
||||
} else {
|
||||
postfixText = textStack.addText('Tage')
|
||||
postfixText = textStack.addText(t[1])
|
||||
}
|
||||
postfixText.font = Font.regularSystemFont(20)
|
||||
postfixText.textColor = new Color(textColor);
|
||||
|
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 8.6 KiB |