# Global Config

This config is used by tools & plugins such as the scoped lib extractor and the keys manager.

If you installed Transloco via the schematics, a `transloco.config.ts` should have been created. Otherwise, you can just create a `transloco.config.ts` in the project's root folder and add the configuration in it:

```typescript
import { TranslocoGlobalConfig } from "@jsverse/transloco-utils";

const config: TranslocoGlobalConfig = {
  rootTranslationsPath?: string;
  defaultLang?: string;
  scopedLibs?: string[] | Array<{ src: string; dist: string[] }>;
  scopePathMap?: Record<string, string>;
  langs?: string[];
  keysManager?: {
    input?: string | string[];
    output?: string;
    fileFormat?: 'json' | 'pot';
    marker?: string;
    addMissingKeys?: boolean;
    emitErrorOnExtraKeys?: boolean;
    replace?: boolean;
    defaultValue?: string | undefined;
    unflat?: boolean;
    sort?: boolean;
  };
};

export default config;
```

## Configuration Properties

### Core Properties

* **`rootTranslationsPath`** - The path to your root translation files directory (default: `src/assets/i18n`)
* **`defaultLang`** - The default language of your application
* **`langs`** - Array of supported languages in your application

### Scoped Libraries

* **`scopedLibs`** - Configuration for the [Scoped Library Extractor](https://jsverse.gitbook.io/transloco/developer-tools/scoped-library-extractor) tool. Defines which library translation files to copy during build. Can be:
  * `string[]` - Array of library paths to copy from their default i18n paths
  * `Array<{ src: string; dist: string[] }>` - Custom source and destination mappings

### Translation Path Mapping

* **`scopePathMap`** - Custom mappings between scope names and their file system paths. Used by the [join](https://jsverse.gitbook.io/transloco/developer-tools/schematics/join) and [split](https://jsverse.gitbook.io/transloco/developer-tools/schematics/split) schematics when your translation files don't follow the default directory structure.

  Example:

  ```typescript
  scopePathMap: {
    'my-scope': 'src/app/path-to-scope',
    'my-project-scope': 'projects/my-project/i18n',
  }
  ```

### Keys Manager

The `keysManager` property configures the behavior of the translation keys extraction and management tool.


---

# 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/global-config.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.
