1
0
forked from me/IronOS

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") { } else if (id == "current-lang-file") {
if (checkTranslationFile(file.name)) { if (checkTranslationFile(file.name)) {
app.current = json; app.current = json;
if (!app.current.cyrillicGlyphs){
app.current.cyrillicGlyphs = false;
}
app.meta.currentLoaded = true; app.meta.currentLoaded = true;
} }
} }
@@ -238,6 +241,15 @@
<td class="label">Local Language Name</td> <td class="label">Local Language Name</td>
<td class="value"><input type="text" v-model="current.languageLocalName" class="short"></td> <td class="value"><input type="text" v-model="current.languageLocalName" class="short"></td>
</tr> </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> </table>
<div v-if="def.messages && referent.messages && current.messages"> <div v-if="def.messages && referent.messages && current.messages">

View File

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

View File

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

View File

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

View File

@@ -223,7 +223,7 @@ const uint8_t FONT_12[]={
0x00,0x00,0x60,0xE0,0x80,0x10,0x18,0x8C,0xE4,0x60,0x00,0x00,0x00,0x00,0x00,0x81,0xE7,0x7E,0x1E,0x07,0x01,0x00,0x00,0x00, // ý c3 bd 0x00,0x00,0x60,0xE0,0x80,0x10,0x18,0x8C,0xE4,0x60,0x00,0x00,0x00,0x00,0x00,0x81,0xE7,0x7E,0x1E,0x07,0x01,0x00,0x00,0x00, // ý c3 bd
0x00,0x00,0x03,0xFF,0xFF,0x1B,0x18,0x18,0xF8,0xF0,0x00,0x00,0x00,0x00,0x30,0x3F,0x3F,0x36,0x06,0x06,0x07,0x03,0x00,0x00, // þ c3 be 0x00,0x00,0x03,0xFF,0xFF,0x1B,0x18,0x18,0xF8,0xF0,0x00,0x00,0x00,0x00,0x30,0x3F,0x3F,0x36,0x06,0x06,0x07,0x03,0x00,0x00, // þ c3 be
0x00,0x00,0x60,0xEC,0x8C,0x00,0x00,0x8C,0xEC,0x60,0x00,0x00,0x00,0x00,0x00,0x81,0xE7,0x7E,0x1E,0x07,0x01,0x00,0x00,0x00, // ÿ c3 bf 0x00,0x00,0x60,0xEC,0x8C,0x00,0x00,0x8C,0xEC,0x60,0x00,0x00,0x00,0x00,0x00,0x81,0xE7,0x7E,0x1E,0x07,0x01,0x00,0x00,0x00, // ÿ c3 bf
#ifdef LANG_RU #ifdef CYRILLIC_GLYPHS
/* Cyrillic Glyphs */ /* Cyrillic Glyphs */
//V192 ---- PAGE U+0400-U+043F (UTF 0xD080-0xD0BF) ---- //V192 ---- PAGE U+0400-U+043F (UTF 0xD080-0xD0BF) ----
0x00,0xFC,0xFC,0x8D,0x8F,0x8E,0x8C,0x8C,0x8C,0x0C,0x0C,0x00,0x00,0x3F,0x3F,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x00, // Ѐ d0 80 0x00,0xFC,0xFC,0x8D,0x8F,0x8E,0x8C,0x8C,0x8C,0x0C,0x0C,0x00,0x00,0x3F,0x3F,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x00, // Ѐ d0 80
@@ -841,7 +841,7 @@ const uint8_t FONT_6x8[] = {
0x44, 0x48, 0x32, 0x11, 0x0c, 0x00, // 189: 'ý' U+00fd (utf-8: c3 bd) 0x44, 0x48, 0x32, 0x11, 0x0c, 0x00, // 189: 'ý' U+00fd (utf-8: c3 bd)
0x7c, 0x28, 0x28, 0x10, 0x00, 0x00, // 190: 'þ' U+00fe (utf-8: c3 be) 0x7c, 0x28, 0x28, 0x10, 0x00, 0x00, // 190: 'þ' U+00fe (utf-8: c3 be)
0x44, 0x49, 0x30, 0x11, 0x0c, 0x00, // 191: 'ÿ' U+00ff (utf-8: c3 bf) 0x44, 0x49, 0x30, 0x11, 0x0c, 0x00, // 191: 'ÿ' U+00ff (utf-8: c3 bf)
#ifdef LANG_RU #ifdef CYRILLIC_GLYPHS
/* Cyrillic */ /* Cyrillic */
// ---- PAGE U+0400-U+043F (UTF 0xD080-0xD0BF) ---- // ---- PAGE U+0400-U+043F (UTF 0xD080-0xD0BF) ----
0x7c, 0x55, 0x56, 0x44, 0x44, 0x00, // 192: 'Ѐ' U+0400 (utf-8: d0 80) 0x7c, 0x55, 0x56, 0x44, 0x44, 0x00, // 192: 'Ѐ' U+0400 (utf-8: d0 80)

View File

@@ -1589,6 +1589,8 @@ const char* SettingsMenuEntriesDescriptions[4] = {
#ifdef LANG_RU #ifdef LANG_RU
// ---- Русский ---- // ---- Русский ----
#define CYRILLIC_GLYPHS
const char* SettingsDescriptions[] = { const char* SettingsDescriptions[] = {
/* PowerSource */ "Источник питания. Установка напряжения отключения. <DC 10V> <S 3.3 V на батарею>", /* PowerSource */ "Источник питания. Установка напряжения отключения. <DC 10V> <S 3.3 V на батарею>",
/* SleepTemperature */ "Температура режима ожидания <С>", /* SleepTemperature */ "Температура режима ожидания <С>",