Skip to main content
Version: 4.x.x

Switching languages

For language management, use useCurrentLanguage and useSetLanguage hooks.

import { useSetLanguage, useCurrentLanguage } from '@tolgee/react';

export const LangSelector = () => {
const setLanguage = useSetLanguage();
const getLanguage = useCurrentLanguage();

return (
<select
onChange={(e) => setLanguage(e.target.value)}
value={getLanguage()}
>
<option value="en">🇬🇧 English</option>
<option value="cs">🇨🇿 Česky</option>
</select>
);
};