From c68e8e1b2e6366b285e3209b4e2635867f365103 Mon Sep 17 00:00:00 2001 From: Axel Hecht Date: Thu, 18 Oct 2018 15:36:54 +0200 Subject: [PATCH] Add l10n.toml for l10n testing with compare-locales, and automation to run it. On PRs, this just runs validation after the unit tests. On master, this triggers another task in the graph w/out dependencies, either in nor out. We might want to replace check_translations.py eventually, but not yet. --- .taskcluster.yml | 2 + l10n.toml | 106 +++++++++++++++++++++ tools/taskcluster/schedule-master-build.py | 12 +++ 3 files changed, 120 insertions(+) create mode 100644 l10n.toml diff --git a/.taskcluster.yml b/.taskcluster.yml index 99bb7d99f9b..c70e4678c1a 100644 --- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -32,6 +32,8 @@ tasks: && echo "--" > .adjust_token && python tools/l10n/check_locales.py && ./gradlew --no-daemon clean assembleFocusX86Debug assembleKlarX86Nightly assembleRelease detektCheck ktlint lintFocusX86Debug lintKlarX86Nightly pmd checkstyle spotbugs assembleFocusX86DebugAndroidTest testFocusX86DebugUnitTest testKlarX86NightlyUnitTest + && pip install compare-locales>=4.0.1,<5.0 + && compare-locales --validate l10n.toml . artifacts: public: type: directory diff --git a/l10n.toml b/l10n.toml new file mode 100644 index 00000000000..daa31ffba2d --- /dev/null +++ b/l10n.toml @@ -0,0 +1,106 @@ + +basepath = "." + +locales = [ + "ace", + "af", + "am", + "an", + "anp", + "ar", + "ast", + "ay", + "az", + "bg", + "bn-BD", + "bn-IN", + "bo", + "bs", + "ca", + "cak", + "cs", + "cy", + "da", + "de", + "dsb", + "el", + "en-CA", + "eo", + "es-AR", + "es-CL", + "es-ES", + "es-MX", + "eu", + "fa", + "fi", + "fr", + "fy-NL", + "ga-IE", + "gl", + "gu-IN", + "he", + "hi-IN", + "hr", + "hsb", + "hu", + "hus", + "hy-AM", + "ia", + "id", + "it", + "ixl", + "ja", + "jv", + "ka", + "kab", + "kk", + "ko", + "kw", + "lo", + "lt", + "meh", + "mix", + "mr", + "ms", + "my", + "nb-NO", + "ne-NP", + "nl", + "nn-NO", + "oc", + "pa-IN", + "pai", + "pl", + "ppl", + "pt-BR", + "quc", + "quy", + "ro", + "ru", + "sk", + "sl", + "sq", + "sr", + "su", + "sv-SE", + "ta", + "te", + "th", + "tr", + "trs", + "tsz", + "tt", + "uk", + "ur", + "vi", + "wo", + "yua", + "zam", + "zh-CN", + "zh-TW", + ] +[env] + +[[paths]] + reference = "app/src/main/res/values/strings.xml" + l10n = "{l10n_base}/app/src/main/res/values-{android_locale}/strings.xml" diff --git a/tools/taskcluster/schedule-master-build.py b/tools/taskcluster/schedule-master-build.py index 8194ca2d082..b49882e0d23 100644 --- a/tools/taskcluster/schedule-master-build.py +++ b/tools/taskcluster/schedule-master-build.py @@ -48,6 +48,15 @@ def generate_code_quality_task(buildTaskId): dependencies = [ buildTaskId ]) +def generate_compare_locales_task(): + return taskcluster.slugId(), generate_task( + name = "(Focus for Android) String validation", + description = "Check Focus/Klar for Android for errors in en-US and l10n.", + command = ('pip install compare-locales>=4.0.1,<5.0' + ' && compare-locales --validate l10n.toml .' + ' && compare-locales l10n.toml .')) + + def generate_webview_X86_ui_test_task(dependencies): return taskcluster.slugId(), generate_task( name = "(Focus for Android) UI tests - Webview X86", @@ -189,6 +198,9 @@ def generate_task(name, description, command, dependencies = [], artifacts = {}, codeQualityTaskId, codeQualityTask = generate_code_quality_task(buildTaskId) schedule_task(queue, codeQualityTaskId, codeQualityTask) + clTaskId, clTask = generate_compare_locales_task() + schedule_task(queue, clTaskId, clTask) + uiWebviewARMTestTaskId, uiWebviewARMTestTask = generate_webview_ARM_ui_test_task([unitTestTaskId, codeQualityTaskId]) schedule_task(queue, uiWebviewARMTestTaskId, uiWebviewARMTestTask)