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

issue with null value for the key. #1790

Closed
leomon38 opened this issue Jun 7, 2022 · 4 comments
Closed

issue with null value for the key. #1790

leomon38 opened this issue Jun 7, 2022 · 4 comments

Comments

@leomon38
Copy link

leomon38 commented Jun 7, 2022

for example, if I put null as value to a key, what would happen?
I encounter some exception with i18next.t especially the key has "." in it
so I did this resource file for testing

   resources: {
       en: {
        translation: {
        "[email protected]" : null,
        "..": null,
        "." : null,
        "..." : null,
        "....": null,
        "...b" : null,
        "b..." : null,    
        "Loading...": null,      
        "Loading." : null,
        "Loading" : null,
        "2...20"
       }
    }
 }

I went thru the list and all following key will throw " Cannot read properties of null (reading 'b...')" exception

"[email protected]",
".",
"..",
"...",
"b...",
"2...20"

But other key will work fine and return the key itself as translation (showing below)

"...b",
"Loading...",
"Loading."
"Loading",
"...Loading"

is this a bug or something

I also tried
returnNull: false,
but it wont fix it

@jamuhl
Copy link
Member

jamuhl commented Jun 7, 2022

did you read about keys being dot delimited? keySeparator option

@adrai
Copy link
Member

adrai commented Jun 7, 2022

please try with v21.8.9 (was a bug in deepFind for ignoreJSONStructure = true)

@leomon38
Copy link
Author

leomon38 commented Jun 8, 2022

please try with v21.8.9 (was a bug in deepFind for ignoreJSONStructure = true)

Yes, I installed the latest version and it fixed the problem I have.
And keySeparator: false also help for older version i18next... not to sprout out the exception

@adrai
Copy link
Member

adrai commented Jun 8, 2022

If you like this module don’t forget to star this repo. Make a tweet, share the word or have a look at our https://locize.com to support the devs of this project.

There are many ways to help this project 🙏

@adrai adrai closed this as completed Jun 8, 2022
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

3 participants