Countdown 1.1.0 - Languages

Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
Benny Samir Hierl 2020-11-01 20:58:50 +01:00
parent 662d182545
commit 3fb28bfa5e
No known key found for this signature in database
GPG key ID: 69DE3C3C097DB7F7
6 changed files with 15 additions and 2 deletions

2
Countdown/CHANGELOG Normal file
View file

@ -0,0 +1,2 @@
1.1.0
- Add support for the languages en, de, fr, es and it

View file

@ -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);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB