i'm having cors when changing language with i18n.changeLanguage function.I have two buttons that have onClick method and call a custom function named changeLang.Inside that function i am calling i18n.changeLanguage function and pass it to the lng parameter.
const changeLang = lng => {
i18n.i18n.changeLanguage(lng);
};
<button onClick={() => changeLang('en')} className="en">
EN
</button>
<button onClick={() => changeLang('tr')} className="tr">
TR
</button>
and My i18n config is just like this .
import NextI18Next from 'next-i18next';
import { initReactI18next } from 'react-i18next';
export default new NextI18Next({
use: [initReactI18next],
defaultLanguage: 'tr',
fallbackLng: 'en',
otherLanguages: ['en'],
localeSubpaths: {
en: 'en',
},
localePath: '/app/static/locales',
detection: {
order: ['cookie', 'localStorage'],
lookupCookie: 'next-i18next',
lookupLocalStorage: 'i18nextLng',
caches: ['cookie', 'localStorage'],
},
});