Skip to content

Internationalization

This starter template uses Transloco as internationalization (i18n) library.

Configuration

You can configure Transloco in the src/app/widgets/transloco/transloco.module.ts file.

See Config Options for more information.

Translations

Translations are stored in the src/assets/i18n folder. The following files are available by default:

src
└── assets
    └── i18n
        ├── en.json
        └── de.json

API

Transloco provides a structural directive, a pipe and a service to translate your application. See Translation in The Template and Translation API for more information.

Add a new language

Two steps are required to add a new language:

  1. Translation file: Add a new file to the src/assets/i18n folder. The file name should be the language code (e.g. fr.json).
  2. Registration: Add the language to the availableLangs array in the src/app/widgets/transloco/transloco.module.ts file.
Use ChatGPT to generate translations

The following ChatGPT prompt can help you to automatically generate translations:

The following json represents a locale file for English translations:

```
{
  "message": {
    "emailAlreadyInUse": "The email address is already in use.",
    "invalidEmail": "The email address is invalid."
  }
}
```

Your task is to generate a json output for German, Spanish and Italian languages following this rules: 
- Keys will be the labels. 
- Values will be the human readable translation for the label.

Attention: Please note that automatically generated translations may contain incorrect information. You should therefore always check them.