Translation editor (#249)

* Enabled DOUBLE line for Croatian + translation fix

Enabled DOUBLE line Menu for Croatian.
A minor translation fix.

* Added Double line menus for Croatian

Added Double line menus for Croatian. For some reason they were not included in the previous pull request, even though I made them (most probably it was by my mistake).

* Added "Power: " translation for Croatian

* Menu desciption scroll sped up 3x

* Slow scroll

* Additional HR translation fix

* EOL fixed

* Fixed flickering - update only when required

* Reverted to Ralim/ts100 current Translation.c, HR translation fix moved
to translation-hr branch

* Synchronized with Ralim master

* Synchronized with Ralim

* Ralim

* Ralim

* Sync

* - Translation Editor Tool (HTML5)
- Translations Parser (HTML5 tool for extracting initial translations from Translations.cpp to separate JSON files)
- Languages extracted into separate JSON files

* Added make_translation.py pre-compile script that creates Translation.cpp from JSON files. This one is just for single-language version, until we make a multi-lingual one.

* Fixed Lithuanian local language name.

* Fixed _lt.json syntax

* Added 12x16 and 6x8 HTML5 font editor

* Added Icon (16x16), Screen (84x16) and Full-Screen (96x16) sizes to Font Editor

* "Font Editor" changed to "Bitmap Editor"

* Added 24x16 icon size
This commit is contained in:
jonnieZG
2018-09-04 00:39:00 +02:00
committed by Ben V. Brown
parent 389adcb823
commit 4c8a9d7c65
24 changed files with 4858 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
function saveToFile(txt, filename){
var a = document.createElement('a');
a.setAttribute("style", "display: none");
document.body.appendChild(a);
a.setAttribute('href', 'data:application/json;charset=utf-8,'+encodeURIComponent(txt));
a.setAttribute('download', filename);
a.click();
document.body.removeChild(a);
}
function saveJSON(obj, filename){
var txt = JSON.stringify(obj,"", "\t");
saveToFile(txt, filename);
}
function showJSON(obj, filename) {
var txt = JSON.stringify(obj,"", "\t");
var a = window.open("", "_blank").document;
a.write("<PLAINTEXT>");
a.write(txt);
a.title = filename;
}
function startsWith(str, prefix) {
return str.substring(0, prefix.length) == prefix;
}
function endsWith(str, suffix) {
return str.substring(str.length-suffix.length) == suffix;
}
function isDefined(obj) {
return typeof obj !== 'undefined';
}
function isNumber(obj) {
return isDefined(obj) && obj != null;
}
function isDefinedNN(obj) {
return isDefined(obj) && obj != null;
}
function padLeft(str, chr, maxLen) {
str = str.toString();
return str.length < maxLen ? padLeft(chr + str, chr, maxLen) : str;
}
// sourceArray contains a list of objects that have a property "id". This methods makes a map using the "id" as a key, and the owning object as a value.
function copyArrayToMap(sourceArray, map) {
if (!isDefined(map)) {
map = {};
}
var len = sourceArray.length;
for (var i = 0; i<len; i++) {
var v = sourceArray[i];
map[v.id] = v;
}
return map;
}
function checkTranslationFile(fileName) {
return startsWith(fileName, "translation_") && endsWith(fileName, ".json") || confirm("Are you sure that you want to use "+fileName+" instead of a translation_*.json file?");
}
function xunescape(str) {
return str.replace(/\\/g, "");
}