Skip to main content
Version: 5.x.x

Switching language (React)

For language management, use useTolgee hook. With passed language event, so the component will get re-rendered when this event occurs.

import { useTolgee } from '@tolgee/react';

export const LangSelector = () => {
const tolgee = useTolgee(['language']);

return (
<select
onChange={(e) => tolgee.changeLanguage(e.target.value)}
value={tolgee.getLanguage()}
>
<option value="en">­čçČ­čçž English</option>
<option value="cs">­čçĘ­čç┐ ─îesky</option>
</select>
);
};

Read more about Language change, detection and storage