2022-04-21 20:06:02 +00:00
|
|
|
Languages (locale)
|
|
|
|
==================
|
2020-06-04 13:28:44 +00:00
|
|
|
|
|
|
|
Country-specific app internationalisation.
|
|
|
|
|
|
|
|
This is not an app, but instead it is a library that can be used by
|
2022-04-21 20:06:02 +00:00
|
|
|
other applications or widgets to provide locale-friendly
|
2020-06-04 13:28:44 +00:00
|
|
|
|
2022-04-21 20:06:02 +00:00
|
|
|
- Dates
|
|
|
|
- Time (12h/24h)
|
|
|
|
- Days of the Week
|
|
|
|
- Months
|
|
|
|
- Currency values
|
|
|
|
- Distances/Lengths/Speed (metric/imperial)
|
|
|
|
- Temperature (°C/°F)
|
2020-06-04 13:28:44 +00:00
|
|
|
|
2022-04-21 20:06:02 +00:00
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
|
|
|
If you're writing an application you can use the `locale` library to
|
2020-06-04 13:28:44 +00:00
|
|
|
do all the translation for you.
|
|
|
|
|
|
|
|
See https://www.espruino.com/Bangle.js+Locale for full examples.
|
|
|
|
|
|
|
|
```JS
|
|
|
|
// Date to date string (long)
|
2022-04-21 20:06:02 +00:00
|
|
|
>require("locale").date(new Date())
|
2020-06-04 13:28:44 +00:00
|
|
|
="Donnerstag, 02. April 2020"
|
|
|
|
|
|
|
|
// Date to date string (short)
|
2022-04-21 20:06:02 +00:00
|
|
|
>require("locale").date(new Date(), 1)
|
2020-06-04 13:28:44 +00:00
|
|
|
="02.04.2020"
|
|
|
|
```
|
|
|
|
|
|
|
|
Bangle.js has a `locale` library built in that is just a standard
|
|
|
|
British English (`en_GB`) localisation - so you can use `locale`
|
|
|
|
in your apps without requiring users to have this Language library
|
|
|
|
installed.
|