New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 882860 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Last visit > 30 days ago
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug

Blocked on:
issue 879228
issue 889912



Sign in to add a comment

Android: store all supported locales in app bundles with language-based splits

Project Member Reported by digit@google.com, Sep 11

Issue description

Currently, Android APKs and app bundles do not store the resources and pak files related to the 9 locales listed in the |android_chrome_omitted_locales| GN configuration variable [1]. This was done originally to reduce the size of the generated APKs.

However, app bundles support language-based splits, which optimize the installation size of the bundle to the locales selected on the user's device. This should allow us to store all Chrome-supported locales in a such a bundle, as long as |enable_language_splits = true| is set when declaring the bundle target(s).

Of course, this requires proper translations for all UI strings used on Android, something that isn't available yet (see http://crbug.com/879228)

[1] https://cs.chromium.org/chromium/src/build/config/locales.gni?type=cs&q=android_chrome_omitted_locales&sq=package:chromium&g=0&l=8

 
Cc: js...@chromium.org
Components: UI>Localization
> this requires proper translations for all UI strings used on Android, something that isn't available yet

As I wrote in bug 879228, TC does have those strings translated into not just 9 disabled languages (Kannada, Tamil, Marathi, etc) but also other languages (to which even Chrome desktop is not localized yet).  My understanding is that a few years ago, Chrome LPM decided to start translating messages to the expanded list of languages in anticipation of "soon upcoming" locale expansion. Unfortunately, that 'soon' has become many months/years. 

Anyway, there's something wrong with string import from TC/google3 to Chromium tree. That issue has to be resolved. 

BTW, I'm very happy that Android locale list will be finally expanded (hopefully to match at least the list of locales supported by the latest Android OS, Q). 
Blockedon: 889912
Components: -UI>Localization UI>Browser
Project Member

Comment 5 by bugdroid1@chromium.org, Oct 19

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/70b843c9e6284b1a95c964a81efbb4f2a67ee89d

commit 70b843c9e6284b1a95c964a81efbb4f2a67ee89d
Author: David 'Digit' Turner <digit@google.com>
Date: Fri Oct 19 16:31:39 2018

build: Add android_debug_resources_temp_dir

Normally, compiling Android resources requires unpacking
and processing resource dependencies into a temporary
directory before sending the result to 'aapt2 compile',
then getting rid of these intermediate files.

To help debug issues related to Android resource compilation,
this CL introduces a new GN variable that can be set in your
args.gn, to force the build to put all such build directories
under a top-level directory, and not removing intermediate
files in it.

This should allow inspecting the intermediate files to better
understand what's going on.

This is needed to debug issues that appeared in my attempt
to change the resources stored in APKs versus bundles, e.g.:
https://chromium-review.googlesource.com/c/chromium/src/+/1270947

BUG=879228,882860,897056
R=agrieve@chromium.org, estevenson@chromium.org,yfriedman@chromium.org

Change-Id: I76c79a893b0bbdb56ba685f4304da929d11c7e05
Reviewed-on: https://chromium-review.googlesource.com/c/1288436
Reviewed-by: agrieve <agrieve@chromium.org>
Commit-Queue: David Turner <digit@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601178}
[modify] https://crrev.com/70b843c9e6284b1a95c964a81efbb4f2a67ee89d/build/android/gyp/compile_resources.py
[modify] https://crrev.com/70b843c9e6284b1a95c964a81efbb4f2a67ee89d/build/android/gyp/util/resource_utils.py

Project Member

Comment 6 by bugdroid1@chromium.org, Oct 25

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bed2fe29f5758e6958d312b96dbc3edd9cafeb47

commit bed2fe29f5758e6958d312b96dbc3edd9cafeb47
Author: David 'Digit' Turner <digit@google.com>
Date: Thu Oct 25 16:01:58 2018

android: Add missing translations in grit input files.

This is a preparatory CL to allow importing missing Android
specific translations for the following 9 locales:

  bn: Bengali
  et: Estonian
  gu: Gujarati
  kn: Kannada
  ml: Malaylam
  mr: Marathi
  ms: Malay
  ta: Tamil
  te: Tegulu

Its purpose is to:

- Add fake missing .xtb translation files, populated by copying
  the content of the en-GB version and updating the locale
  tag inside the copies. See below for the source of the small
  Python script that was used to do that.

- Update the .grd files so they associate with the new .xtb
  files, but do *not* output corresponding Android resource
  .xml files.

  This ensures that the Android build is left untouched and
  doesn't include said fake translations into its final binaries
  (APKs and App Bundles).

- Update the translation_expectations.pyl configuration file
  that drives the import script, moving all .grd files to the
  single "desktop_grds" group. This ensures that all these
  .grd will get additional translations as well whenever
  Chrome supports more locales in the future.

