You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We found a report on sentry about failing to read cookies cookies on specific env mentioned below.
importi18nfrom'i18next';importLanguageDetectorfrom'i18next-browser-languagedetector';importHttpApifrom'i18next-http-backend';import{initReactI18next}from'react-i18next';
...
exportconstinitI18next=({ languages, defaultLanguage })=>{constdetectionOptions={order: ['cookie','localStorage','navigator'],lookupCookie: 'i18next-widget',lookupLocalStorage: 'i18nextLng-widget',caches: ['localStorage','cookie'],excludeCacheFor: ['cimode'],};
...
i18nInstance=i18n.use(HttpApi).use(LanguageDetector).use(initReactI18next);i18nInstance.init({load: 'currentOnly',
supportedLngs,cleanCode: true,interpolation: {escapeValue: false,},detection: detectionOptions,ns: ['translation','common'],react: {useSuspense: true,},backend: {// locale files can be found in the `public` directoryloadPath: `${getFilePath()}/locales/{{lng}}/{{ns}}.json`,// We don't want to cache the translation filesrequestOptions: {cache: 'no-store',},// Required when widget is embedded in partner website?crossDomain: true,},}).then(()=>{// TODO: Lazy load moment locale?moment.locale(i18nInstance?.language);});returni18nInstance;};
Expected behavior
Plugin for browser detection should have checks for reading cookies if they are enabled.
馃悰 Bug Report
To Reproduce
A minimal reproducible example.
We found a report on sentry about failing to read cookies cookies on specific env mentioned below.
Expected behavior
Plugin for browser detection should have checks for reading cookies if they are enabled.
something similar to
navigator.cookieEnabled
:https://developer.mozilla.org/en-US/docs/Web/API/Navigator/cookieEnabled
P.S: will add these check in my code too.. however would be great to handle in detector itself to handle fallback.
Your Environment
os.name: Mac OS X
The text was updated successfully, but these errors were encountered: