@cadolabs/crowdin-cli

3.0.19 • Public • Published

crowdin-cli-tool Supporting release

Crowdin CLI optimized for work with branches

Supported by Cado Labs


NPM

Requirements

  • Node 12+

CLI description

  • source - root language setuped in crowdin
  • targetLanguage - all languages setuped in crowdin for project

Example workflow

  1. Add keys and translations in source file
  2. Upload only added in new crowdin branch crowdin push-diff -b new-branch
  3. Wait for translators work
  4. Download and merge it crowdin pull-diff -b new-branch

Installation

npm i @cadolabs/crowdin-cli or yarn add @cadolabs/crowdin-cli

Can be installed global (run as crowdin) or in project dependencies (run npx crowdin or yarn crowdin from project) (Recomended).

For check installation run crowdin -v

Setup

Write token in .crowdin file.

File will be created in command run directory

crowin init --token <crowdin_token>

Where <crowdin_token> - api token generated in crowdin profile with access all checkbox

Add .crowdin in .gitignore

commands

init - Save token in .crowdin file

lint - Check translations syntax

push-diff - Upload translations diff (Throw error in master branch)

pull-diff - Download translations diff (Throw error in master branch)

upload-source - Upload only source file

upload-translations - DEPRECATED. Upload only translations (Throw error if source not uploaded).

upload or push - UDEPRECATED. pload source and then translations (runs upload-source and upload-translations)

download or pull - DDEPRECATED. ownload all translations

task - Create task in crowdin

clean - Remove branch in crowdin

sync - DEPRECATED. Upload source, translations, and download all from crowdin

Params

-v or --version - Show CLI version

-h or --help - Show help

-b or --branch - Crowdin branch

-c or --config - Path to config file

-l or --languages - Comma separetd language list (all by default). Ex. crowdin upload -l "ru, en, fr"

--silent - Show logs line by line, without animations

--token - Generated in crowdin api-token

--organization - Organization name in crowdin enterprise

--fix - Fix errors with lint command. ATTENTION! This delete crowdin branch too!

--diff-with - With push or push-diff create diff with coomit/tag/etc.

--project-id - Crowdin project ID

--base-dir - Look at 'Config'

--path - Look at 'Config'

--use-git-branch-as-default - Look at 'Config'

--import-eq-suggestions - Defines whether to add translation if it's the same as the source string

--auto-approve-imported - Mark uploaded translations as approved

--skip-untranslated-strings - Defines whether to export only translated strings

--skip-format-step - Deprecated. Skip format step after download translations

--contributors - Comma separated user id list to assign new tasks

Config

Some params can be represent in config.

Place file .crowdin-config.json in project directory.

.crowdin-config.json file contents:

{
  "token": string, // api token generated in crowdin profile. Strongly non recommend to place it project config
  "organization": string, // Organization name in crowdin enterprise
  "projectId": string, // Crowdin project ID
  "baseDir": string, // Path to translations/directories to upload in crowdin.
  // Relative to config file or absolute
  // Children directory structure will be saved in crowdin.
  "path": string, // Path to files relative to 'baseDir'
  // Glob syntax allowed
  // File name require on of theese variables: %{id/name/editorCode/twoLettersCode/threeLettersCode/locale/androidCode/osxLocale}!
  // Example: './config/**/locale_prefex.%{twoLettersCode}.yml'
  // For files 'config/dir1/locale_prefex.en.yml' and 'config/dir1/locale_prefex.ru.yml'
  "useGitBranchAsDefault": boolean, // Use git branch by default
  // Blocks uploading to master branch
  // Ignored with param '-b' or '--branch
  "importEqSuggestions": boolean, // Defines whether to add translation if it's the same as the source string
  "autoApproveImported": boolean, // Mark uploaded translations as approved
  "skipUntranslatedStrings": boolean, // Defines whether to export only translated strings
  "contributors": string[], // Comma separated user id list to assign new tasks
  "translateHidden": boolean, // Allow translations upload to hidden source strings
  "skipAssignedStrings": boolean, // Skip strings already included in other tasks
  "exportWithMinApprovalsCount": number, // Defines whether to export only approved strings
  "skipFormatStep": boolean, // Deprecated. Skip format step after download translations
}

Links

Contributing

Contributing Rules | Code of Conduct

License

Released under MIT License.

Supporting

Supported by Cado Labs

Authors

Jenya Gul

Readme

Keywords

none

Package Sidebar

Install

npm i @cadolabs/crowdin-cli

Weekly Downloads

184

Version

3.0.19

License

ISC

Unpacked Size

45.1 kB

Total Files

44

Last publish

Collaborators

  • cadolabs