Changes between Version 6 and Version 9 of Ticket #104


Ignore:
Timestamp:
08/17/2017 12:00:06 PM (3 years ago)
Author:
trev
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #104

    • Property Tester changed from to Unknown
    • Property Cc sebastian wspee erick added
  • Ticket #104 – Description

    v6 v9  
    11=== Background === 
    2 Currently locale validation is being performed by test_locales.pl in the adblockplus repository in combination with LocaleTester.pm in buildtools repository. This still assumes the old way of specifying access keys, one we no longer use. 
     2Currently locale validation is being performed by test_locales.pl in the adblockplus repository in combination with LocaleTester.pm in buildtools repository. It only works for our legacy Firefox extension. 
    33 
    44=== What to change === 
    55There is little point updating this script, we rather need something in Python which would be integrated with the build tools: 
    66 
    7 * Add a new `build.py checktranslations` command. 
    8 * `metadata.*` file should have a section with the following parameters (all optional): 
    9   * Sets of strings that shouldn't have conflicting access keys 
    10   * Sets of strings that should have identical access keys 
    11   * List of locales where access keys don't have to be part of the string (e.g. Chinese, translations will often look like `Foo (&x)` because the label is Chinese whereas access keys are using Latin script). 
    12   * Whitelist of strings where translations identical to English shouldn't be flagged. 
    13   * List of strings with length restrictions. 
    14   * List of placeholders to look for (e.g. `?1?`). Chrome's variables (e.g. `Current time is $time$`) should be considered as placeholders automatically, these don't need to be configured. 
    15 * The command should load the locales using the mechanisms already in `localeTools.py`, this will already ensure that the file format is correct. 
    16 * It should then perform the following checks: 
    17   * If there is an access key in English (e.g. `&Subscription`), the translation should have an access key as well (e.g. `Filter&abonnement`). 
    18   * If there is no access key in English then there should be none in the translation. 
    19   * The access key should follow the configured rules. 
    20   * The translation (minus access keys) should obey to the length restrictions. 
    21   * The English and the translated string should have the same set of placeholders. 
     7* We need to expand the JSON format for translations to include `translationOptional` and `maxLength` keys. 
     8* Our custom translation keys should be removed when building or uploading to Crowdin. The `maxLength` field should be converted to "Note: this cannot be longer than N characters" description when uploading to Crowdin. 
     9* The new `build.py checktranslations` command should load the locales and perform the following checks: 
     10 * Make sure the JSON data is UTF-8-encoded and parses correctly 
     11 * Validate the structure of the JSON data. 
     12 * Make sure that all declared placeholders are present in all translations. 
     13 * Warn on untranslated strings, except for strings marked with `translationOptional` key or en-* locales. While this check is prone to false positives, it is also a warning sign allowing to detect bad translations. 
     14 * Warn for overlong translations if `maxLength` is set for a translation