Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 3.33 KB

README.md

File metadata and controls

67 lines (48 loc) · 3.33 KB

Scripts

In this documents

Updating the Translations

Initial setup:

  • Please make sure you have done npm install.
  • Install Homebrew by ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Install and follow the instructions here: https://support.crowdin.com/cli-tool/#installation
  • Important: Please use version 3 of the crowdin cli-tool
  • Get Crowdin API Key and add this line to your .bash_profile: export CROWDIN_API_KEY='put API Key here'
    IMPORTANT! This key gives full access to all your Crowdin project data. Treat this just like a password and never push it to any public repo.

To update the translations:

  • Simply run ./scripts/update_translations.sh in root folder of project to do these tasks:
    (It is possible to confirm/skip each task by answering y/n to questions, only the first one is mandatory):
    • Check out and update the translations branch
    • Update master and merge into translations
    • Update the source file (messages.pot) and push it to Crowdin
    • Download translation files from Crowdin to src/translations and update javascript texts src/javascript/_autogenerated/[LangCode].js
    • Commit changes and push to origin
    • Open Github to submit the PR

Extracting texts from js code:

Texts that are used in js code will automatically be extracted during the translation update process (3rd step above: Updating the source file).

In order to make sure that no strings are missed by the extractor code while pushing to translations, please:

  1. Refactor the code so that the first argument passed to the localize() method is a string literal. i.e.

    const text = localize(is_started ? 'Sell at market' : 'Sell');

    would change to:

    const text = is_started ? localize('Sell at market') : localize('Sell');
  2. If there is no way to have the string literal in js code (i.e. API texts which are not translated), add them to scripts/js_texts/static_strings_app.js.

    Note: Regarding API texts, even if the string is translated automatically somewhere else we should still include it here to avoid missing it if that other string gets removed.

  3. At the end, when you're sure that a string has already been taken care of, just put this comment /* localize-ignore */ right after the first argument of localize() call to ignore it from tests.

js_texts folder contents:

js_texts:
    ├── extracted_strings_app.js
    └── static_strings_app.js
  • extracted_strings_app.js: Contains extracted strings. It's for debugging purposes only and shouldn't be changed manually.
  • static_strings_app.js to handle those strings that don't exist in js code. e.g. API texts that are not localised, etc.

During the translation update process, the source file messages.pot will be updated with all texts from both the above files.

Updating the Sitemap

  • The list of paths to include in sitemap.xml is here: config/sitemap_urls.js
  • Once the paths are updated in the above file, run ./scripts/sitemap.js or grunt shell:sitemap to generate new sitemap.xml files in src/root_files according to each section.