Skip to main content
Version: 2.x.x

Pushing & pulling strings

Pushing and pulling strings from Tolgee is the most basic way to interact with strings. Similarly as with a Git project, it allows you to download strings from Tolgee to your computer (pull), or to upload them after you changed them (push).

Pulling strings

This is a useful command that exports strings from the platform, and saves them in a folder of your choice. You can use this to download strings from Tolgee before bundling your app for production.

tolgee pull [options]

Example usage:
tolgee pull --path ./i18n

Options:

  • --path <path> (short: -p) - Destination of a folder where translation files will be stored in
  • --languages <languages...> (short: -l) – List of languages to pull. Leave unspecified to export all languages.
  • --states <states...> (short: -s) – List of translation states to include. (choices: "UNTRANSLATED", "TRANSLATED", "REVIEWED"). Defaults to all except untranslated.
  • --delimiter [delimiter] (short: -d) – Structure delimiter to use. By default, Tolgee treats . as a nested structure delimiter, and formats its export accordingly. Set the option without a value to disable this behavior. Can be configured per-project.
  • --namespaces <namespaces...> (short: -n) - List of namespaces to pull. Defaults to all namespaces.
  • --tags <tags...> (short: -t) - List of tags which to include. Keys tagged by at least one of these tags will be included.
  • --exclude-tags <tags...> - List of tags which to exclude. Keys tagged by at least one of these tags will be excluded.
  • --support-arrays - Export keys with array syntax (e.g. item[0]) as arrays. (default: false)
  • --empty-dir - Empty target directory before inserting pulled files.
  • --file-structure-template <template> - Defines exported file structure

File structure template format

This is a template that defines the structure of the resulting .zip file content.

The template is a string that can contain the following placeholders: {namespace}, {languageTag}, {androidLanguageTag}, {snakeLanguageTag}, {extension}.

For example, when exporting to JSON with the template {namespace}/{languageTag}.{extension}, the English translations of the home namespace will be stored in home/en.json.

The {snakeLanguageTag} placeholder is the same as {languageTag} but in snake case. (e.g., en_US).

The Android specific {androidLanguageTag} placeholder is the same as {languageTag} but in Android format. (e.g., en-rUS)

Pushing strings

This command allows you to upload existing strings from your local folder to the platform.

tolgee push [options]

Example usage:
tolgee push --force-mode OVERRIDE
info

Push command requires push.files in config (which specifies which files to import).

Options:

  • --force-mode <mode> (short: -f) – What should we do with possible conflicts? Available modes: OVERRIDE, KEEP, NO_FORCE (abort on conflicts). Defaults to asking the user interactively (or NO_FORCE if it is not possible).
  • --override-key-descriptions - Override existing key descriptions from local files (only relevant for some formats).
  • --convert-placeholders-to-icu - Convert placeholders in local files to ICU format. (Default: true)
  • --languages <languages...> (short -l) - Specifies which languages should be pushed (see push.files in config).
  • --namespaces <namespaces...> (short -n) - Specifies which namespaces should be pushed (see push.files in config).
  • --tag-new-keys <tags...> - Specify tags that will be added to newly created keys.
  • --remove-other-keys - Remove keys which are not present in the import.
note

Currently, CLI does not let you delete keys that are not part of your local copy of the strings. In the near future, you'll be able to set a flag to tell the CLI you want to delete strings on the platform that aren't in your local copy.

See issue #18.