I'm trying to change default locale in my project with just button click. I don't want to change my URL with pushing sub paths like fooo.com/fa
.
Here is my next-i18next config:
module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'fa'],
},
};
And here is my simple code for changing locale and using that:
const { t, i18n } = useTranslation('common');
///
<button onClick={() => i18n.changeLanguage('fa')}>
Click to Change Language
</button>
<p>{t('title')}</p>
But it does not work and stuck in default locale that is EN.