-
Notifications
You must be signed in to change notification settings - Fork 81
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
Loop on array of objects #83
Comments
I've written a custom
I don't have much experience with i18n, but iterating over logical groups makes a lot of sense and it's the first thing I looked for in the library. I implemented |
I tried to do the same but we cannot loop over these JSON arrays, here is the workaround I did: "description": {
"0": "...",
"1": "...",
"2": "...",
"3": "..."
} {#each new Array(4) as _, index}
<p>{$t(`description.${index}`)}</p>
{/each} This is working but it would be nice to be able to loop over JSON array |
Fixed in |
This seems to have broken my translations - I like flat data (🤷♂️) and have a dictionairy like so:
The former gets translated, the latter not anymore with the "not found" warning cheers, and thanks for the library! :) |
Hey @blynx 👋 Sorry, my bad! Fixed in |
wow, that was quick! Thank you! 🙌 |
Describe the bug
Loop on array of objects
To Reproduce
then try to do something like this:
of course this won't work
#each $_(`team.${selectedMember}.career`)
loops more times than the actual length of career.by reading the tests i discovered that the lib is flattening the array so it means that this each loop is looping on the strings instead of the array. Is this an expected behavior? what's the correct way to do this stuff?
The text was updated successfully, but these errors were encountered: