Add cyrillic parameter for font selection in json language files

This commit is contained in:
Rockman18
2018-11-15 02:12:36 +01:00
parent bc2446126f
commit 845dcd4bc6
6 changed files with 35 additions and 4 deletions

View File

@@ -48,6 +48,9 @@
} else if (id == "current-lang-file") {
if (checkTranslationFile(file.name)) {
app.current = json;
if (!app.current.cyrillicGlyphs){
app.current.cyrillicGlyphs = false;
}
app.meta.currentLoaded = true;
}
}
@@ -238,6 +241,15 @@
<td class="label">Local Language Name</td>
<td class="value"><input type="text" v-model="current.languageLocalName" class="short"></td>
</tr>
<tr v-if="meta.currentLoaded">
<td class="label">Font table to use</td>
<td class="value">
<select v-model="current.cyrillicGlyphs" v-on:change="current.cyrillicGlyphs = current.cyrillicGlyphs=='true'">
<option value="false">Latin Extended</option>
<option value="true">Cyrillic Glyphs</option>
</select>
</td>
</tr>
</table>
<div v-if="def.messages && referent.messages && current.messages">

View File

@@ -84,6 +84,7 @@
if (!isDefined(lang)) {
lang = {
languageCode: langCode,
cyrillicGlyphs: false,
messages: {},
characters: {},
menuDouble : false,
@@ -97,6 +98,13 @@
continue;
}
// Use Cyrillic glyphs
if (startsWith(line, "#define CYRILLIC_GLYPHS")) {
lang.cyrillicGlyphs = true;
entryIndex = 0;
continue;
}
// Menu type
reMenuMode.lastIndex = 0;
match = reMenuMode.exec(line);

View File

@@ -51,7 +51,7 @@ def readTranslations(jsonDir):
langCodeFromJson = lang['languageCode']
except KeyError:
langCodeFromJson = "(missing)"
# ...cause they should be the same!
if langCode != langCodeFromJson:
raise ValueError("Invalid languageCode " + langCodeFromJson + " in file " + fileName)
@@ -87,6 +87,14 @@ def writeLanguage(languageCode, defs, f):
f.write(to_unicode("// ---- " + langName + " ----\n\n"))
try:
cyrillic = lang['cyrillicGlyphs']
except KeyError:
cyrillic = False
if cyrillic :
f.write(to_unicode("#define CYRILLIC_GLYPHS\n\n"))
# ----- Writing SettingsDescriptions
obj = lang['menuOptions']
f.write(to_unicode("const char* SettingsDescriptions[] = {\n"))

View File

@@ -228,5 +228,6 @@
"desc": "Power Wattage of the power adapter used"
}
},
"languageLocalName": "Русский"
"languageLocalName": "Русский",
"cyrillicGlyphs": true
}