Follow these steps to add a new translated content to the website:
-
Create a new subfolder in the
content/i18n
folder with a lowercase abbreviated language name which you want to add. Follow the naming convention from the react-intl library. -
Create
json
files with names and content identical to those incontent/i18n/en
. -
Replace only values in appropriate files. Remember that the value between
{}
chars is a variable and you cannot remove it. If required, change the location of variables in a sentence to match the word order of a given language. -
Import newly created
json
files in thelocales.ts
file and create a new object with the new content in the exported object, similar to that for theen
language. -
Import appropriate locale data from the
react-intl/locale-data
package to theProvider.tsx
file and add it to theaddLocaleData
array in the same file. -
Add the new language to
config.json
under the i18n field. Define the path and locale values without defining the default field as it is reserved only for English as a fallback. -
Make a pull request.
-
Wait for the review.
-
After the merge, the site rebuilds automatically and the pages with the language prefix appear.