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)

enhancement
Not set
normal

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: nobody → l10n
There's bug 1441305 which should be unblocked now and maybe would let us stick to BCP47?
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.
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?
> 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
Depends on: 1465711
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 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+
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.

Attachment

General

Created:
Updated:
Size: