Fuzzyw translation (#3)
* Update metadata.json * Update ChangeLog * Update fuzzyw.app.js * Update de_DE.json * Update de_DE.jsonmaster
parent
7f657a31d0
commit
6c77b7bc64
|
|
@ -1 +1,2 @@
|
||||||
0.01: First release
|
0.01: First release
|
||||||
|
0.02: Move translations to locale module
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,37 @@
|
||||||
// adapted from https://github.com/hallettj/Fuzzy-Text-International/
|
// adapted from https://github.com/hallettj/Fuzzy-Text-International/
|
||||||
const fuzzy_strings = require("Storage").readJSON("fuzzy_strings.json");
|
|
||||||
|
|
||||||
const SETTINGS_FILE = "fuzzyw.settings.json";
|
let fuzzy_string = {
|
||||||
let settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'language': 'System', 'alignment':'Centre'};
|
"hours":[
|
||||||
|
/*LANG*/"twelve",
|
||||||
if (settings.language == 'System') {
|
/*LANG*/"one",
|
||||||
settings.language = require('locale').name;
|
/*LANG*/"two",
|
||||||
}
|
/*LANG*/"three",
|
||||||
|
/*LANG*/"four",
|
||||||
let fuzzy_string = fuzzy_strings[settings.language];
|
/*LANG*/"five",
|
||||||
|
/*LANG*/"six",
|
||||||
|
/*LANG*/"seven",
|
||||||
|
/*LANG*/"eight",
|
||||||
|
/*LANG*/"nine",
|
||||||
|
/*LANG*/"ten",
|
||||||
|
/*LANG*/"eleven"
|
||||||
|
],
|
||||||
|
"minutes":[
|
||||||
|
/*LANG*/"*$1 o'clock",
|
||||||
|
/*LANG*/"five past *$1",
|
||||||
|
/*LANG*/"ten past *$1",
|
||||||
|
/*LANG*/"quarter past *$1",
|
||||||
|
/*LANG*/"twenty past *$1",
|
||||||
|
/*LANG*/"twenty five past *$1",
|
||||||
|
/*LANG*/"half past *$1",
|
||||||
|
/*LANG*/"twenty five to *$2",
|
||||||
|
/*LANG*/"twenty to *$2",
|
||||||
|
/*LANG*/"quarter to *$2",
|
||||||
|
/*LANG*/"ten to *$2",
|
||||||
|
/*LANG*/"five to *$2"
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
let text_scale = 3.5;
|
||||||
let timeout = 2.5*60;
|
let timeout = 2.5*60;
|
||||||
let drawTimeout;
|
let drawTimeout;
|
||||||
|
|
||||||
|
|
@ -24,24 +46,15 @@ function queueDraw(seconds) {
|
||||||
|
|
||||||
const h = g.getHeight();
|
const h = g.getHeight();
|
||||||
const w = g.getWidth();
|
const w = g.getWidth();
|
||||||
let align_mode = 0;
|
|
||||||
let align_pos = w/2;
|
|
||||||
if (settings.alignment =='Left') {
|
|
||||||
align_mode = -1;
|
|
||||||
align_pos = 0;
|
|
||||||
} else if (settings.alignment == 'Right') {
|
|
||||||
align_mode = 1;
|
|
||||||
align_pos = w;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTimeString(date) {
|
function getTimeString(date) {
|
||||||
let segment = Math.round((date.getMinutes()*60 + date.getSeconds() + 1)/300);
|
let segment = Math.round((date.getMinutes()*60 + date.getSeconds() + 1)/300);
|
||||||
let hour = date.getHours() + Math.floor(segment/12);
|
let hour = date.getHours() + Math.floor(segment/12);
|
||||||
f_string = fuzzy_string.minutes[segment % 12];
|
f_string = fuzzy_string.minutes[segment % 12];
|
||||||
if (f_string.includes('$1')) {
|
if (f_string.includes('$1')) {
|
||||||
f_string = f_string.replace('$1', fuzzy_string.hours[(hour) % 24]);
|
f_string = f_string.replace('$1', fuzzy_string.hours[(hour) % 12]);
|
||||||
} else {
|
} else {
|
||||||
f_string = f_string.replace('$2', fuzzy_string.hours[(hour + 1) % 24]);
|
f_string = f_string.replace('$2', fuzzy_string.hours[(hour + 1) % 12]);
|
||||||
}
|
}
|
||||||
return f_string;
|
return f_string;
|
||||||
}
|
}
|
||||||
|
|
@ -49,11 +62,11 @@ function getTimeString(date) {
|
||||||
function draw() {
|
function draw() {
|
||||||
let time_string = getTimeString(new Date()).replace('*', '');
|
let time_string = getTimeString(new Date()).replace('*', '');
|
||||||
// print(time_string);
|
// print(time_string);
|
||||||
g.setFont('Vector', (h-24*2)/fuzzy_string.text_scale);
|
g.setFont('Vector', (h-24*2)/text_scale);
|
||||||
g.setFontAlign(align_mode, 0);
|
g.setFontAlign(0, 0);
|
||||||
g.clearRect(0, 24, w, h-24);
|
g.clearRect(0, 24, w, h-24);
|
||||||
g.setColor(g.theme.fg);
|
g.setColor(g.theme.fg);
|
||||||
g.drawString(g.wrapString(time_string, w).join("\n"), align_pos, h/2);
|
g.drawString(g.wrapString(time_string, w).join("\n"), w/2, h/2);
|
||||||
queueDraw(timeout);
|
queueDraw(timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id":"fuzzyw",
|
"id":"fuzzyw",
|
||||||
"name":"Fuzzy Text Clock",
|
"name":"Fuzzy Text Clock",
|
||||||
"shortName": "Fuzzy Text",
|
"shortName": "Fuzzy Text",
|
||||||
"version": "0.01",
|
"version": "0.02",
|
||||||
"description": "An imprecise clock for when you're not in a rush",
|
"description": "An imprecise clock for when you're not in a rush",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"icon":"fuzzyw.png",
|
"icon":"fuzzyw.png",
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
"storage": [
|
"storage": [
|
||||||
{"name":"fuzzyw.app.js","url":"fuzzyw.app.js"},
|
{"name":"fuzzyw.app.js","url":"fuzzyw.app.js"},
|
||||||
{"name":"fuzzyw.settings.js","url":"fuzzyw.settings.js"},
|
{"name":"fuzzyw.settings.js","url":"fuzzyw.settings.js"},
|
||||||
{"name":"fuzzyw.img","url":"fuzzyw.icon.js","evaluate":true},
|
{"name":"fuzzyw.img","url":"fuzzyw.icon.js","evaluate":true}
|
||||||
{"name":"fuzzy_strings.json","url":"fuzzy_strings.json"}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,10 +164,37 @@
|
||||||
"Music": "Musik",
|
"Music": "Musik",
|
||||||
"color": "Farbe",
|
"color": "Farbe",
|
||||||
"off": "aus",
|
"off": "aus",
|
||||||
"Theme": "Thema"
|
"Theme": "Thema",
|
||||||
|
"one": "eins",
|
||||||
|
"two": "zwei",
|
||||||
|
"three": "drei",
|
||||||
|
"four": "vier",
|
||||||
|
"five": "fünf",
|
||||||
|
"six": "sechs",
|
||||||
|
"seven": "sieben",
|
||||||
|
"eight": "acht",
|
||||||
|
"nine": "neun",
|
||||||
|
"ten": "zehn",
|
||||||
|
"eleven": "elf",
|
||||||
|
"twelve": "zwölf"
|
||||||
},
|
},
|
||||||
"alarm": {
|
"alarm": {
|
||||||
"//": "App-specific overrides",
|
"//": "App-specific overrides",
|
||||||
"rpt": "Wdh."
|
"rpt": "Wdh."
|
||||||
|
},
|
||||||
|
"fuzzyw": {
|
||||||
|
"//": "App-specific overrides",
|
||||||
|
"*$1 o'clock": "*$1 uhr",
|
||||||
|
"five past *$1": "fünf nach *$1",
|
||||||
|
"ten past *$1": "zehn nach *$1",
|
||||||
|
"quarter past *$1": "viertel nach *$1",
|
||||||
|
"twenty past *$1": "zwanzig nach *$1",
|
||||||
|
"twenty five past *$1": "fünf for halb *$2",
|
||||||
|
"half past *$1": "halb *$2",
|
||||||
|
"twenty five to *$2": "fünf nach halb *$2",
|
||||||
|
"twenty to *$2": "zwanzig vor *$2",
|
||||||
|
"quarter to *$2": "viertel vor *$2",
|
||||||
|
"ten to *$2": "zehn vor *$2",
|
||||||
|
"five to *$2": "fünf vor *$2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue