Skip to main content

Get and Set locale

Get the locale

To get the current locale, you can call the hook useLocale:

import { useLocale } from '@psyycker/react-translation';

const [locale] = useLocale();

Update the locale

If you'd like to update the locale, you can call the second item coming from useLocale:

import { useLocale } from '@psyycker/react-translation';

const [locale, setLocale] = useLocale();

setLocale('fr-FR');