As I'm sure you noticed, we currently do translation like this: https://github.com/espruino/BangleApps/blob/master/apps/locale/locale.html#L74
translate: s => {s=""+s;return locale.trans[s]||locale.trans[s.toLowerCase()]||s;},
The way it's handled, that translation array gets loaded into RAM as soon as locale is used.
locale
However, it could easily be modified to:
translate: s => { var trans = { ... actual translation data here ... } s=""+s;return trans[s]||trans[s.toLowerCase()]||s;},
Since function code is kept in Flash, this would be nice and tidy and would allow translation without a massive memory usage hit.
And I think maybe we could do something smarter with the translation, like:
No
no
New Alarm
> New Alarm
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
As I'm sure you noticed, we currently do translation like this: https://github.com/espruino/BangleApps/blob/master/apps/locale/locale.html#L74
The way it's handled, that translation array gets loaded into RAM as soon as
locale
is used.However, it could easily be modified to:
Since function code is kept in Flash, this would be nice and tidy and would allow translation without a massive memory usage hit.
And I think maybe we could do something smarter with the translation, like:
No
/no
) specially (could be done with regex)New Alarm
from> New Alarm
could get picked up)