From 43fcd55d34ca96458e15c237d015f1b596daf64a Mon Sep 17 00:00:00 2001 From: Trevor Perrier Date: Tue, 28 Jan 2020 21:45:21 +0000 Subject: [PATCH] [Android] don't map zh-hk to zh-tw in bundle builds. To give Clank language parity with Android 27 new locales are being added. 26 of those locales have been added in two previous CLs: - https://crrev.com/c/1941058 - https://crrev.com/c/1952288 zh-hk was skipped because currently resources for it are mapped to zh-tw. This CL skips that mapping for bundle builds where zh-hk is now included. zh-hk is still mapped to zh-tw in apk builds. There is an increase in size even when language splits are used in bundles. A bug has been created to look into this: - APK Bundles wastes a lot of space in resources.arsc (400kb) - https://crbug.com/1031645 Bug: 1034774 Binary-Size: Size increase is unavoidable (see above). Change-Id: I4edb9d5213e8dd3443522deee5395e500af34371 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1970258 Reviewed-by: Yaron Friedman Reviewed-by: (gone) Eric Stevenson Commit-Queue: Trevor Perrier Cr-Commit-Position: refs/heads/master@{#736071} --- android_webview/java/strings/android_webview_strings.grd | 1 + android_webview/ui/aw_strings.grd | 1 + build/android/gyp/compile_resources.py | 3 ++- build/config/locales.gni | 4 +--- chrome/android/chrome_public_apk_tmpl.gni | 3 +++ .../strings/android_chrome_autofill_assistant_strings.grd | 1 + .../java/strings/android_keyboard_accessory_strings.grd | 1 + .../java/strings/android_chrome_media_router_strings.grd | 1 + .../java/strings/android_chrome_start_surface_strings.grd | 1 + .../tab_ui/java/strings/android_chrome_tab_ui_strings.grd | 1 + .../features/vr/java/strings/android_chrome_vr_strings.grd | 1 + chrome/android/webapk/strings/android_webapk_strings.grd | 1 + chrome/app/chromium_strings.grd | 1 + chrome/app/generated_resources.grd | 2 ++ chrome/app/google_chrome_strings.grd | 1 + chrome/app/resources/locale_settings.grd | 1 + chrome/app/resources/locale_settings_linux.grd | 1 + .../internal/java/strings/android_touch_to_fill_strings.grd | 1 + chrome/browser/ui/android/strings/android_chrome_strings.grd | 1 + chromecast/chromecast.gni | 2 +- components/app_modal/android/app_modal_android_strings.grd | 1 + components/autofill/android/java/strings/autofill_strings.grd | 1 + components/browser_ui/strings/android/browser_ui_strings.grd | 1 + components/components_chromium_strings.grd | 1 + components/components_google_chrome_strings.grd | 1 + components/components_locale_settings.grd | 2 ++ components/components_strings.grd | 2 ++ .../java/strings/web_contents_delegate_android_strings.grd | 1 + components/omnibox/resources/omnibox_resources.grd | 1 + .../public/android/java/strings/android_content_strings.grd | 1 + device/bluetooth/bluetooth_strings.grd | 1 + device/fido/fido_strings.grd | 1 + services/services_strings.grd | 1 + third_party/blink/public/strings/blink_strings.grd | 1 + .../libaddressinput/chromium/address_input_strings.grd | 1 + ui/strings/app_locale_settings.grd | 1 + ui/strings/ui_strings.grd | 1 + 37 files changed, 43 insertions(+), 5 deletions(-) diff --git a/android_webview/java/strings/android_webview_strings.grd b/android_webview/java/strings/android_webview_strings.grd index 779ad49bbcaa77..d3d3af1a047fdc 100644 --- a/android_webview/java/strings/android_webview_strings.grd +++ b/android_webview/java/strings/android_webview_strings.grd @@ -78,6 +78,7 @@ + diff --git a/android_webview/ui/aw_strings.grd b/android_webview/ui/aw_strings.grd index 2b5e969aacb864..ec5f93e11597f7 100644 --- a/android_webview/ui/aw_strings.grd +++ b/android_webview/ui/aw_strings.grd @@ -83,6 +83,7 @@ + diff --git a/build/android/gyp/compile_resources.py b/build/android/gyp/compile_resources.py index cf2b4db5183000..f353fd6e01472a 100755 --- a/build/android/gyp/compile_resources.py +++ b/build/android/gyp/compile_resources.py @@ -697,7 +697,8 @@ def _PackageApk(options, build): build.deps_dir) logging.debug('Applying locale transformations') path_info = resource_utils.ResourceInfoFile() - _DuplicateZhResources(dep_subdirs, path_info) + if options.support_zh_hk: + _DuplicateZhResources(dep_subdirs, path_info) _RenameLocaleResourceDirs(dep_subdirs, path_info) _RemoveUnwantedLocalizedStrings(dep_subdirs, options) diff --git a/build/config/locales.gni b/build/config/locales.gni index bd57fc395cb3bc..44875e780974e9 100644 --- a/build/config/locales.gni +++ b/build/config/locales.gni @@ -171,9 +171,7 @@ android_only_chrome_locales = [ ] if (is_android) { - # Add all locales except "zh-HK" since this currently rendered as "zh-TW" - # https://crbug.com/780847 - locales = all_chrome_locales - [ "zh-HK" ] + locales = all_chrome_locales # Android doesn't ship all locales on KitKat in order to save space # (but webview does). http://crbug.com/369218 diff --git a/chrome/android/chrome_public_apk_tmpl.gni b/chrome/android/chrome_public_apk_tmpl.gni index 6e3a2771fae7e2..a821df0dfa9eec 100644 --- a/chrome/android/chrome_public_apk_tmpl.gni +++ b/chrome/android/chrome_public_apk_tmpl.gni @@ -204,6 +204,9 @@ template("chrome_public_common_apk_or_module_tmpl") { # For bundles, only include resource strings files from our full # locale list, but nothing more. aapt_locale_whitelist = locales + + # zh_hk is supported in Android bundles. + support_zh_hk = false } } diff --git a/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd b/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd index d7e3dcebf4754e..29bcd544100839 100644 --- a/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd +++ b/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd @@ -79,6 +79,7 @@ + diff --git a/chrome/android/features/keyboard_accessory/internal/java/strings/android_keyboard_accessory_strings.grd b/chrome/android/features/keyboard_accessory/internal/java/strings/android_keyboard_accessory_strings.grd index 9f93d160e6a4ee..2e83b39b820142 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/strings/android_keyboard_accessory_strings.grd +++ b/chrome/android/features/keyboard_accessory/internal/java/strings/android_keyboard_accessory_strings.grd @@ -79,6 +79,7 @@ + diff --git a/chrome/android/features/media_router/java/strings/android_chrome_media_router_strings.grd b/chrome/android/features/media_router/java/strings/android_chrome_media_router_strings.grd index 068fef65dbcc21..1f246c4ccf739b 100644 --- a/chrome/android/features/media_router/java/strings/android_chrome_media_router_strings.grd +++ b/chrome/android/features/media_router/java/strings/android_chrome_media_router_strings.grd @@ -79,6 +79,7 @@ + diff --git a/chrome/android/features/start_surface/internal/java/strings/android_chrome_start_surface_strings.grd b/chrome/android/features/start_surface/internal/java/strings/android_chrome_start_surface_strings.grd index 2f60ecf7f3246c..ac07a9c3454284 100644 --- a/chrome/android/features/start_surface/internal/java/strings/android_chrome_start_surface_strings.grd +++ b/chrome/android/features/start_surface/internal/java/strings/android_chrome_start_surface_strings.grd @@ -79,6 +79,7 @@ + diff --git a/chrome/android/features/tab_ui/java/strings/android_chrome_tab_ui_strings.grd b/chrome/android/features/tab_ui/java/strings/android_chrome_tab_ui_strings.grd index d84dbe6d0cbf24..51c46984e37a19 100644 --- a/chrome/android/features/tab_ui/java/strings/android_chrome_tab_ui_strings.grd +++ b/chrome/android/features/tab_ui/java/strings/android_chrome_tab_ui_strings.grd @@ -79,6 +79,7 @@ + diff --git a/chrome/android/features/vr/java/strings/android_chrome_vr_strings.grd b/chrome/android/features/vr/java/strings/android_chrome_vr_strings.grd index 9c64837d07f2ca..07f8f8bc98c432 100644 --- a/chrome/android/features/vr/java/strings/android_chrome_vr_strings.grd +++ b/chrome/android/features/vr/java/strings/android_chrome_vr_strings.grd @@ -79,6 +79,7 @@ + diff --git a/chrome/android/webapk/strings/android_webapk_strings.grd b/chrome/android/webapk/strings/android_webapk_strings.grd index 1e69d960ad8d4f..97be784f36bc3f 100644 --- a/chrome/android/webapk/strings/android_webapk_strings.grd +++ b/chrome/android/webapk/strings/android_webapk_strings.grd @@ -78,6 +78,7 @@ + diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd index 0b1b278fd4c525..cac26b1dcc5610 100644 --- a/chrome/app/chromium_strings.grd +++ b/chrome/app/chromium_strings.grd @@ -34,6 +34,7 @@ If you update this file, be sure also to update google_chrome_strings.grd. --> + diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 5fe8566f71d124..e29422ea491880 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -39,6 +39,7 @@ are declared in tools/grit/grit_rule.gni. + @@ -178,6 +179,7 @@ are declared in tools/grit/grit_rule.gni. + diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd index 40e42a7605c1b3..61a6a3d524aaa3 100644 --- a/chrome/app/google_chrome_strings.grd +++ b/chrome/app/google_chrome_strings.grd @@ -36,6 +36,7 @@ chromium_strings.grd. --> + diff --git a/chrome/app/resources/locale_settings.grd b/chrome/app/resources/locale_settings.grd index 5c6c1bf8da6fb7..a988f9f1c2bc41 100644 --- a/chrome/app/resources/locale_settings.grd +++ b/chrome/app/resources/locale_settings.grd @@ -30,6 +30,7 @@ + diff --git a/chrome/app/resources/locale_settings_linux.grd b/chrome/app/resources/locale_settings_linux.grd index c02b58384e3d89..b9fb7e731cf6fd 100644 --- a/chrome/app/resources/locale_settings_linux.grd +++ b/chrome/app/resources/locale_settings_linux.grd @@ -30,6 +30,7 @@ + diff --git a/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings.grd b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings.grd index bb9ef9ee96bef1..2314678684ff93 100644 --- a/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings.grd +++ b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings.grd @@ -82,6 +82,7 @@ + diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index c7380d3cde1b74..0e6d89499a279b 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd @@ -109,6 +109,7 @@ CHAR-LIMIT guidelines: + diff --git a/chromecast/chromecast.gni b/chromecast/chromecast.gni index 1cf5f4d3ccde92..429cce78066ce2 100644 --- a/chromecast/chromecast.gni +++ b/chromecast/chromecast.gni @@ -160,7 +160,7 @@ cast_locales = locales # If Cast will also the android files update this and the Cast grd files. if (is_android) { # Subtract out additional Android locales - cast_locales -= android_only_chrome_locales - [ "zh-HK" ] + cast_locales -= android_only_chrome_locales } declare_args() { diff --git a/components/app_modal/android/app_modal_android_strings.grd b/components/app_modal/android/app_modal_android_strings.grd index f0a145e7af94d6..9c36e345d0aca3 100644 --- a/components/app_modal/android/app_modal_android_strings.grd +++ b/components/app_modal/android/app_modal_android_strings.grd @@ -80,6 +80,7 @@ + diff --git a/components/autofill/android/java/strings/autofill_strings.grd b/components/autofill/android/java/strings/autofill_strings.grd index 1c65758fa2c34a..81c315a38b1329 100644 --- a/components/autofill/android/java/strings/autofill_strings.grd +++ b/components/autofill/android/java/strings/autofill_strings.grd @@ -80,6 +80,7 @@ + diff --git a/components/browser_ui/strings/android/browser_ui_strings.grd b/components/browser_ui/strings/android/browser_ui_strings.grd index 320a8d529ade5a..83cfe5c1847041 100644 --- a/components/browser_ui/strings/android/browser_ui_strings.grd +++ b/components/browser_ui/strings/android/browser_ui_strings.grd @@ -80,6 +80,7 @@ + diff --git a/components/components_chromium_strings.grd b/components/components_chromium_strings.grd index b5d1b5ceaa5ab6..f0f81b72ed7506 100644 --- a/components/components_chromium_strings.grd +++ b/components/components_chromium_strings.grd @@ -32,6 +32,7 @@ + diff --git a/components/components_google_chrome_strings.grd b/components/components_google_chrome_strings.grd index 7ba36ff54143e5..42a7ae1f0a4c13 100644 --- a/components/components_google_chrome_strings.grd +++ b/components/components_google_chrome_strings.grd @@ -32,6 +32,7 @@ + diff --git a/components/components_locale_settings.grd b/components/components_locale_settings.grd index 7755f21c92724c..89cb92d8337553 100644 --- a/components/components_locale_settings.grd +++ b/components/components_locale_settings.grd @@ -30,6 +30,7 @@ + @@ -181,6 +182,7 @@ + diff --git a/components/components_strings.grd b/components/components_strings.grd index d0c3ce604abc95..7afdded9665511 100644 --- a/components/components_strings.grd +++ b/components/components_strings.grd @@ -32,6 +32,7 @@ + @@ -183,6 +184,7 @@ + diff --git a/components/embedder_support/android/java/strings/web_contents_delegate_android_strings.grd b/components/embedder_support/android/java/strings/web_contents_delegate_android_strings.grd index 2bb9fc9a449672..a8d57d897a576b 100644 --- a/components/embedder_support/android/java/strings/web_contents_delegate_android_strings.grd +++ b/components/embedder_support/android/java/strings/web_contents_delegate_android_strings.grd @@ -80,6 +80,7 @@ + diff --git a/components/omnibox/resources/omnibox_resources.grd b/components/omnibox/resources/omnibox_resources.grd index fdc106112d4129..23cade8f459067 100644 --- a/components/omnibox/resources/omnibox_resources.grd +++ b/components/omnibox/resources/omnibox_resources.grd @@ -34,6 +34,7 @@ + diff --git a/content/public/android/java/strings/android_content_strings.grd b/content/public/android/java/strings/android_content_strings.grd index 88fbfe8bf93944..b32f421fc3d560 100644 --- a/content/public/android/java/strings/android_content_strings.grd +++ b/content/public/android/java/strings/android_content_strings.grd @@ -78,6 +78,7 @@ + diff --git a/device/bluetooth/bluetooth_strings.grd b/device/bluetooth/bluetooth_strings.grd index b795cac0740549..c237ca85ff0f17 100644 --- a/device/bluetooth/bluetooth_strings.grd +++ b/device/bluetooth/bluetooth_strings.grd @@ -36,6 +36,7 @@ This file contains the strings for bluetooth. + diff --git a/device/fido/fido_strings.grd b/device/fido/fido_strings.grd index 672ef90eab50cb..b479fb4eb5c9c1 100644 --- a/device/fido/fido_strings.grd +++ b/device/fido/fido_strings.grd @@ -36,6 +36,7 @@ This file contains the strings for //device/fido. + diff --git a/services/services_strings.grd b/services/services_strings.grd index 645008df4681e7..a5f64b72a795da 100644 --- a/services/services_strings.grd +++ b/services/services_strings.grd @@ -36,6 +36,7 @@ This file contains strings for code in //services. + diff --git a/third_party/blink/public/strings/blink_strings.grd b/third_party/blink/public/strings/blink_strings.grd index f4b4ef35c025b3..0e80bcee47f3c4 100644 --- a/third_party/blink/public/strings/blink_strings.grd +++ b/third_party/blink/public/strings/blink_strings.grd @@ -72,6 +72,7 @@ below: + diff --git a/third_party/libaddressinput/chromium/address_input_strings.grd b/third_party/libaddressinput/chromium/address_input_strings.grd index 69a66cd64270bd..86d4a94f755033 100644 --- a/third_party/libaddressinput/chromium/address_input_strings.grd +++ b/third_party/libaddressinput/chromium/address_input_strings.grd @@ -49,6 +49,7 @@ third_party/libaddressinput/BUILD.gn. + diff --git a/ui/strings/app_locale_settings.grd b/ui/strings/app_locale_settings.grd index a62426e9ff1be5..c07b66b53afa98 100644 --- a/ui/strings/app_locale_settings.grd +++ b/ui/strings/app_locale_settings.grd @@ -30,6 +30,7 @@ + diff --git a/ui/strings/ui_strings.grd b/ui/strings/ui_strings.grd index 3e8001303add57..2ce4a260b34517 100644 --- a/ui/strings/ui_strings.grd +++ b/ui/strings/ui_strings.grd @@ -42,6 +42,7 @@ need to be translated for each locale.--> +