Closed
Bug 1465517
Opened 7 years ago
Closed 7 years ago
Support Android's mangled locale codes in project config
Categories
(Localization Infrastructure and Tools :: compare-locales, enhancement)
Localization Infrastructure and Tools
compare-locales
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: Pike, Assigned: Pike)
References
()
Details
Attachments
(1 file)
https://developer.android.com/guide/topics/resources/providing-resources documents that android's file locations merrily do anything that's not a proper locale code anywhere else.
en-rCA or b+en+CA are the variations they came up with.
We should support both in compare-locales' project config without having to mangle locale codes in the l10n infrastructure.
We'll do that by adding more implied variables to use in file paths.
Sadly, we'll need mappings in both ways :-/
| Assignee | ||
Updated•7 years ago
|
Assignee: nobody → l10n
Comment 1•7 years ago
|
||
There's bug 1441305 which should be unblocked now and maybe would let us stick to BCP47?
| Assignee | ||
Comment 2•7 years ago
|
||
Nope. They're still using mangled codes, and it's the b+ variant listed in the initial comment. So instead of en-CA, the language tag fragment is en+CA.
The only thing that we get there is that there might be support for Script tags in language tags, though we'd have to find out how that works in language negotiation for zh-* before actually using it.
But for the file path detection, we'll still need to invest to live with Android's avoidance of standards.
Comment 3•7 years ago
|
||
Ok, but if we would only support the b+en+CA abomination, and not the en-rCA abomination, then we could have a reliable conversion by cutting out `b+` and replacing all `+` with `-`?
Or is it no big difference from handling both? I'm not sure how far the `en-rCA`?
I'm not sure what they mean by "support BCP47" - do they support script subtags? variants? extension keys?
Comment 4•7 years ago
|
||
> Android 7.0 (API level 24) introduced support for BCP 47 language tags,
As far as I know, we're at level 16 for Fennec, unless we name the FTP folder randomly
https://ftp.mozilla.org/pub/mobile/nightly/latest-mozilla-central-android-api-16-l10n/
Level 24 is 7.0 (released in 2016), while level 16 is 4.1
| Assignee | ||
Comment 5•7 years ago
|
||
This adds special handling for a variable named `android_locale`.
Locale codes with region get mangled to ab-rCD, more complex ones
to b+ab+Latn+CD, and back.
The locale list in l10n.toml is just a regular list of BCP 47
locale codes.
A l10n.toml could look like:
basepath = "."
locales = [
"am",
"an",
"anp",
"es-MX",
"sr-Latn",
]
[env]
app_base = "app/src/main/res/"
l10n_root = "{l10n_base}/{app_base}values-{android_locale}"
[[paths]]
reference = "{app_base}values/strings.xml"
l10n = "{l10n_root}/strings.xml"
Comment 6•7 years ago
|
||
Comment on attachment 8999130 [details]
bug 1465517, support Android's mangled locale codes in project config, r=sebastian
Sebastian Kaspari (:sebastian) has approved the revision.
Attachment #8999130 -
Flags: review+
| Assignee | ||
Comment 7•7 years ago
|
||
Thanks, also added the legacy locale code mappings. Landed as https://hg.mozilla.org/l10n/compare-locales/rev/53f9b25db77288f9879f4d4e307c94a9c639f6f8.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•