heardle-turkish icon indicating copy to clipboard operation
heardle-turkish copied to clipboard

Multilingual support via i18next

Open txusko opened this issue 2 years ago • 0 comments

Multilingual support via i18next.

Just duplicate translation.json in public/locales/tr folder, change the folder name from tr to the language you want to support, and translate that file.

Default fallback locale is set in .env file by:

REACT_APP_APP_LANG=tr

Language switcher

A language switcher can be added on the main page or in a helper dialog. Code to change the locale:

const changeLanguage = (lng: string) => {
  i18n.changeLanguage(lng);
};
  ....
<button type="button" onClick={() => changeLanguage('tr')}>tr</button>
<button type="button" onClick={() => changeLanguage('ca')}>ca</button>

txusko avatar Aug 25 '22 17:08 txusko