File size: 2,679 Bytes
d086025
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Smartling CLI

A command-line tool for the [Smartling Translation API](https://developer.smartling.com/docs/list-of-smartling-apis).

## 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:

```yaml
# 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
```