i18nPlugin
i18nPlugin copied to clipboard
Warning on object returns despite enabling `returnObjects`
In my initialization function, I enabled returnObjects
so that I can pull objects from the localization files.
await i18next.use(LanguageDetector).init({
fallbackLng: this.fallbackLanguage,
debug: true,
returnObjects: true,
});
My files look like this (ui.json
):
{
"okCancel": {
"ok": "OK",
"cancel": "Cancel"
}
}
For some reason, even with returnObjects
initialized, when running i18next.t("ui:okCancel")
, I'm notified of a Reference to object
. The same issue occurs when running i18next.t("ui:okCancel", {returnObjects: true})
. I'm led to believe this is something wrong with the plugin, since i18next supports returning objects. I've added a few screenshots below for reference. Hope this can get resolved soon. Thanks!
Screenshots
Initialization
Localization file
Usage in code, with reported problem
Hi!
You're right, the plugin does not respond to init function params. This feature is to be done in future releases. There is no init function parsing (this feature is still experimental). So for now, I would implement additional setting "Enable return objects". I think I'll do it in the next release.
Regards