Skip to main content
Version: 5.x.x

Migrating to v5 (React)

In version 5, the core library was completely redesigned. Before you start, please read the general info about this new version.

Update TolgeeProvider component and initialize Tolgee as described in core migration:

const tolgee = ...

...

<TolgeeProvider tolgee={tolgee} fallback="Loading...">
<Children />
</TolgeeProvider>

Changing language

We've removed v4 useCurrentLanguage and useSetLanguage hooks, which are now replaced by the more general hook useTolgee (read more).

const tolgee = useTolgee(['language']);

...

<select
value={tolgee.getLanguage()}
onChange={(e) => tolgee.changeLanguage(e.event.target)}
>
...
</select>

Translating

useTranslate now returns an object with t function instead of the function directly.

const { t } = useTranslate();

Tags interpolation is now supported only with <T> component and not with t function. The types for t function were too complicated as it could return string or react component based on input. Now it's more straightforward.