This looks really promising. Definitely something that could be pulled into Bangle.js.
I guess one question is we have similar issues with time (12/24 hr), distance, speed, and maybe even numbers (,/. for separators). Perhaps we should have a 'Locale' library that handles all of these in one go. It might make sense (at least initially) to have it as a JS module/app to allow quick iteration.
My suggestion would be:
Add something like Bangle.getLocaleString(value, inputUnits) - eg Bangle.getLocaleString(new Date(),'time') which executed the JS in a file called locale if it existed, or just output a 'standard' format.
Add a new 'Locale' app which had a settings app which contained all @MaBe's strings, as well as the magic locale JS file that did all the magic
A second option is to still have the app and locale file, but to do something like this for each app that uses it:
var locale = {}
try {locale = require("locale");} catch(e){}
if (!locale.getTime) locale.getTime = d=>d.toISOString().match(/T(.....)/)[1];
// ...
console.log(locale.getTime(new Date()));
That'd then be compatible with all devices including the emulator (which doesn't support apps yet)
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.
This looks really promising. Definitely something that could be pulled into Bangle.js.
I guess one question is we have similar issues with time (12/24 hr), distance, speed, and maybe even numbers (
,/.
for separators). Perhaps we should have a 'Locale' library that handles all of these in one go. It might make sense (at least initially) to have it as a JS module/app to allow quick iteration.My suggestion would be:
Bangle.getLocaleString(value, inputUnits)
- egBangle.getLocaleString(new Date(),'time')
which executed the JS in a file calledlocale
if it existed, or just output a 'standard' format.locale
JS file that did all the magicA second option is to still have the app and
locale
file, but to do something like this for each app that uses it:That'd then be compatible with all devices including the emulator (which doesn't support apps yet)