0

[locales] Rename locales to platform_pak_locales

This CL renames the locales variable in build/config/locales.gni (which
is used throughout the build system) to platform_pak_locales.

The new term more accurately describes that this list is platform
dependent and in the pak file format. It is also easier to find in code
search.

The locales variable is not actually removed in this CL in order to not
break downstream builds. Once downstream builds all use the new
platform_pak_locals variable the old locale variable will be removed.

Bug: 1293908
Change-Id: Ica16d8c52a056acf59c27ea5b4d52b03ad9da6df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3442606
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Reviewed-by: Claudio M <claudiomagni@chromium.org>
Reviewed-by: Michael Cui <mlcui@google.com>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Commit-Queue: Trevor Perrier <perrier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#968400}
This commit is contained in:
Trevor Perrier
2022-02-08 17:29:46 +00:00
committed by Chromium LUCI CQ
parent 9d09dc710c
commit c8f7da5b0d
13 changed files with 39 additions and 37 deletions

@ -848,8 +848,8 @@ if (enable_resource_allowlist_generation) {
}
webview_repack_locales("repack_locales") {
input_locales = locales
output_locales = locales
input_locales = platform_pak_locales
output_locales = platform_pak_locales
if (enable_resource_allowlist_generation) {
repack_allowlist = system_webview_pak_allowlist
@ -861,7 +861,7 @@ android_assets("locale_pak_assets") {
disable_compression = true
renaming_sources = []
renaming_destinations = []
foreach(_locale, locales) {
foreach(_locale, platform_pak_locales) {
renaming_sources += [ "$root_out_dir/android_webview/locales/$_locale.pak" ]
renaming_destinations += [ "stored-locales/$_locale.pak" ]
}

@ -208,7 +208,7 @@ template("system_webview_apk_or_module_tmpl") {
deps += [ "//third_party/arcore-android-sdk-client:com_google_ar_core_J__unpack_aar" ]
}
aapt_locale_allowlist = locales
aapt_locale_allowlist = platform_pak_locales
resource_exclusion_regex = common_resource_exclusion_regex
resource_exclusion_exceptions = common_resource_exclusion_exceptions

@ -57,7 +57,7 @@ template("system_webview_bundle") {
if (defined(invoker.weblayer_deps)) {
deps += invoker.weblayer_deps
}
aapt_locale_allowlist = locales
aapt_locale_allowlist = platform_pak_locales
proguard_enabled = !is_java_debug
package_name = "weblayer"
package_id = 126
@ -77,7 +77,7 @@ template("system_webview_bundle") {
if (webview_includes_weblayer && weblayer_in_split) {
extra_modules = [ _weblayer_module_desc ]
}
system_image_locale_allowlist = locales
system_image_locale_allowlist = platform_pak_locales
is_multi_abi =
android_64bit_target_cpu && (!defined(invoker.include_64_bit_webview) ||
invoker.include_64_bit_webview) &&

@ -4,11 +4,10 @@
import("//build/config/chromeos/ui_mode.gni")
# 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| variable *may* contain pseudolocales, depending on the
# |enable_pseudolocales| flag.
# This file creates |platform_pak_locales| which is the set of current locales
# based on the current platform. Locales in this list are formatted based on
# what .pak files expect. The |platform_pak_locales| variable *may* contain
# pseudolocales, depending on the |enable_pseudolocales| flag.
# If you specifically want to have the locales variable with or without
# pseudolocales, then use |locales_with_pseudolocales| or
# |locales_without_pseudolocales|.
@ -169,13 +168,13 @@ chromeos_only_locales = [
]
if (is_android) {
locales = all_chrome_locales
platform_pak_locales = all_chrome_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) {
foreach(_locale, platform_pak_locales) {
android_bundle_locales_as_resources +=
[ string_replace(_locale, "-", "-r") ]
}
@ -200,21 +199,21 @@ if (is_android) {
]
} else if (is_chromeos_ash || is_chromeos_lacros) {
# In ChromeOS we support a few more locales than standard Chrome.
locales =
platform_pak_locales =
all_chrome_locales - android_bundle_only_locales + chromeos_only_locales
} else {
# Change if other platforms support more locales.
locales = all_chrome_locales - android_bundle_only_locales
platform_pak_locales = all_chrome_locales - android_bundle_only_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 -= [
platform_pak_locales -= [
"es-419",
"pt-BR",
]
locales += [
platform_pak_locales += [
"es-MX",
"pt",
]
@ -224,8 +223,8 @@ pseudolocales = [
"ar-XB",
"en-XA",
]
locales_without_pseudolocales = locales
locales_with_pseudolocales = locales + pseudolocales
locales_without_pseudolocales = platform_pak_locales
locales_with_pseudolocales = platform_pak_locales + pseudolocales
declare_args() {
# We want to give pseudolocales to everyone except end-users (devs & QA).
@ -234,13 +233,13 @@ declare_args() {
if (enable_pseudolocales) {
# Note that this only packages the locales in, and doesn't add the ui to enable them.
locales += pseudolocales
platform_pak_locales += pseudolocales
}
# 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) {
foreach(locale, platform_pak_locales) {
if (locale == "en-US") {
locales_as_mac_outputs += [ "en" ]
} else {
@ -249,7 +248,10 @@ foreach(locale, locales) {
}
if (is_ios) {
ios_packed_locales = locales - ios_unsupported_locales
ios_packed_locales = platform_pak_locales - ios_unsupported_locales
ios_packed_locales_as_mac_outputs =
locales_as_mac_outputs - ios_unsupported_locales
}
# Remove once downstream builds use |platform_pak_locales| (https://crbug.com/1293908)
locales = platform_pak_locales

@ -541,7 +541,7 @@ if (is_win) {
outputs = []
foreach(locale, locales) {
foreach(locale, platform_pak_locales) {
if (is_chrome_branded) {
_strings_file = "google_chrome_strings"
} else {
@ -569,7 +569,7 @@ if (is_win) {
rebase_path("$target_gen_dir/app_infoplist_strings", root_build_dir),
"-t",
"main",
] + locales
] + platform_pak_locales
if (is_chrome_branded) {
deps = [ "//chrome/app:google_chrome_strings" ]

@ -157,7 +157,7 @@ if (android_64bit_target_cpu) {
}
generate_ui_locale_resources("ui_locale_string_resources") {
ui_locales = locales
ui_locales = platform_pak_locales
}
# Resources which are needed in the base module manifest's application tag
@ -2175,7 +2175,7 @@ if (current_toolchain == default_toolchain) {
renaming_sources = []
renaming_destinations = []
foreach(_locale, locales) {
foreach(_locale, platform_pak_locales) {
renaming_sources +=
[ "$target_gen_dir/${_variant}_paks/locales/$_locale.pak" ]
renaming_destinations += [ "locales/$_locale.pak" ]
@ -2724,7 +2724,7 @@ template("monochrome_public_apk_or_module_tmpl") {
# Ensure the localized resources for all locales are used, even when
# a smaller set is specified through aapt_locale_allowlist.
shared_resources_allowlist_locales = locales
shared_resources_allowlist_locales = platform_pak_locales
}
deps = []

@ -219,7 +219,7 @@ template("chrome_public_common_apk_or_module_tmpl") {
if (!defined(aapt_locale_allowlist)) {
# Include resource strings files only for supported locales.
aapt_locale_allowlist = locales
aapt_locale_allowlist = platform_pak_locales
}
if (!defined(use_chromium_linker)) {

@ -169,7 +169,8 @@ template("chrome_bundle") {
proguard_enabled = !is_java_debug
enable_language_splits = true
extra_modules = _extra_modules
system_image_locale_allowlist = locales - android_bundle_only_locales
system_image_locale_allowlist =
platform_pak_locales - android_bundle_only_locales
is_multi_abi = _is_multi_abi
validate_services = _enable_chrome_module

@ -112,7 +112,7 @@ template("chrome_feature_module") {
}
# Don't embed more translations than required (http://crbug.com/932017).
aapt_locale_allowlist = locales
aapt_locale_allowlist = platform_pak_locales
proguard_enabled = !is_java_debug
package_name = _module_desc.name

@ -463,13 +463,13 @@ template("chrome_paks") {
repack_allowlist = invoker.repack_allowlist
}
input_locales = locales
input_locales = platform_pak_locales
output_dir = "${invoker.output_dir}/locales"
if (is_mac) {
output_locales = locales_as_mac_outputs
} else {
output_locales = locales
output_locales = platform_pak_locales
}
}

@ -3,7 +3,6 @@
# found in the LICENSE file.
import("//build/config/android/rules.gni")
import("//build/config/locales.gni")
android_library("java") {
sources = [

@ -1254,7 +1254,7 @@ fuzzer_test("file_info_fuzzer") {
# "en-US" in the list as the |ResourceBundle::GetLocaleFilePath| implementations
# in ui/base/resource/resource_bundle_{mac,ios}.mm return a valid path for
# "en-US" (as they internally rewrite it as "en" instead).
locales_for_platform_list = locales
locales_for_platform_list = platform_pak_locales
if (is_apple) {
locales_for_platform_list += [ "en" ]
}

@ -80,8 +80,8 @@ if (is_android) {
}
repack_locales("weblayer_locales") {
input_locales = locales
output_locales = locales
input_locales = platform_pak_locales
output_locales = platform_pak_locales
source_patterns = [
"${root_gen_dir}/components/strings/components_locale_settings_",
"${root_gen_dir}/device/bluetooth/strings/bluetooth_strings_",
@ -109,7 +109,7 @@ if (is_android) {
disable_compression = true
renaming_sources = []
renaming_destinations = []
foreach(_locale, locales) {
foreach(_locale, platform_pak_locales) {
renaming_sources += [ "$root_out_dir/weblayer/locales/$_locale.pak" ]
renaming_destinations += [ "locales/$_locale.pak" ]
}