Skip to content

Commit 7a09b32

Browse files
authored
Fix add new language guide (#56)
1 parent 91340f0 commit 7a09b32

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

pages/guides/add-new-language.mdx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,32 @@ You may want to add a new language to your app to make your content available to
99
### Add the translation files
1010

1111
First, you will have to add the JSON translation files under the `src/locales/<yourLanguageCode>` folder,
12-
with `yourLanguageCode` being a country's alpha2 code (`de` for instance), or a value allowed by
13-
[React i18next](https://react.i18next.com/legacy-v9/step-by-step-guide#1-adding-more-languages).
12+
with `yourLanguageCode` being a country's alpha2 code (`de` for example).
13+
14+
Initiate the dayjs locale and the zod locale in this file.
15+
16+
Example:
17+
18+
```ts filename="src/locales/de/index.ts"
19+
import "dayjs/locale/de";
20+
import zod from "zod-i18n-map/locales/de/zod.json";
21+
```
1422

1523
### Import translations in the index
1624

1725
All translation files are referenced in the `src/locales/index.ts` file. You need to import the new folder
18-
you created, for instance, for german :
26+
you created, for instance, for german:
1927

2028
```ts filename="src/locales/index.ts"
2129
import de from "@/locales/de";
2230
```
2331

24-
and add it to the default export :
32+
and add it to the default export:
2533

2634
```ts filename="src/locales/index.ts"
2735
export default { en, fr, ar, sw, de } as const;
2836
```
2937

30-
### Import the dayjs locale
31-
32-
Start UI is using dayjs to format dates, and each country has its own specificities for displaying dates, so you need to
33-
import the new locale's plugin in the `src/locales/index.ts` file, for instance :
34-
35-
```ts filename="src/locales/index.ts"
36-
import "dayjs/locale/de";
37-
```
38-
39-
You can find the available plugins [here](https://github.com/iamkun/dayjs/tree/dev/src/locale)
40-
4138
### Add the language to the list of user's available languages
4239

4340
Finally, you need to add the language to the `AVAILABLE_LANGUAGES` list in `src/lib/i18n/constants.ts`, in order

0 commit comments

Comments
 (0)