# Options

## CLI Options

#### **`--help -h`**

Displays the help menu for the Transloco Keys Manager.

### Extract Command

#### **`--config -c`**

Defines the root search directory for the Transloco configuration file. The default is `process.cwd()`.

#### **`--project`**

Specifies the targeted project. Defaults to `defaultProject`. The `sourceRoot` of this project, retrieved from the `angular.json` file, prefixes the default `input`, `output`, and `translationsPath` properties. Ensure full paths are provided when overriding these options. The Transloco configuration file is also searched in the project's `sourceRoot` unless the `config` option is explicitly provided.

{% hint style="info" %}
If no `angular.json` file is present, `sourceRoot` defaults to `src`.
{% endhint %}

#### **`--input -i`**

Specifies the source directory for all files using translation keys. Defaults to `[${sourceRoot}/app']`.

```bash
transloco-keys-manager extract -i src/my/path  
transloco-keys-manager extract -i src/my/path,project/another/path  
```

{% hint style="info" %}
If a project is provided, the default input value is determined by `projectType`. For libraries, the default is `['${sourceRoot}/lib']`.
{% endhint %}

#### **`--output -o`**&#x20;

Specifies the target directory for generated translation files. Defaults to `${sourceRoot}/assets/i18n`.

#### **`--fileFormat -f`**

Sets the translation file format (`json` or `pot`). Defaults to `json`.

#### **`--langs -l`**

Defines the languages for which translation files are generated. Defaults to `[en]`.

#### **`--marker -m`**

Specifies the marker sign for dynamic values. Defaults to `t`.

#### **`--sort`**

Sort the keys using JavaScript’s `sort()` method. Defaults to `false`.

#### **`--unflat -u`**

Determines whether to unflatten keys. Defaults to `flat`.

{% hint style="info" %}
When using unflattened files, "parent" keys cannot hold separate translation values. For example, if you have `first` and `first.second`, the translation file will represent this as:\
`{ "first": { "second": "…" } }`.\
During extraction, warnings will highlight keys requiring attention.
{% endhint %}

#### **`--defaultValue -d`**

Defines the default value for generated keys. Defaults to `Missing value for {{key}}`.

Supported replaceable placeholders:

* `{{key}}`: Complete key, including the scope.
* `{{keyWithoutScope}}`: Key value without the scope.
* `{{scope}}`: The key's scope.
* `{{params}}`: Parameters used for the key.

#### **`--replace -r`**&#x20;

Replaces the contents of a translation file if it already exists. Defaults to `false` (merges files instead).

#### **`--remove-extra-keys -R`**&#x20;

Removes extra keys from existing translation files. Defaults to `false`.

#### **`--add-missing-keys -a`**

Adds missing keys identified by the `detective`. Defaults to `false`.

### **Find Command**

#### **`--emit-error-on-extra-keys -e`**

It emits an error and exits the process if extra keys are found. Defaults to `false`.

{% hint style="info" %}
**Extra keys** are those present in translations but not used in the code.
{% endhint %}

#### **`--translationsPath -p`**

Defines the root directory path for translation files. Defaults to `${sourceRoot}/assets/i18n`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jsverse.gitbook.io/transloco/developer-tools/keys-manager-tkm/options.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
