Crowdin

Crowdin is a localization and translation management platform. CMintS uses it because of it's user friendly UI, ability to provide external collaborators with user friendly enviroment for translation and most importantly because it's free for Open Source projects.

Setting up

First of all in order to be able to use Crowdin you should create an account. If you are developing an open source project you can request Open Source setup. Otherwise you will have a trial period to try it out. After you have your account ready, it's time to create a project.

After the project is ready, you need to add Crowdin project ID to i18n options in the config.js file. Ensure that you also have defaultLocale set there as well:

const i18nOptions = {
  defaultLocale: "en",
  crowdin: {
    id: "cmints-website"
  }
};

module.exports = {i18nOptions};

Uploading Source Strings

After setting up the project you can use CMintS API to upload all the source translation strings of your website to the Crowdin project, to do that first locate your Crowdin project API key from the settings page:

Crowdin api location

After locating Crowdin API key, run command below from the website root directory:

# Replace {crowdin-key} with the actual one
cmints --crowdin update-sources --key {crowdin-key}

This will generate source JSON files and upload them to the Crowdin project.

Download translations

After translations are ready in the Crowdin to be downloaded and the translation project has been built, run the command below from the website root directory:

# Replace {crowdin-key} with the actual one
cmints --crowdin get-translations --key {crowdin-key}

Note: in order to update correct locales, the directory names inside of the locales directory should be consistent with the Crowdin translation locale names.

Upload translations

Use command below to update Crowdin project with the local translations:

# Replace {crowdin-key} with the actual one
cmints --crowdin update-translations --key {crowdin-key}

Using environment variables

If the environment variables CROWDIN_KEY is set, no need to pass the --key argument so you can invoke translation as shown below:

cmints --crowdin update-sources
cmints --crowdin get-translations
cmints --crowdin update-translations