Skip to content

Commit

Permalink
GITBOOK-319: change request with no subject merged in GitBook
Browse files Browse the repository at this point in the history
  • Loading branch information
defguard-community authored and gitbook-bot committed Jan 13, 2025
1 parent 40d99ab commit b6a7423
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions for-developers/translations-web/adding-translations.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Adding translations

To add a new language you need to create a new folder to _**i18n/{new language code}**_ with **index.ts** file that exports by default a `Translation` type object.
To add a new language you need to create a new folder to _**i18n/{new language code}**_ with **index.ts** file. For a reference you can check `pl` or `ko` translation folders.

### Types generation

#### Adding a new language

If you add a new translation make sure you run types generation command:

```bash
pnpm run generate-translation-types
```

This will ensure the translation is properly detected.

### Partial translations

We don't expect all translations to be always in sync with latest changes because they are an community effort, so even if UI is displaying an translation if anything is out of sync with base EN then the missing key will fallback to an EN version instead. In order for it to work the translation object needs to be merged with EN before export. Follow `pl` or `ko` translation folders for reference.

{% hint style="warning" %}
Make sure the newly added translation object has Translation type assigned to it in order to ensure it's linted properly, this helps to keep it in sync with base EN translation.
{% endhint %}

For a reference check out this [example](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-react/examples/react/src/i18n) repo.

0 comments on commit b6a7423

Please sign in to comment.