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

Multi-json example? #7

Open
vwong opened this issue Feb 1, 2022 · 2 comments
Open

Multi-json example? #7

vwong opened this issue Feb 1, 2022 · 2 comments

Comments

@vwong
Copy link

vwong commented Feb 1, 2022

Hi, I'm looking to build a multi-lingual app with a JSON each for every supported language (only a handful). So, in addition to requesting the key that I want, I also need to specify the locale that I care about.

Instead of $t("helloWorld"), I need to be able to specify say $t("helloWorld", "en_US") or $t("helloWorld", "fr_FR").

Alternatively, even something like $en("helloWorld") and $fr("helloWorld") could do as well.

Can you describe what can I do to achieve this? The former allows me to have one accessorFunctionName, but it doesn't appear that I can add multiple arguments. The latter means I need to specify more than one accessorFunctionName.

@privatenumber
Copy link
Owner

In my use-case, each locale is separated into its own 1-dimensional object where the locale to lookup is resolved within the accessor function.

There's currently no way to add more parameters with the existing API, but happy to review a PR that would add support for a hook that tells the plugin how to parse custom function calls.

@vwong
Copy link
Author

vwong commented Feb 1, 2022

Dang, thanks for that. I'll look for alternatives.

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

No branches or pull requests

2 participants