From 379c35e4c0134859e21479237747c5880ff72c2c Mon Sep 17 00:00:00 2001 From: Kainalu Hagiwara Date: Wed, 29 Jul 2020 09:52:01 -0700 Subject: [PATCH] For #13066 - Translate locale codes to Android specific variants before filtering --- automation/taskcluster/l10n/locales.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/automation/taskcluster/l10n/locales.py b/automation/taskcluster/l10n/locales.py index 5e2e80fe1..86fb89577 100644 --- a/automation/taskcluster/l10n/locales.py +++ b/automation/taskcluster/l10n/locales.py @@ -11,11 +11,21 @@ import re OPEN_LOCALES = "locales = [" CLOSE_LOCALES = "]" +# Android uses non-standard locale codes, these are the mappings back and forth +# See Legacy language codes in https://developer.android.com/reference/java/util/Locale.html +ANDROID_LEGACY_MAP = { + 'he': 'iw', + 'id': 'in', + 'yi': 'ji' +} + def trim_to_locale(str): match = re.search('\s*"([a-z]+-?[A-Z]*)",\s*', str) if not match: raise Exception("Failed parsing locale found in l10n.toml: " + str) - return match.group(1) + + locale = match.group(1) + return ANDROID_LEGACY_MAP.get(locale, locale) # This file is a dumb parser that converts values from '/l10n.toml' to be easily consumed from