readme.so icon indicating copy to clipboard operation
readme.so copied to clipboard

Adding new language

Open BaseMax opened this issue 3 years ago • 3 comments

Hi there, Adding new languages welcomed? What format and structure followed for languages?

BaseMax avatar Mar 25 '22 23:03 BaseMax

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.json and editor.json files need to be provided.
  • In data\:

    • Create file in data folder with this format: section-templates-languageshortnamelowercase_LANGUAGESHORTNAMEUPPERCASE.js For example, English language support is written as data\section-templates-en_EN.js. Copy a language code from a file in data folder, 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.exports in a format of: short_name_lowercase: shortnamelowercase_shortnameuppercase. For example, English language support is written as en: en_EN
  • In components\LanguageDropDown.js, add language's name as label and short name as route

  • Add language's short name to next-i18next.config.js's locales array.

AlperBayraktar avatar Sep 02 '22 20:09 AlperBayraktar

Good job @AlperBayraktar

BaseMax avatar Sep 02 '22 21:09 BaseMax

Thanks :)

AlperBayraktar avatar Sep 03 '22 16:09 AlperBayraktar