readme.so
readme.so copied to clipboard
Adding new language
Hi there, Adding new languages welcomed? What format and structure followed for languages?
I created this instruction and tested it to verify if it works.
-
In
public/locales:- create a folder with language's short name
- provide needed files and values in that folder by looking to another language supports in
public/locales. Currently,common.jsonandeditor.jsonfiles need to be provided.
-
In
data\:- Create file in data folder with this format:
section-templates-languageshortnamelowercase_LANGUAGESHORTNAMEUPPERCASE.jsFor example, English language support is written asdata\section-templates-en_EN.js. Copy a language code from a file indatafolder, update language name and values. - In
data\index.js- import your language section data from the file you created in previous step in format of
import { languageshortnamelowercase_LANGUAGESHORTNAMEUPPERCASE } from './section-templates-languageshortnamelowercase_LANGUAGESHORTNAMEUPPERCASE'. For example, English language support is written as `import { en_EN } from './section-templates-en_EN'. - add your language to
module.exportsin a format of:short_name_lowercase: shortnamelowercase_shortnameuppercase. For example, English language support is written asen: en_EN
- import your language section data from the file you created in previous step in format of
- Create file in data folder with this format:
-
In
components\LanguageDropDown.js, add language's name aslabeland short name asroute -
Add language's short name to
next-i18next.config.js'slocalesarray.
Good job @AlperBayraktar
Thanks :)