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

feat(i18n): allow custom interpolation options for i18n #4727

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zleight1
Copy link

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

πŸ”Ž Overview

Adds the ability to use custom interpolation options, such as prefix and suffix.

This allows the library to comply with the default i18next standard.

πŸ€“ Code snippets/examples (if applicable)

configure({
  generateMessage: localize(
    'en',
    {
      messages: {
        between: 'The {{field}} field must be between 0:{{min}} and 1:{{max}}',
      },
    },
    {
      prefix: '{{',
      suffix: '}}',
    },
  ),
});

βœ” Issues affected

closes #4726

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
Copy link

codecov bot commented Apr 15, 2024

Codecov Report

Attention: Patch coverage is 91.48936% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 89.89%. Comparing base (2a0881f) to head (75e229f).

Files Patch % Lines
packages/i18n/src/index.ts 90.32% 3 Missing ⚠️
packages/i18n/src/utils.ts 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4727      +/-   ##
==========================================
+ Coverage   89.87%   89.89%   +0.01%     
==========================================
  Files          93       93              
  Lines        7676     7709      +33     
  Branches     1360     1362       +2     
==========================================
+ Hits         6899     6930      +31     
- Misses        770      772       +2     
  Partials        7        7              

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@zleight1
Copy link
Author

If accepted I'll update the docs as well

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

Successfully merging this pull request may close these issues.

Ability to customize interpolation prefix/suffix
1 participant