⌨
CLI / Command-line interface
Transiyzi CLI lets you upload or download translations directly to your app, integrating with your build chain or CI/CD process.
npm install -g @transiyzi/transiyzi-cli
Run transiyzi --help from the terminal to see the list of commands and subcommands. Run transiyzi command --help to see the help page.
It is used to create the transiyzi.json file that holds your project settings.
transiyzi.json
1
{
2
"access_token": "",
3
"project_id": "",
4
"base_path": "./resources/lang",
5
"upload": {
6
"locales": []
7
},
8
"download": {
9
"default_format": "JSON",
10
"include_unreviewed_translations": false,
11
"aliases": {}
12
}
13
}
- access_token can be generated from the "Access Tokens" section in your profile settings.
- After the init command, enter the access token and select from the list of authorized projects.
- The default_format selects the format for exporting non-file-specific keys during download from the given list.
- The base_path is the main directory where the language files are located, starting from the directory where the transiyzi.json file is located. For example: "./resources/lang".
- NOTE: The path should not start from the OS root.
- Incorrect usage: "/resources/lang".
It reads the definitions in the upload key of the transiyzi.json file and performs an upload.
- The path written represents the structure after the base_path parameter.
- The locales must match a language that exists in the project. When defining them, it is important to pay attention to the ISO code selected for the project, i.e., en !== en-US.
- If the project can access files through a single structure, it should be defined as a string. If multiple templates are required, it should be defined as a string array.
- The ** used in the path corresponds to any folder under the relevant folder.
- The * used in the path can be used to define the filename, foldername, or extension.
- The or statement can be used in the path with the pipe symbol. Multiple formats can be defined this way. For example: (php|json|xlsx).
- The locales.code in the path corresponds to language code.
- update_translations in the API documentation corresponds to the same parameter in the import endpoint. Default value is false.
- If a different variable other than is desired, the code_alias parameter can be added to the locale object. An example is shown below. Now, <locale-code> === "English":
transiyzi.json
1
{
2
"upload": {
3
"locales": [
4
{
5
"code": "en",
6
"path": [
7
"**/<locale-code>/**/*.(php|json)",
8
"**/<locale-code>.(php|json)"
9
],
10
"update_translations": true
11
}
12
]
13
}
14
}
It reads the definitions in the download key of the transiyzi.json file and performs a download.
- format in the API documentation corresponds to the same parameter in the import endpoint. Default value is null.
- The default_format in the API documentation corresponds to the same parameter in the download endpoint. Default value is JSON.
- The include_unreviewed_translations in the API documentation corresponds to the same in the download endpoint. Default value is null.
- The aliases parameter is used to make changes to the foldername or filename of downloaded files. In the example below, the downloaded file "./en/auth.php" is saved as "./default/auth.php"
1
{
2
"access_token": "",
3
"project_id": "",
4
"base_path": "./resources/lang",
5
"upload": {
6
"locales": [
7
{
8
"code": "en",
9
"path": [
10
"**/<locale-code>/**/*.(php|json)",
11
"**/<locale-code>.(php|json)"
12
],
13
"update_translations": true
14
}
15
]
16
},
17
"download": {
18
"default_format": "JSON",
19
"include_unreviewed_translations": false,
20
"aliases": {
21
"en": "default",
22
"es": "spanish",
23
"de": "german"
24
}
25
}
26
}
Last modified 6mo ago