• As I'm sure you noticed, we currently do translation like this: https://github.com/espruino/BangleApps/b­lob/master/apps/locale/locale.html#L74

    translate: s => {s=""+s;return locale.trans[s]||locale.trans[s.toLowerC­ase()]||s;},

    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:

    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:

    • Handle capital letters (No/no) specially (could be done with regex)
    • Match on part of the string (so just New Alarm from > New Alarm could get picked up)

Avatar for Gordon @Gordon started