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(interpolation): allow clients to use custom interpolation patterns #439

Conversation

tonytonyjan
Copy link
Contributor

@tonytonyjan tonytonyjan commented Oct 25, 2018

add a new config: I18n.config.interpolation_patterns

Usage:

I18n.config.interpolation_patterns << /\{\{(\w+)\}\}/
I18n.interpolate("Hello, {{name}}", name: "tonytonyjan")
# => "Hello, tonytonyjan"

This PR is an improved version of #319 with the following changes:

  • resolve conflict
  • Freeze I18n::INTERPOLATION_PATTERNS to prevent from being changed by setting I18n.config.interpolation_patterns.

add a new config: `I18n.config.interpolation_patterns`

Usage:

    I18n.config.interpolation_patterns << /\{\{(\w+)\}\}/
    I18n.interpolate("Hello, {{name}}", name: "tonytonyjan")
    # => "Hello, tonytonyjan"

close ruby-i18n#319
@radar
Copy link
Collaborator

radar commented Oct 25, 2018

Thank you for the R @tonytonyjan, and also to @voldy for the initial PR in #319. I'll merge this into master now, and it will be released in 1.2.0 later on.

@radar radar merged commit 3269c01 into ruby-i18n:master Oct 25, 2018
Hamms added a commit to code-dot-org/code-dot-org that referenced this pull request Sep 22, 2020
Looks like `I18n::INTERPOLATION_PATTERNS` is being deprecated: ruby-i18n/i18n#439
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.

None yet

2 participants