Reputation: 38012
Is it possible to nest interpolation in a translation (similar to how Ruby's string interpolation works)? The syntax I'd like is something like:
en:
welcome: "Welcome %{user.name} from %{user.location.name}"
Then:
t(:welcome, user: user)
Note: I realize this can be done by specifying two separate keys but my example is a bit more complicated and would be easily solved if I could do something like the above.
Upvotes: 0
Views: 156
Reputation: 2731
It doesn't look like the format you're looking for is supported. Lines 6-8 show no regex that matches your pattern.
https://github.com/svenfuchs/i18n/blob/master/lib/i18n/interpolate/ruby.rb#L6
Upvotes: 1