'Cannot make i18next work in nodeJS express backend
I'm currently trying to add localization to my nodeJS backend but im having trouble.
In my frontend (angular) i have an interceptor that sets the language in the header:

Which succesfully works as can be seen below in 'Accept-Language' in the headers of my request:

In my backend app.js i import and configure i18next, i18next-fs-backend, i18next-http-middleware and set the path of the locale files (which can also be seen bellow) and :

But when i try to use the translations in my response it doesn't work, it displays the 'delete_success' and not the translation.

Bellow im posting some stuff that is printed in the req.i18n console.log in case it helps:
bound I18n {
observers: { languageChanged: [ [Function (anonymous)] ] },
options: {
debug: false,
initImmediate: false,
ns: [ 'translation' ],
defaultNS: [ 'translation' ],
fallbackLng: [ 'en' ],
preload: [ 'pt-BR' ],
backend: {
loadPath: './locales/{{lng}}/translation.json',
addPath: '/locales/{{lng}}/{{ns}}.missing.json',
ident: 2,
parse: [Function: parse],
stringify: [Function: stringify]
},
language: 'en',
}
I have no idea what else to try, any tips? :(
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

