Skip to content

feat(interpolation): allow clients to use custom interpolation patterns#439

Merged
radar merged 1 commit intoruby-i18n:masterfrom
tonytonyjan:feature/support-custom-interpolation-patterns
Oct 25, 2018
Merged

feat(interpolation): allow clients to use custom interpolation patterns#439
radar merged 1 commit intoruby-i18n:masterfrom
tonytonyjan:feature/support-custom-interpolation-patterns

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
@tonytonyjan tonytonyjan force-pushed the feature/support-custom-interpolation-patterns branch from 26aacf4 to 196d144 Compare October 25, 2018 03:12
@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.

2 participants