Console Client (CLI)

New Crowdin CLI is coming

crowdin-cli is a command line tool that allows you to manage and synchronize your localization resources with your Crowdin project:

  • Automate the process of updating your source files in your Crowdin project
  • Download translations from Crowdin and automatically save them in the correct locations
  • Upload all your existing translations to Crowdin in minutes
  • Integrate Crowdin with GIT, SVN, Mercurial and more…

This is a cross-platform and it runs in a terminal on Linux based and macOS operating systems or in cmd.exe on Windows. It’s also open-source and it’s source code available at GitHub.

Installation

crowdin-cli can be installed via RubyGems or as a stand-alone Java application. There is also unofficial Python implementation which is available in Pip repository and as an .exe application for Windows.

Installing via RubyGems

In order to run crowdin-cli you will need Ruby and RubyGems installed on your computer. On macOS and Linux, Ruby is probably installed already. If not, you can use this reference to learn how to install them. On Windows machines you can use Ruby Installer.

When the Ruby is installed just type in console:

$ gem install crowdin-cli

Installing as a Java Application

We bundled crowdin-cli as a Java application to let you start using crowdin-cli easier. This method does not require installation. To get started:

  1. Download crowdin-cli.jar and save to your hard drive
  2. Check that you have Java 7 installed
  3. Add the crowdin-cli.jar file to your project directory

Use the following method to run the application:

$ java -jar crowdin-cli.jar help

This method works on both Windows and Unix machines.

Python Version

Important: The Python version of Crowdin CLI tool has been developed and is being supported by the community.

The tool is claimed to be compatible with official configuration file format. Crowdin CLI Python is also available for Windows as a native application.

Installation Instructions

Configuration

In general, you’ll use crowdin-cli as follows:

  1. Create a configuration file in your project root directory (we recommend you name it “crowdin.yaml”).
  2. Run crowdin-cli commands:
$ crowdin-cli cool_action

By default, crowdin-cli will look for a configuration file called crowdin.yaml. The cool_action indicates which command to execute. You can use crowdin-cli help to see all the available commands.

When calling crowdin-cli in terminal you should be in your project root directory. Otherwise, you will have to specify configuration file path using the -c (or –config) option. See crowdin-cli help for more details.

Sample configuration file:

project_identifier: your-project-identifier
api_key: 54e01e81--your-api-key--f6a2724a                          #can be found in your project settings page
base_path: /home/office/source-code

files:
  -
    source: '/_locales/en/*.json'                                    #source files filter
    translation: '/_locales/%two_letters_code%/%original_file_name%' #where translations live

  -
    source: '/locale/en/**/*.po'
    translation: '/locale/%two_letters_code%/LC_MESSAGES/%original_file_name%'

For more information on how to configure crowdin-cli, check the Configuration File article.

Usage

Once the configuration file is created, you are ready to start using crowdin-cli to manage your localization resources and automate file synchronization.

Upload your source files to Crowdin:

$ crowdin-cli upload sources

Upload existing translations to Crowdin project (translations will be synchronized):

$ crowdin-cli upload translations

Download latest translations from Crowdin:

$ crowdin-cli download

Get help on upload command:

$ crowdin-cli help upload

Get help on upload sources command:

$ crowdin-cli help upload sources

Versions Management

There is no need to run specific command to create version branches if synchronization tool is used. The version branch would be created automatically while files uploading.

Source files upload to the specified version branch:

$ crowdin-cli upload sources -b {branch_name}

Translations upload to the specified version branch:

$ crowdin-cli upload translations -b {branch_name}

Translations download of the specified version branch:

$ crowdin-cli download -b {branch_name}

See Also

Crowdin CLI is a command line tool that allows you to manage and synchronize your localization resources with your Crowdin project:

  • Automate the process of updating your source files in your Crowdin project
  • Download translations from Crowdin and automatically save them in the correct locations
  • Upload all your existing translations to Crowdin in minutes
  • Integrate Crowdin with GIT, SVN, Mercurial and more…

This is a cross-platform and it runs in a terminal on Linux based and macOS operating systems or in Command Prompt on Windows.

What's New

  • New type of YAML configuration
  • Validation of a configuration file with the help of lint command
  • Generation of a configuration file with the help of generate command
  • Improved process of files upload
  • Possibility to work with a single file without a configuration
  • --dryrun option to preview the list of managed files

Installation

Crowdin CLI can be installed as a stand-alone Java application.

Verifying Your Java Version

Check that you have Java 7 or newer installed. Type java -version command in the terminal (Command Prompt on Windows) to check Java version. For example, java version “1.7.0_55” means that you have Java 7 Update 55 installed.

If you don’t have Java installed, download it from Oracle’s website.

Installation on Linux and macOS

  1. Download crowdin-cli.zip using the button above
  2. Unpack it
  3. Run . crowdin.sh in the terminal with sudo rights in order to add crowdin command to your terminal

Installation on Windows

  1. Download crowdin-cli.zip using the button above
  2. Extract it's content to the place where you want Crowdin CLI to be stored
  3. Open Command Prompt as an Administrator
    1. Click Start
    2. In the Start Search box, type cmd, and then press CTRL+SHIFT+ENTER
    3. If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue
  4. Run setup-crowdin.bat script in order to add crowdin command to the Command Promt

Running the App

Use the following method to run the app:

$ crowdin

Alternative method:

$ java -jar crowdin-cli.jar

Configuration

To use Crowdin CLI you need to have a configuration file. We recommend to name it crowdin.yaml. You can create it running the command:

$ crowdin generate

When calling Crowdin CLI in terminal you should be in your project root directory. Otherwise, you will have to specify a configuration file path using the --config option:

$ crowdin upload sources --config /path/to/your/config/file

Run crowdin help to get more details regarding other commands.

Sample configuration file:

"project_identifier" : "your-project-identifier"
"api_key" : "your-api-key"
"base_path" : "your-base-path"

"preserve_hierarchy": true

"files": [
  {
    "source" : "/t1/**/*",
    "translation" : "/%two_letters_code%/%original_file_name%"
  }
]

For more information how to configure Crowdin CLI, check the Configuration File article.

Usage

Once the configuration file is created, you are ready to start using Crowdin CLI to manage your localization resources and automate file synchronization.

General Commands

To display help information:

$ crowdin help

To generate a skeleton configuration file:

$ crowdin generate

To check configuration file for general mistakes:

$ crowdin lint

To display a list of uploaded files to Crowdin:

$ crowdin list project

Uploading Resources

To upload source files to Crowdin:

$ crowdin upload sources

To upload a single file without configuration:

$ crowdin upload sources -s path/to/your/file -t file/export/pattern -k your-key -i your-identifier

Use placeholders to put appropriate variables.

To display a list of files that will be uploaded to Crowdin:

$ crowdin upload sources --dryrun

To upload existing translations to Crowdin (translations will be synchronized):

$ crowdin upload translations

To show a detailed information about the upload command:

$ crowdin upload --help

Downloading Translations

To download latest translations from Crowdin:

$ crowdin download

To download latest translations for the specific langauge (language codes):

$ crowdin download -l {language_code}

To display a list of latest translations from Crowdin:

$ crowdin download --dryrun

To show a detailed information about the download command:

$ crowdin download --help

Versions Management

There is no need to run a specific command to create version branches if synchronization tool is used. The version branch will be created automatically during the files upload.

To upload source files to the specified version branch:

$ crowdin upload sources -b {branch_name}

To upload translations to the specified version branch:

$ crowdin upload translations -b {branch_name}

To download translations from the specified version branch:

$ crowdin download -b {branch_name}