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
Hello, I am facing weird bug. When I share array that contains i.a. translations between two files ( one file with component, second file with service) , those translations stop working. When I remove usage from service, and use only in one file, it is fine.
Also it is working when I've change scope of this array by changing declaration from const to var.
Maybe is it related to some bundling ?
Please provide a minimal reproducible example repository or codesandbox example etc...
But looking at your animal.component.tsx code, it seems you are using the t() function outside of a react component?
The t function needs to be executed inside a function (normally where the UI is rendered...)
🐛 Bug Report
Hello, I am facing weird bug. When I share array that contains i.a. translations between two files ( one file with component, second file with service) , those translations stop working. When I remove usage from service, and use only in one file, it is fine.
Also it is working when I've change scope of this array by changing declaration from const to var.
Maybe is it related to some bundling ?
To Reproduce
animal.component.tsx
animal.service.tsx
Expected behavior
Animal component shows translation for cat
Your Environment
.use(Backend)
.use(initReactI18next)
.init({
backend: {
loadPath: getCoreAPIUrl('xx.json')
},
ns: [
'animals'
],
defaultNS: 'common',
lng: LanguageCodes.en_US,
load: 'currentOnly',
fallbackLng: LanguageCodes.en_US,
debug: false,
interpolation: {
escapeValue: false
},
react: {
useSuspense: false
}
})
The text was updated successfully, but these errors were encountered: