02-03-2018 19:55 - edited 02-04-2018 20:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-03-2018 19:55 - edited 02-04-2018 20:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
When you call locale.language it returns the value in the format "en_AU" instead of "en-AU". I tested this for "fr-FR", and "de-DE" and it returned these in the incorrect format. I presume that this is the case for other locales.
As these are not using the international standard (BCP: 47) of "dd-DD", you cannot perform functions such as date.toLocaleString(locale) as it returns as the error "error: RangeError: Invalid language tag: en_AU".
According to BCP: 47,
A language tag is composed from a sequence of one or more "subtags", each of which refines or narrows the range of language identified by the overall tag. Subtags, in turn, are a sequence of alphanumeric characters (letters and digits), distinguished and separated from other subtags in a tag by a hyphen ("-", [Unicode] U+002D).
02-03-2018 23:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-03-2018 23:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I totally agree.
The thing is, according to the official docs, the code "should" be in the BCP 47 format (https://dev.fitbit.com/build/reference/companion-api/user-settings/).

02-04-2018 20:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-04-2018 20:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
I've logged this one, but I'm not sure if it's a documentation issue, or a bug at this time. Will let you know. Thanks!
02-06-2018 03:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-06-2018 03:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Also the Fitbit Web API uses the wrong localisation:
https://dev.fitbit.com/build/reference/web-api/basics/
This will ignore the specification for the Accpept-language header:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language
which will refer to this spec:
https://tools.ietf.org/html/rfc7231#section-3.1.3.1
So this seems to have a deep impact in all APIs.

02-09-2018 05:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-09-2018 05:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@allyannI found this in my clock face app when creating localised versions of the settings page and had to write a routine to replace the underscores with hyphens. Strangely, the local is returned in the correct format on the watch, just not in the companion app. Hope this helps.

