243 строки
4.8 KiB
Plaintext
243 строки
4.8 KiB
Plaintext
# Copyright 2014 The Chromium Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
# This file creates the |locales| which is the set of current
|
|
# locales based on the current platform. Locales in this list are formated
|
|
# based on what .pak files expect.
|
|
# The |locales_with_fake_bidi| variable is the same but with
|
|
# the fake bidirectional locale added.
|
|
|
|
# The following additional platform specific lists are created:
|
|
# - |android_non_bundle_locales| subset for Android based apk builds
|
|
# - |locales_as_mac_outputs| formated for mac output bundles
|
|
# - |ios_packed_locales| subset for iOS
|
|
# - |ios_packed_locales_as_mac_outputs| subset for iOS output
|
|
|
|
# Android doesn't ship all locales in order to save space (but webview does).
|
|
# http://crbug.com/369218
|
|
android_chrome_omitted_locales = [
|
|
"bn",
|
|
"et",
|
|
"gu",
|
|
"kn",
|
|
"ml",
|
|
"mr",
|
|
"ms",
|
|
"ta",
|
|
"te",
|
|
]
|
|
|
|
# Chrome on iOS only ships with a subset of the locales supported by other
|
|
# version of Chrome as the corresponding locales are not supported by the
|
|
# operating system (but for simplicity, the corresponding .pak files are
|
|
# still generated).
|
|
ios_unsupported_locales = [
|
|
"am",
|
|
"bn",
|
|
"et",
|
|
"fil",
|
|
"gu",
|
|
"kn",
|
|
"lv",
|
|
"ml",
|
|
"mr",
|
|
"sl",
|
|
"sw",
|
|
"ta",
|
|
"te",
|
|
]
|
|
|
|
# These list are defined even when not building for Android or iOS for the
|
|
# sake of build/locale_tool.py. Ensure that GN doesn't complain about them
|
|
# being unused.
|
|
not_needed([ "android_chrome_omitted_locales" ])
|
|
not_needed([ "ios_unsupported_locales" ])
|
|
|
|
# Superset of all locales used in Chrome with platform specific changes noted.
|
|
all_chrome_locales = [
|
|
"af",
|
|
"am",
|
|
"ar",
|
|
"as",
|
|
"az",
|
|
"be",
|
|
"bg",
|
|
"bn",
|
|
"bs",
|
|
"ca",
|
|
"cs",
|
|
"da",
|
|
"de",
|
|
"el",
|
|
"en-GB",
|
|
"en-US",
|
|
"es",
|
|
"es-419", # "es-MX" in iOS (Mexico vs Latin America)
|
|
"et",
|
|
"eu",
|
|
"fa",
|
|
"fi",
|
|
"fil", # "tl" in .xml but "fil" in TC and .pak
|
|
"fr",
|
|
"fr-CA",
|
|
"gl",
|
|
"gu",
|
|
"he", # "iw" in .xml and TC but "he" in .pak
|
|
"hi",
|
|
"hr",
|
|
"hu",
|
|
"hy",
|
|
"id", # "in" in .xml but "id" in TC and .pak
|
|
"is",
|
|
"it",
|
|
"ja",
|
|
"ka",
|
|
"kk",
|
|
"km",
|
|
"kn",
|
|
"ko",
|
|
"ky",
|
|
"lo",
|
|
"lt",
|
|
"lv",
|
|
"mk",
|
|
"ml",
|
|
"mn",
|
|
"mr",
|
|
"ms",
|
|
"my",
|
|
"nb", # "no" in TC but "nb" in .xml and .pak
|
|
"ne",
|
|
"nl",
|
|
"or",
|
|
"pa",
|
|
"pl",
|
|
"pt-BR", # just "pt" in iOS
|
|
"pt-PT",
|
|
"ro",
|
|
"ru",
|
|
"si",
|
|
"sk",
|
|
"sl",
|
|
"sq",
|
|
"sr",
|
|
"sv",
|
|
"sw",
|
|
"ta",
|
|
"te",
|
|
"th",
|
|
"tr",
|
|
"uk",
|
|
"ur",
|
|
"uz",
|
|
"vi",
|
|
"zh-CN",
|
|
"zh-HK",
|
|
"zh-TW",
|
|
"zu",
|
|
]
|
|
|
|
# New locales added to Chrome on Android.
|
|
# Delete if most platforms support the new locales.
|
|
android_only_chrome_locales = [
|
|
"af",
|
|
"as",
|
|
"az",
|
|
"be",
|
|
"bs",
|
|
"eu",
|
|
"fr-CA",
|
|
"gl",
|
|
"hy",
|
|
"is",
|
|
"ka",
|
|
"kk",
|
|
"km",
|
|
"ky",
|
|
"lo",
|
|
"mk",
|
|
"mn",
|
|
"my",
|
|
"ne",
|
|
"or",
|
|
"pa",
|
|
"si",
|
|
"sq",
|
|
"ur",
|
|
"uz",
|
|
"zh-HK",
|
|
"zu",
|
|
]
|
|
|
|
if (is_android) {
|
|
# Once bundles support all languages will just be locales
|
|
locales = all_chrome_locales - android_only_chrome_locales
|
|
|
|
# Android doesn't ship all locales on KitKat in order to save space
|
|
# (but webview does). http://crbug.com/369218
|
|
android_non_bundle_locales =
|
|
all_chrome_locales - android_only_chrome_locales -
|
|
android_chrome_omitted_locales
|
|
|
|
# List for Android locale names in .xml exports. Note: needs to stay in sync
|
|
# with |ToAndroidLocaleName| in build/android/gyp/util/resource_utils.py.
|
|
# - add r: (e.g. zh-HK -> zh-rHK )
|
|
android_bundle_locales_as_resources = []
|
|
foreach(_locale, locales) {
|
|
android_bundle_locales_as_resources +=
|
|
[ string_replace(_locale, "-", "-r") ]
|
|
}
|
|
|
|
# - remove en-US
|
|
# - swap: (he, id, en-419, fil) -> (iw, in, es-rUS, tl)
|
|
android_bundle_locales_as_resources -= [
|
|
"en-rUS",
|
|
"es-r419",
|
|
"fil",
|
|
"he",
|
|
"id",
|
|
]
|
|
android_bundle_locales_as_resources += [
|
|
"es-rUS",
|
|
"in",
|
|
"iw",
|
|
"tl",
|
|
]
|
|
} else {
|
|
# Change if other platforms support more locales
|
|
locales = all_chrome_locales - android_only_chrome_locales
|
|
}
|
|
|
|
# Chrome on iOS uses different names for "es-419" and "pt-BR" (called
|
|
# respectively "es-MX" and "pt" on iOS).
|
|
if (is_ios) {
|
|
locales -= [
|
|
"es-419",
|
|
"pt-BR",
|
|
]
|
|
locales += [
|
|
"es-MX",
|
|
"pt",
|
|
]
|
|
}
|
|
|
|
locales_with_fake_bidi = locales + [ "fake-bidi" ]
|
|
|
|
# Same as the locales list but in the format Mac expects for output files:
|
|
# it uses underscores instead of hyphens, and "en" instead of "en-US".
|
|
locales_as_mac_outputs = []
|
|
foreach(locale, locales) {
|
|
if (locale == "en-US") {
|
|
locales_as_mac_outputs += [ "en" ]
|
|
} else {
|
|
locales_as_mac_outputs += [ string_replace(locale, "-", "_") ]
|
|
}
|
|
}
|
|
|
|
if (is_ios) {
|
|
ios_packed_locales = locales - ios_unsupported_locales
|
|
ios_packed_locales_as_mac_outputs =
|
|
locales_as_mac_outputs - ios_unsupported_locales
|
|
}
|