From c8f7da5b0d953116a29ac6b51d92dffeb072593b Mon Sep 17 00:00:00 2001 From: Trevor Perrier <perrier@chromium.org> Date: Tue, 8 Feb 2022 17:29:46 +0000 Subject: [PATCH] [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} --- android_webview/BUILD.gn | 6 ++-- android_webview/system_webview_apk_tmpl.gni | 2 +- android_webview/system_webview_bundle.gni | 4 +-- build/config/locales.gni | 34 ++++++++++--------- chrome/BUILD.gn | 4 +-- chrome/android/BUILD.gn | 6 ++-- chrome/android/chrome_public_apk_tmpl.gni | 2 +- chrome/android/modules/chrome_bundle_tmpl.gni | 3 +- .../modules/chrome_feature_module_tmpl.gni | 2 +- chrome/chrome_paks.gni | 4 +-- components/find_in_page/android/BUILD.gn | 1 - ui/base/BUILD.gn | 2 +- weblayer/BUILD.gn | 6 ++-- 13 files changed, 39 insertions(+), 37 deletions(-) diff --git a/android_webview/BUILD.gn b/android_webview/BUILD.gn index b848056d68f37..795484778a998 100644 --- a/android_webview/BUILD.gn +++ b/android_webview/BUILD.gn @@ -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" ] } diff --git a/android_webview/system_webview_apk_tmpl.gni b/android_webview/system_webview_apk_tmpl.gni index 18595c92d5064..1434ca30b00de 100644 --- a/android_webview/system_webview_apk_tmpl.gni +++ b/android_webview/system_webview_apk_tmpl.gni @@ -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 diff --git a/android_webview/system_webview_bundle.gni b/android_webview/system_webview_bundle.gni index ad3abe8934946..b73c49f95146d 100644 --- a/android_webview/system_webview_bundle.gni +++ b/android_webview/system_webview_bundle.gni @@ -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) && diff --git a/build/config/locales.gni b/build/config/locales.gni index b1d41fe7da65a..75020224f9ccc 100644 --- a/build/config/locales.gni +++ b/build/config/locales.gni @@ -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 diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn index 67a430b99e98e..0d4812a0d250c 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn @@ -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" ] diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index c699fee4e7479..418e950d98d98 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn @@ -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 = [] diff --git a/chrome/android/chrome_public_apk_tmpl.gni b/chrome/android/chrome_public_apk_tmpl.gni index a208e00f85a0c..50d6d66e09fb5 100644 --- a/chrome/android/chrome_public_apk_tmpl.gni +++ b/chrome/android/chrome_public_apk_tmpl.gni @@ -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)) { diff --git a/chrome/android/modules/chrome_bundle_tmpl.gni b/chrome/android/modules/chrome_bundle_tmpl.gni index 201937aae06b4..805a3e0eaf9ab 100644 --- a/chrome/android/modules/chrome_bundle_tmpl.gni +++ b/chrome/android/modules/chrome_bundle_tmpl.gni @@ -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 diff --git a/chrome/android/modules/chrome_feature_module_tmpl.gni b/chrome/android/modules/chrome_feature_module_tmpl.gni index 6dc974f2be363..ee41a6db7a1ab 100644 --- a/chrome/android/modules/chrome_feature_module_tmpl.gni +++ b/chrome/android/modules/chrome_feature_module_tmpl.gni @@ -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 diff --git a/chrome/chrome_paks.gni b/chrome/chrome_paks.gni index afa0bf95691fc..9df8aa9dbc98f 100644 --- a/chrome/chrome_paks.gni +++ b/chrome/chrome_paks.gni @@ -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 } } diff --git a/components/find_in_page/android/BUILD.gn b/components/find_in_page/android/BUILD.gn index c0296a25b938a..1f83721a240f6 100644 --- a/components/find_in_page/android/BUILD.gn +++ b/components/find_in_page/android/BUILD.gn @@ -3,7 +3,6 @@ # found in the LICENSE file. import("//build/config/android/rules.gni") -import("//build/config/locales.gni") android_library("java") { sources = [ diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn index 92aaa52d4c145..37f37c3a8e8a0 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn @@ -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" ] } diff --git a/weblayer/BUILD.gn b/weblayer/BUILD.gn index ec546c76eeb4a..b531ddb246f41 100644 --- a/weblayer/BUILD.gn +++ b/weblayer/BUILD.gn @@ -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" ] }