After submitting this CL, it should be possible to run the
locale import process to update the content of the .xtb files
properly.

Then, another CL will modify the build rules to
generate Android resource .xml files for the new translations
and integrate them into the Android build.

BUG=882860,879228
R=govind@chromium.org,jshin@chromium.org,abdulsyed@chromium.org

For the record, the Python script used to create the fake .xtb copies:
--------------------- cut here ---------------------------
import os
import re
import shutil

SRC_LOCALE = 'en-GB'
DST_LOCALES = [ 'bn', 'et', 'gu', 'kn', 'ml', 'mr', 'ms', 'ta', 'te' ]
GRD_INPUTS = [
  'android_webview/java/strings/android_webview_strings.grd',
  'chrome/android/java/strings/android_chrome_strings.grd',
  'chrome/android/webapk/strings/android_webapk_strings.grd',
  'components/autofill/android/java/strings/autofill_strings.grd',
  'components/embedder_support/android/java/strings/web_contents_delegate_android_strings.grd',
  'content/public/android/java/strings/android_content_strings.grd',
  'ui/android/java/strings/android_ui_strings.grd',
]

RE_TRANSLATIONBUNDLE = re.compile('<translationbundle lang="(.*)">')

def _GrdToXtb(grd_path, translation_locale):
  """Convert a .grd input path into the equivalent translation .xtb file.

  Args:
    grd_path: Input .grd file path.
    translation_locale: Chromium locale name (e.g. 'bn')
  Returns:
    Path of the corresponding .xtb translation path.
  """
  grd_base = os.path.basename(grd_path)
  return os.path.join(os.path.dirname(grd_path), 'translations',
                      '%s_%s.xtb' % (grd_base[:-4], translation_locale))

for grd_path in GRD_INPUTS:
  src_file = _GrdToXtb(grd_path, SRC_LOCALE)
  with open(src_file) as f:
    src_data = f.read()

  m = RE_TRANSLATIONBUNDLE.search(src_data)
  assert m is not None

  for locale in DST_LOCALES:
    dst_file = _GrdToXtb(grd_path, locale)
    dst_data = src_data[:m.start(1)] + locale + src_data[m.end(1):]
    with open(dst_file, "wt") as f:
      f.write(dst_data)
------------------------ cut here --------------------------

