Merge pull request #730 from awkirk71/master

SlidingText Clock: Added German Language
pull/732/head
Gordon Williams 2021-04-26 08:32:34 +01:00 committed by GitHub
commit 88618bad2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 106 additions and 7 deletions

View File

@ -219,8 +219,8 @@
{ "id": "slidingtext",
"name": "Sliding Clock",
"icon": "slidingtext.png",
"version":"0.03",
"description": "Inspired by the Pebble sliding clock, old times are scrolled off the screen and new times on. You are also able to change language on the fly so you can see the time written in other languages using button 1. Currently English, French, Japanese and Spanish are supported",
"version":"0.04",
"description": "Inspired by the Pebble sliding clock, old times are scrolled off the screen and new times on. You are also able to change language on the fly so you can see the time written in other languages using button 1. Currently English, French, Japanese, Spanish and German are supported",
"tags": "clock",
"type":"clock",
"allow_emulator":true,
@ -235,6 +235,7 @@
{"name":"slidingtext.locale.es.js","url":"slidingtext.locale.es.js"},
{"name":"slidingtext.locale.fr.js","url":"slidingtext.locale.fr.js"},
{"name":"slidingtext.locale.jp.js","url":"slidingtext.locale.jp.js"},
{"name":"slidingtext.locale.de.js","url":"slidingtext.locale.de.js"},
{"name":"slidingtext.dtfmt.js","url":"slidingtext.dtfmt.js"}
]
},

View File

@ -1,3 +1,4 @@
0.01: Initial Release
0.02: Color Themes, Smoother scrolling
0.03: Added Spanish Language
0.04: Added German Language

View File

@ -13,6 +13,8 @@ Use Button 1 (the top right button) to change the language
| English | English (Traditional) | French | Japanese (Romanji) |
| ---- | ---- | ---- | ---- |
| ![](./format-01.jpg) | ![](format-02.jpg) | ![](format-03.jpg) |![](format-04.jpg) |
| **German** | **Spanish** | | |
| ![](./format-05.jpg) | ![](format-06.jpg) | | |
### Button 3
Button 3 (bottom right button) is used to change the colour

View File

@ -4,7 +4,7 @@
</head>
<body>
<p>Please select watch languages</p>
<p>Please select watch languages (Max 3, only the first 3 selected will be loaded)</p>
<table id="language_selection">
<tr>
@ -24,7 +24,8 @@
{name:"English(Traditional)",shortname:"en2"},
{name:"French",shortname:"fr"},
{name:"Japanese",shortname:"jp"},
{name:"Spanish",shortname:"es"}
{name:"Spanish",shortname:"es"},
{name:"German",shortname:"de"}
];
var selected_languages = ["en","es","jp"];
try{
@ -51,7 +52,7 @@
for (var i=0; i<slidingtext_languages.length; i++) {
var curr_language = slidingtext_languages[i];
var checked=document.getElementById("enabled_"+i).checked;
if (checked) {
if (checked && new_selected_languages.length < 3 ) {
new_selected_languages.push(curr_language.shortname);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -0,0 +1,94 @@
var DateFormatter = require("slidingtext.dtfmt.js");
const germanNumberStr = [ ["ZERO",""], // 0
["EINS",""], // 1
["ZWEI",""], //2
["DREI",''], //3
["VIER",''], //4
["FÜNF",''], //5
["SECHS",''], //6
["SEIBEN",''], //7
["ACHT",''], //8
["NUEN",''], // 9,
["ZEHN",''], // 10
["ELF",''], // 11,
["ZWÖLF",''], // 12
["DREI",'ZEHN'], // 13
["VIER",'ZEHN'], // 14
["FÜNF",'ZEHN'], // 15
["SECH",'ZEHN'], // 16
["SIEB",'ZEHN'], // 17
["ACHT",'ZEHN'], // 18
["NEUN",'ZEHN'], // 19
];
const germanTensStr = ["ZERO",//0
"ZEHN",//10
"ZWANZIG",//20
"DREIßIG",//30
"VIERZIG",//40
"FÜNFZIG",//50
"SECHZIG"//60
]
const germanUnit = ["",//0
"EINUND",//1
"ZWEIUND",//2
"DREIUND",//3
"VIERUND", //4
"FÜNFUND", //5
"SECHSUND", //6
"SEIBENUND", //7
"ACHTUND", //8
"NEUNUND" //9
]
function germanHoursToText(hours){
hours = hours % 12;
if(hours == 0){
hours = 12;
}
return germanNumberStr[hours][0];
}
function germanMinsToText(mins) {
if (mins < 20) {
return germanNumberStr[mins];
} else {
var tens = (mins / 10 | 0);
var word1 = germanTensStr[tens];
var remainder = mins - tens * 10;
var word2 = germanUnit[remainder];
return [word2, word1];
}
}
class GermanDateFormatter extends DateFormatter {
constructor() { super();}
name(){return "German";}
formatDate(date){
var mins = date.getMinutes();
var hourOfDay = date.getHours();
var hours = germanHoursToText(hourOfDay);
//console.log('hourOfDay->' + hourOfDay + ' hours text->' + hours)
// Deal with the special times first
if(mins == 0){
var hours = germanHoursToText(hourOfDay);
return [hours,"UHR", "","",""];
} /*else if(mins == 30){
var hours = germanHoursToText(hourOfDay+1);
return ["", "", "HALB","", hours];
} else if(mins == 15){
var hours = germanHoursToText(hourOfDay);
return ["", "", "VIERTEL", "NACH",hours];
} else if(mins == 45) {
var hours = germanHoursToText(hourOfDay+1);
return ["", "", "VIERTEL", "VOR",hours];
} */ else {
var mins_txt = germanMinsToText(mins);
return [hours, "UHR", mins_txt[0],mins_txt[1]];
}
}
}
module.exports = GermanDateFormatter;

View File

@ -46,12 +46,12 @@ class FrenchDateFormatter extends DateFormatter {
} else if(mins == 30){
return [hours, heures,'ET DEMIE'];
} else if(mins == 15){
return [hours, heures,'ET QUERT'];
return [hours, heures,'ET QUART'];
} else if(mins == 45){
var next_hour = date.getHours() + 1;
hours = frenchHoursToText(next_hour);
heures = frenchHeures(next_hour);
return [hours, heures,"MOINS",'LET QUERT'];
return [hours, heures,"MOINS",'LET QUART'];
}
if(mins > 30){
var to_mins = 60-mins;