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

Ability to customize interpolation prefix/suffix #4726

Closed
zleight1 opened this issue Apr 15, 2024 · 1 comment · Fixed by #4727
Closed

Ability to customize interpolation prefix/suffix #4726

zleight1 opened this issue Apr 15, 2024 · 1 comment · Fixed by #4727
Labels
🛳 In PR This issue is being addressed in a PR

Comments

@zleight1
Copy link
Contributor

zleight1 commented Apr 15, 2024

Is your feature request related to a problem? Please describe.

We use i18next (vue-i18next + react, etc.) and the default interpolation uses double braces {{ param }}.

While we can set the interpolation on i18next to use singles braces like vee-validate, this leads to confusion as any documentation or examples online are going to use double braces.

Also, theoretically we could only use single braces for texts that feed into vee-validate, but again this is mixing and inevitably leads to issues down the road. We also have a mix of React and Vue so there would be inconsistency amongst projects (micro-frontends).

Describe the solution you'd like

The ability to customize the interpolation, at minimum to allow double braces but ideally for flexibility it could take any pattern to align with other standards.

Describe alternatives you've considered

Described in the feature request, but generally setting the other libraries to single braces or mixing.

@zleight1
Copy link
Contributor Author

I'm going to attempt to implement this myself, it looks like this would just be an option to the constructor and then it'd be passed down through all calls to interpolate.

zleight1 pushed a commit to zleight1/vee-validate that referenced this issue Apr 15, 2024
Allow for specifying custom interpolation options for i18n.
This is useful for custom interpolation patterns, such as `{{` and `}}`.
Tests added, and scoped to the i18n module.

Closes logaretm#4726
@logaretm logaretm added the 🛳 In PR This issue is being addressed in a PR label May 28, 2024
zleight1 pushed a commit to zleight1/vee-validate that referenced this issue May 29, 2024
Unwrapped the tests from the describe blocks, so the diff is cleaner.
Prefixed new tests names so they don't collide, also in commented section with begin/end.

logaretm#4726
zleight1 pushed a commit to zleight1/vee-validate that referenced this issue May 29, 2024
logaretm pushed a commit that referenced this issue May 29, 2024
* feat(i18n): allow custom interpolation options for i18n

Allow for specifying custom interpolation options for i18n.
This is useful for custom interpolation patterns, such as `{{` and `}}`.
Tests added, and scoped to the i18n module.

Closes #4726

* test(i18n): undo describe scoping

Unwrapped the tests from the describe blocks, so the diff is cleaner.
Prefixed new tests names so they don't collide, also in commented section with begin/end.

#4726

* docs(i18n): add docs for interpolation settings

#4726

* docs(i18n): fix example

#4246
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛳 In PR This issue is being addressed in a PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants