Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multilingual support via i18next #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

txusko
Copy link

@txusko txusko commented Aug 25, 2022

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant