merge in https://github.com/espruino/EspruinoAppLoaderCore/pull/11 in such a way that we can use it from apps/locales as well (to avoid some duplication!)

more characters added to list that need remapping
master
Gordon Williams 2022-04-07 16:08:39 +01:00
parent 895e7ffd59
commit e9e92cc95b
3 changed files with 6 additions and 33 deletions

View File

@ -16,6 +16,7 @@
<p>Then click <button id="upload" class="btn btn-primary">Upload</button></p>
<script src="../../core/lib/customize.js"></script>
<script src="../../core/js/utils.js"></script>
<script src="locales.js" charset="utf-8"></script>
<script>
@ -59,7 +60,7 @@ exports = { name : "en_GB", currencySym:"£",
/*else if (chCode<256) // it's non-ascii, but <256 - just escape it
n = chCode;*/
else {
if (charFallbacks[ch]) return charFallbacks[ch];
if (CODEPAGE_CONVERSIONS[ch]) return CODEPAGE_CONVERSIONS[ch];
console.error(`Locale ${lang}: Character ${ch} (${chCode}) is not in Code Page ${codePage.name}`);
return undefined;
}

View File

@ -34,36 +34,8 @@ const codePages = {
`.replace(/[ \n]/g,"")
}
};
/* When it's not in the codepage, try and use
these conversions */
const charFallbacks = {
"ą":"a",
"ā":"a",
"å":"a",
"č":"c",
"ć":"c",
"ě":"e",
"ę":"e",
"ē":"e",
"æ":"e",
"ģ":"g",
"i":"ī",
"ķ":"k",
"ļ":"l",
"ł":"l",
"ń":"n",
"ņ":"n",
"ő":"o",
"ó":"o",
"ø":"o",
"ř":"r",
"ś":"s",
"š":"s",
"ū":"u",
"ż":"z",
"ź":"z",
"ž":"z",
};
// charFallbacks is now in core/js/utils.js as CODEPAGE_CONVERSIONS
/*
timePattern / datePattern:
@ -594,7 +566,7 @@ var locales = {
day: "Domingo,Segunda-feira,Terça-feira,Quarta-feira,Quinta-feira,Sexta-feira,Sábado",
trans: { yes: "sim", Yes: "Sim", no: "não", No: "Não", ok: "certo", on: "ligado", off: "desligado" }
},
"cs_CZ": { // THIS NEVER WORKED PROPERLY - many chars are not in the ISO8859-1 codepage and we use charFallbacks
"cs_CZ": { // THIS NEVER WORKED PROPERLY - many chars are not in the ISO8859-1 codepage and we use CODEPAGE_CONVERSIONS
lang: "cs_CZ",
decimal_point: ",",
thousands_sep: " ",

2
core

@ -1 +1 @@
Subproject commit e9097fa680182069a5814c3e566a0bcbcb5e72a1
Subproject commit 34ab74e66906a296e4f5789339a1b8a64c50bec9