Changes between Version 1 and Version 7 of Ticket #2625


Ignore:
Timestamp:
06/15/2015 02:04:43 PM (4 years ago)
Author:
kzar
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2625

    • Property Cc sebastian added
    • Property Priority changed from Unknown to P2
    • Property Ready set
    • Property Summary changed from [cms] Add a way to upload master translation to Crowdin to [cms] Add Crowdin synchronisation script
  • Ticket #2625 – Description

    v1 v7  
    11=== Background === 
    2 Crowdin requires a master translation, English in our case. As the English strings are specified inline there are currently no files that could be uploaded to Crowdin directly. 
     2Our CMS used to power several of our websites has built in translation support. A default "master" language is chosen, [https://issues.adblockplus.org/ticket/2133 strings are written inline] inside pages in that language. Translations for other languages are stored in JSON files using the same structure as Crowdin and Chrome extensions use for translations. 
     3 
     4Updating these translation files manually is a lot of work so we are going to use [https://crowdin.com/ the online translation service called Crowdin] instead. To do this we need an automated way to synchronise page strings and translations with Crowdin. We need to be able to extract and upload the master strings from all the pages, upload any existing translations, and download any new translations from Crowdin. (More things need to happen in the background to facilitate these functions.) 
    35 
    46=== What to change === 
    5 Add a Python script `cms.bin.translate` that takes the source repository path and Crowind API key as parameters. 
     7Add a Python script `cms.bin.translate` that takes the source repository path and a Crowin API key as parameters. 
    68 
    7 For each page the script should combine inline strings and comments with any strings specified for the default locale, generate a JSON file and upload it to Crowdin using either [https://crowdin.com/page/api/add-file Add File] or [https://crowdin.com/page/api/update-file Update File] API. 
     9For each page the script should combine inline strings and comments with any strings specified for the default locale, generate a JSON file and upload it to Crowdin.  
    810 
     11For pages that already exist in the Crowdin project we need to use the Crowdin API's [https://crowdin.com/page/api/update-file update file] endpoint. 
     12 
     13For pages that don't already exist in the Crowdin project we will need to use the [https://crowdin.com/page/api/add-file add file] endpoint instead. For these pages we will also need to [https://crowdin.com/page/api/upload-translation upload any pre-existing translations] that we have locally to Crowdin. 
     14 
     15(Before updating or adding any files we need to ensure the required directories all exist in the Crowdin project, using the API. We will also need to ensure all required locales are enabled for the project.) 
     16 
     17After all page strings have been extracted and uploaded the script needs to [https://crowdin.com/page/api/export request a fresh export archive] of the translation files to be generated. Once that has been completed the archive [https://crowdin.com/page/api/download needs to be downloaded] and extracted locally, updating the translations, bringing everything in-sync with the Crowdin project. 
     18 
     19(Any old pages or directories that exist in the Crowdin project but not locally should be removed, along with any strings and translations. Any old locale files for removed pages should be cleared locally during the synchronisation process as well.) 
     20 
     21Notes: 
    922* We already have comparable functionality in [https://hg.adblockplus.org/buildtools/file/bdd544d595f2/localeTools.py#l330 buildtools]. 
    1023* The JSON files generated should of course be in the same format as all the other locale files. 
    1124* The default locale is specified by the `settings.ini` file in the repository path, inside the `general` section. (There's likely already code written to check the defaultlocale.) 
    1225* Crowdin project name should be added to `settings.ini` file. 
    13 * Consider dynamicly generated pages, such as subscription list and interface pages. Ensure that any dynamically generated, translatable strings are included in the generated JSON files. 
     26* Consider dynamically generated pages, such as subscription list and interface pages. Ensure that any dynamically generated, translatable strings are included in the generated JSON files. 
     27* The `cms.utils.get_page_params` functionality should be re-used to extract the page strings. We do not want to re-implement this logic.