preparing to support languages that make a difference between AM and PM

This commit is contained in:
Manuel Friedli 2014-06-28 22:03:35 +02:00
parent 75568578f6
commit f93083c128
5 changed files with 52 additions and 65 deletions

View File

@ -37,7 +37,7 @@ var layout = {
'SECHSNLACHT',
'SIEBENZWÖLF',
'ZEHNEUNKUHR'
],
],
"permanent": h._es_ist,
"minutes": {
"5,6,7,8,9": [h._5, h._nach],
@ -53,18 +53,18 @@ var layout = {
"55,56,57,58,59": [h._5, h._vor]
},
"hours": {
"1": {6:[1,2,3,4]},
"2": {6:[8,9,10,11]},
"3": {7:[1,2,3,4]},
"4": {7:[8,9,10,11]},
"5": {5:[8,9,10,11]},
"6": {8:[1,2,3,4,5]},
"7": {9:[1,2,3,4,5,6]},
"8": {8:[8,9,10,11]},
"9": {10:[4,5,6,7]},
"10": {10:[1,2,3,4]},
"11": {5:[6,7,8]},
"12": {9:[7,8,9,10,11]}
"0,12": {9:[7,8,9,10,11]},
"1,13": {6:[1,2,3,4]},
"2,14": {6:[8,9,10,11]},
"3,15": {7:[1,2,3,4]},
"4,16": {7:[8,9,10,11]},
"5,17": {5:[8,9,10,11]},
"6,18": {8:[1,2,3,4,5]},
"7,19": {9:[1,2,3,4,5,6]},
"8,20": {8:[8,9,10,11]},
"9,21": {10:[4,5,6,7]},
"10,22": {10:[1,2,3,4]},
"11,23": {5:[6,7,8]}
}
};
window,_uhr.register('de', layout);

View File

@ -40,7 +40,7 @@ var layout = {
'ACHTINÜNIEL',
'ZÄNIERBEUFI',
'ZWÖUFINAUHR'
],
],
// Permanent aktive Buchstaben. <array-or-object>, vgl. ausführliche Beschreibung bei "minutes".
"permanent": h._es_isch,
/*
@ -78,18 +78,18 @@ var layout = {
},
// Die Stunden; gleiches Format wie bei den Minuten
"hours": {
"1": {5:[1,2,3]},
"2": {5:[4,5,6,7]},
"3": {5:[9,10,11]},
"4": {6:[1,2,3,4,5]},
"5": {6:[6,7,8,9]},
"6": {7:[1,2,3,4,5,6]},
"7": {7:[7,8,9,10,11]},
"8": {8:[1,2,3,4,5]},
"9": {8:[6,7,8,9]},
"10": {9:[1,2,3,4]},
"11": {9:[8,9,10,11]},
"12": {10:[1,2,3,4,5,6]}
"0,12": {10:[1,2,3,4,5,6]},
"1,13": {5:[1,2,3]},
"2,14": {5:[4,5,6,7]},
"3,15": {5:[9,10,11]},
"4,16": {6:[1,2,3,4,5]},
"5,17": {6:[6,7,8,9]},
"6,18": {7:[1,2,3,4,5,6]},
"7,19": {7:[7,8,9,10,11]},
"8,20": {8:[1,2,3,4,5]},
"9,21": {8:[6,7,8,9]},
"10,22": {9:[1,2,3,4]},
"11,23": {9:[8,9,10,11]}
}
};
// Das Layout bei der Uhr unter dem Code "de_CH" registrieren.

View File

@ -37,7 +37,7 @@ var layout = {
'ACHTINÜNIEL',
'ZÄNIERBEUFI',
'ZWÖUFINAUHR'
],
],
"permanent": h._es_isch,
"minutes": {
"0": h._genau,
@ -54,18 +54,18 @@ var layout = {
"55,56,57,58,59": [h._5, h._vor]
},
"hours": {
"1": {5:[1,2,3]},
"2": {5:[4,5,6,7]},
"3": {5:[9,10,11]},
"4": {6:[1,2,3,4,5]},
"5": {6:[6,7,8,9]},
"6": {7:[1,2,3,4,5,6]},
"7": {7:[7,8,9,10,11]},
"8": {8:[1,2,3,4,5]},
"9": {8:[6,7,8,9]},
"10": {9:[1,2,3,4]},
"11": {9:[8,9,10,11]},
"12": {10:[1,2,3,4,5,6]}
"0,12": {10:[1,2,3,4,5,6]},
"1,13": {5:[1,2,3]},
"2,14": {5:[4,5,6,7]},
"3,15": {5:[9,10,11]},
"4,16": {6:[1,2,3,4,5]},
"5,17": {6:[6,7,8,9]},
"6,18": {7:[1,2,3,4,5,6]},
"7,19": {7:[7,8,9,10,11]},
"8,20": {8:[1,2,3,4,5]},
"9,21": {8:[6,7,8,9]},
"10,22": {9:[1,2,3,4]},
"11,23": {9:[8,9,10,11]}
}
};
window,_uhr.register('de_CH_genau', layout);

View File

@ -38,7 +38,7 @@ var layout = {
'EIGHTELEVEN',
'SEVENTWELVE',
'TENSEOCLOCK'
],
],
"permanent": h._it_is,
"minutes": {
"0,1,2,3,4": h._o_clock,
@ -55,18 +55,18 @@ var layout = {
"55,56,57,58,59": [h._5, h._to]
},
"hours": {
"1": {6:[1,2,3]},
"2": {7:[9,10,11]},
"3": {6:[7,8,9,10,11]},
"4": {7:[1,2,3,4]},
"5": {7:[5,6,7,8]},
"6": {6:[4,5,6]},
"7": {9:[1,2,3,4,5]},
"8": {8:[1,2,3,4,5]},
"9": {5:[8,9,10,11]},
"10": {10:[1,2,3]},
"11": {8:[6,7,8,9,10,11]},
"12": {9:[6,7,8,9,10,11]}
"0,12": {9:[6,7,8,9,10,11]},
"1,13": {6:[1,2,3]},
"2,14": {7:[9,10,11]},
"3,15": {6:[7,8,9,10,11]},
"4,16": {7:[1,2,3,4]},
"5,17": {7:[5,6,7,8]},
"6,18": {6:[4,5,6]},
"7,19": {9:[1,2,3,4,5]},
"8,20": {8:[1,2,3,4,5]},
"9,21": {5:[8,9,10,11]},
"10,22": {10:[1,2,3]},
"11,23": {8:[6,7,8,9,10,11]}
},
"getHour": function(date) {
var hour = date.getHours();

13
uhr.js
View File

@ -151,11 +151,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
this._highlight('dot' + i);
}
this._highlight('minute' + coarseMinute);
hour = this._normalizeHour(hour);
this._highlight('hour' + hour);
if (coarseMinute == 0) {
this._highlight('sharphour');
}
},
_language: function() {
for (var i = 0; i < window._uhr.languages.length; i++) {
@ -196,15 +192,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
var minutes = date.getMinutes();
return minutes % 5;
},
_normalizeHour: function(hour) {
if (hour > 12) {
hour %= 12;
}
if (hour == 0) {
return 12;
}
return hour;
},
_create: function() {
this._id = window._uhr.id++;
var userTime = this.options.time;