Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning on object returns despite enabling returnObjects #93

Open
ChlodAlejandro opened this issue Dec 28, 2020 · 1 comment
Open

Warning on object returns despite enabling returnObjects #93

ChlodAlejandro opened this issue Dec 28, 2020 · 1 comment

Comments

@ChlodAlejandro
Copy link

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

initialization

Localization file

localization

Usage in code, with reported problem

usage in code

@nyavro
Copy link
Owner

nyavro commented Dec 28, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants