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

Feature(scope): Allow usage of arrays by number index #815

Open
1 task done
muuvmuuv opened this issue Nov 29, 2024 · 1 comment
Open
1 task done

Feature(scope): Allow usage of arrays by number index #815

muuvmuuv opened this issue Nov 29, 2024 · 1 comment

Comments

@muuvmuuv
Copy link

muuvmuuv commented Nov 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Which Transloco package(s) will this feature affect?

Transloco

Is your feature request related to a problem? Please describe

We have an array of strings that are random localized placeholders for an input box. In our program we add them as arrays and in our ui I can then easily create a random function that returns an random index to a translated string.

Describe the solution you'd like

When passing a string like SOME_FEATURE.PLACEHOLDER.0 it refers to the index in the JSON array at that JSON path.

Describe alternatives you've considered

We could also add a _ to all strings SOME_FEATURE.PLACEHOLDER_0 but I think this is a reasonable feature.

Additional context

No response

I would like to make a pull request for this feature

Yes 🚀

@muuvmuuv
Copy link
Author

Oh. Since you use flat with safe, it wont work actually with transloco. I tried it with a simple test, setting the value to false my test pass but others fail. So this is a heavy breaking change. Any suggestions?

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

1 participant