I18Next.Net icon indicating copy to clipboard operation
I18Next.Net copied to clipboard

TranslationTree.GetAllValues() doesn't include parent key paths

Open Place1 opened this issue 2 years ago • 0 comments

Hello, I think i've found a bug or an oversight but i'm not sure.

Given this JSON translation file...

{
    "key": "value of key",
    "look": {
        "deep": "value of look deep"
    }
}

TranslationTree.GetAllValues() will return...

{
    "key": "value of key",
    "deep": "value of look deep"
}

I think the mistake is here: https://github.dev/DarkLiKally/I18Next.Net/blob/6dbd30f23a8655134dc7d2041fe803240584a3ad/src/I18Next.Net/TranslationTrees/TranslationTree.cs#L69-L70

The parent translation name (key path) isn't propagated through the recursion for use in the dictionary.

I think it's supposed to result in this dictionary instead

{
    "key": "value of key",
    "look.deep": "value of look deep"
}

Place1 avatar Mar 14 '23 23:03 Place1