> For the complete documentation index, see [llms.txt](https://docs.transiyzi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.transiyzi.com/developers/cli-command-line-interface.md).

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

### Installation

The Transiyzi CLI is available on NPM repository as [transiyzi/transiyzi-cli](https://www.npmjs.com/package/@transiyzi/transiyzi-cli).

#### Install using npm

```javascript
npm install -g @transiyzi/transiyzi-cli
```

### Usage

Run **transiyzi --help** from the terminal to see the list of commands and subcommands. Run **transiyzi command --help** to see the help page.

#### Commands

<details>

<summary>transiyzi init</summary>

It is used to create the transiyzi.json file that holds your project settings.

{% code title="transiyzi.json" overflow="wrap" lineNumbers="true" %}

```json
{
    "access_token": "",
    "project_id": "",
    "base_path": "./resources/lang",
    "upload": {
        "locales": []
    },
    "download": {
        "default_format": "JSON",
        "include_unreviewed_translations": false,
        "aliases": {}
    }
}
```

{% endcode %}

* **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".&#x20;
  * NOTE: The path should not start from the OS root.
  * Incorrect usage: "/resources/lang".

    <br>

</details>

<details>

<summary>transiyzi upload</summary>

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

{% code title="transiyzi.json" overflow="wrap" lineNumbers="true" %}

```json
{
    "upload": {
        "locales": [
            {
                "code": "en",
                "path": [
                    "**/<locale-code>/**/*.(php|json)",
                    "**/<locale-code>.(php|json)"
                ],
                "update_translations": true
            }
        ]
    }
}
```

{% endcode %}

</details>

<details>

<summary>transiyzi download</summary>

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"

{% code title="" overflow="wrap" lineNumbers="true" %}

```json
{
    "access_token": "",
    "project_id": "",
    "base_path": "./resources/lang",
    "upload": {
        "locales": [
            {
                "code": "en",
                "path": [
                    "**/<locale-code>/**/*.(php|json)",
                    "**/<locale-code>.(php|json)"
                ],
                "update_translations": true
            }
        ]
    },
    "download": {
        "default_format": "JSON",
        "include_unreviewed_translations": false,
        "aliases": {
            "en": "default",
            "es": "spanish",
            "de": "german"
        }
    }
}
```

{% endcode %}

</details>