Change-Id: I886d81d21826a36d1261a16052c3e3ca1561c7d2
Reviewed-on: https://chromium-review.googlesource.com/c/1297364
Reviewed-by: agrieve <agrieve@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Krishna Govind <govind@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Commit-Queue: David Turner <digit@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602725}
[modify] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/android_webview/java/strings/android_webview_strings.grd
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/android_webview/java/strings/translations/android_webview_strings_bn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/android_webview/java/strings/translations/android_webview_strings_et.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/android_webview/java/strings/translations/android_webview_strings_gu.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/android_webview/java/strings/translations/android_webview_strings_kn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/android_webview/java/strings/translations/android_webview_strings_ml.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/android_webview/java/strings/translations/android_webview_strings_mr.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/android_webview/java/strings/translations/android_webview_strings_ms.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/android_webview/java/strings/translations/android_webview_strings_ta.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/android_webview/java/strings/translations/android_webview_strings_te.xtb
[modify] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/java/strings/android_chrome_strings.grd
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/java/strings/translations/android_chrome_strings_bn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/java/strings/translations/android_chrome_strings_et.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/java/strings/translations/android_chrome_strings_gu.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/java/strings/translations/android_chrome_strings_kn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/java/strings/translations/android_chrome_strings_ml.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/java/strings/translations/android_chrome_strings_mr.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/java/strings/translations/android_chrome_strings_ms.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/java/strings/translations/android_chrome_strings_ta.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/java/strings/translations/android_chrome_strings_te.xtb
[modify] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/webapk/strings/android_webapk_strings.grd
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/webapk/strings/translations/android_webapk_strings_bn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/webapk/strings/translations/android_webapk_strings_et.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/webapk/strings/translations/android_webapk_strings_gu.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/webapk/strings/translations/android_webapk_strings_kn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/webapk/strings/translations/android_webapk_strings_ml.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/webapk/strings/translations/android_webapk_strings_mr.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/webapk/strings/translations/android_webapk_strings_ms.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/webapk/strings/translations/android_webapk_strings_ta.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/chrome/android/webapk/strings/translations/android_webapk_strings_te.xtb
[modify] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/autofill/android/java/strings/autofill_strings.grd
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/autofill/android/java/strings/translations/autofill_strings_bn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/autofill/android/java/strings/translations/autofill_strings_et.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/autofill/android/java/strings/translations/autofill_strings_gu.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/autofill/android/java/strings/translations/autofill_strings_kn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/autofill/android/java/strings/translations/autofill_strings_ml.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/autofill/android/java/strings/translations/autofill_strings_mr.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/autofill/android/java/strings/translations/autofill_strings_ms.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/autofill/android/java/strings/translations/autofill_strings_ta.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/autofill/android/java/strings/translations/autofill_strings_te.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/embedder_support/android/java/strings/translations/web_contents_delegate_android_strings_bn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/embedder_support/android/java/strings/translations/web_contents_delegate_android_strings_et.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/embedder_support/android/java/strings/translations/web_contents_delegate_android_strings_gu.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/embedder_support/android/java/strings/translations/web_contents_delegate_android_strings_kn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/embedder_support/android/java/strings/translations/web_contents_delegate_android_strings_ml.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/embedder_support/android/java/strings/translations/web_contents_delegate_android_strings_mr.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/embedder_support/android/java/strings/translations/web_contents_delegate_android_strings_ms.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/embedder_support/android/java/strings/translations/web_contents_delegate_android_strings_ta.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/embedder_support/android/java/strings/translations/web_contents_delegate_android_strings_te.xtb
[modify] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/components/embedder_support/android/java/strings/web_contents_delegate_android_strings.grd
[modify] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/content/public/android/java/strings/android_content_strings.grd
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/content/public/android/java/strings/translations/android_content_strings_bn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/content/public/android/java/strings/translations/android_content_strings_et.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/content/public/android/java/strings/translations/android_content_strings_gu.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/content/public/android/java/strings/translations/android_content_strings_kn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/content/public/android/java/strings/translations/android_content_strings_ml.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/content/public/android/java/strings/translations/android_content_strings_mr.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/content/public/android/java/strings/translations/android_content_strings_ms.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/content/public/android/java/strings/translations/android_content_strings_ta.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/content/public/android/java/strings/translations/android_content_strings_te.xtb
[modify] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/tools/gritsettings/translation_expectations.pyl
[modify] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/ui/android/java/strings/android_ui_strings.grd
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/ui/android/java/strings/translations/android_ui_strings_bn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/ui/android/java/strings/translations/android_ui_strings_et.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/ui/android/java/strings/translations/android_ui_strings_gu.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/ui/android/java/strings/translations/android_ui_strings_kn.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/ui/android/java/strings/translations/android_ui_strings_ml.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/ui/android/java/strings/translations/android_ui_strings_mr.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/ui/android/java/strings/translations/android_ui_strings_ms.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/ui/android/java/strings/translations/android_ui_strings_ta.xtb
[add] https://crrev.com/bed2fe29f5758e6958d312b96dbc3edd9cafeb47/ui/android/java/strings/translations/android_ui_strings_te.xtb

Project Member

Comment 7 by bugdroid1@chromium.org, Jan 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f8119b9be8440b231a19c0b4019310cfa8065433

commit f8119b9be8440b231a19c0b4019310cfa8065433
Author: David 'Digit' Turner <digit@google.com>
Date: Wed Jan 09 15:41:09 2019

android: Add check_android_grit_strings.py

This CL adds a new script that can be used to check, and
potentially fix, the list of Android localized string resource
files that are provided in GRIT input files (.grd) and BUILD.gn
files. In particular, it checks that:

- Android localized string resource .xml files are generated by GRIT for all
  supported Chrome locales. These corresponds to <output> elements that
  use the type="android" attribute.

- That the output lists in BUILD.gn files also list resources for all
  supported Chrome locales.

The --scan-dir <dir> option can be used to check for all files under a specific
directory, and the --fix-inplace option can be used to try fixing any file
that doesn't pass the check.

This can be very handy to avoid tedious and repetitive work when adding new
translations / locales to the Chrome code base, since this script can update
said input files for you.

Important note: checks and fix may fail on some input files. For example
remoting/resources/remoting_strings.grd contains an in-line comment element
inside its <outputs> section that breaks the script. The check will fail, and
trying to fix it too, but at least the file will not be modified.

This will be used in a later CL that adds the result of running:

  build/android/check_android_grit_strings.py --scan-dir . --fix-inplace

Plus other necessary adjustments.

R=agrieve@chromium.org,estevenson@chromium.org,yfriedman@chromium.org,torne@chromium.org
BUG=882860

Change-Id: I04eb31072abd075f44763e16d871ada1d4c32277
Reviewed-on: https://chromium-review.googlesource.com/c/1402879
Commit-Queue: David Turner <digit@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#621154}
[add] https://crrev.com/f8119b9be8440b231a19c0b4019310cfa8065433/build/android/check_android_grit_strings.py

Sign in to add a comment