Conghao97's picture tcftrees's picture
ProgramGen release
d086025
|
Raw History Blame Contribute Delete
2.68 kB

Smartling CLI

A command-line tool for the Smartling Translation API.

Installing

Download the binary from the releases page, or run it as a Docker container:

docker run --rm -v MyProject:/work 99designs/smartling ls

Usage

Top-level commands:

COMMANDS:
   ls           list remote files
   stat         display the translation status of a remote file
   get          downloads a remote file
   put          uploads a local file
   rename       renames a remote file
   rm           removes a remote file
   lastmodified shows when a remote file was modified last
   locales      list the locales for the project
   project      manage local project files

The smartling project command

The project subcommands target common dev/CI use-cases:

COMMANDS:
   files  lists the local files
   status show the status of the project's remote files
   pull   translate local project files using Smartling as a translation memory
   push   upload local project files that contain untranslated strings
  • push uploads files to a Smartling project using a prefix. By default the prefix is the git branch name; an explicit prefix can be given as an argument. A hash is included in the prefix to prevent clobbering.
  • pull translates local project files using Smartling as a translation memory.

Other features:

  • downloaded translation files are cached (default: 4 hours) in ~/.smartling/cache
  • operations mostly happen concurrently
  • filetypes are detected automatically

Configuration file

The CLI uses a project-level config file named smartling.yml.

Example:

# Required config
api_key: "aaaaaabbbbbbbbcccccddddddd"                       # Smartling API Token Secret token
user_id: "a1b2c3d4e5f6"                                     # Smartling User Identifier
project_id: "666666666"                                     # Smartling Project Id
files:                                                      # Files in the project
  - translations/*.xlf                                      # Globbing can be used,
  - foo/bar.xlf                                             # as well as individual files

# Optional config
cache_max_age: "4h"                                         # How long to cache translated files for
file_type: "xliff"                                          # Override the detected file type
parser_config:                                              # Add a custom configuration
  placeholder_format_custom: "%[^%]+%"
pull_file_path: "{{ TrimSuffix .Path .Ext }}.{{.Locale}}{{.Ext}}" # Naming scheme when pulling files