Skip to content

Add A New Language

Joshua Cold edited this page Apr 18, 2021 · 2 revisions

Locationalization resources are found in public/locales

To add a new locale template for a language edit the i18next-scanner-config.js file under the i18n/ folder

        plural: false,
        lngs: ['en','es'],
        ns: [ 'translation' ],

add a new language code to the lngs section

then run the i18next-scanner via the npm script

npm run parse-locales

your newly added language should have a translation.json file created under public/locales/{your lang}/translation.json

you should have a bunch strings to fill out

  "buzzerHelpText": "__STRING_NOT_TRANSLATED__",
  "buzzerNameError": "__STRING_NOT_TRANSLATED__",
  "buzzerOrder": "__STRING_NOT_TRANSLATED__",
  "buzzer": "__STRING_NOT_TRANSLATED__",
  "buzzerTeamError": "__STRING_NOT_TRANSLATED__",

some of these keys are self explanitory like total and win

some of them I recommend looking at the english translation for the purpose of the message

ignore any parsed sections {{count, number}}

add your language to the i18n/i18n.js file

import translationEN from '../public/locales/en/translation.json';
import translationES from '../public/locales/es/translation.json';
 
const resources = {
  en: {
    translation: translationEN
  },
  es: {
    translation: translationES
  }
};

add your language to the language picker components/language.js

        <option value="en">English ({t("english")})</option>
        <option value="es">Español ({t("spanish")})</option> 

If you actually go through the trouble of translating translation.json then in your pull request I can help you with the rest.

Clone this wiki locally