-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GITBOOK-319: change request with no subject merged in GitBook
- Loading branch information
1 parent
40d99ab
commit b6a7423
Showing
1 changed file
with
21 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |