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}
1 file changed