Open aaronfrary opened 3 years ago
Is there a reason for only checking the first two capture groups here? https://github.com/ruby-i18n/i18n/blob/0888807ab2fe4f4c8a4b780f5654a8175df61feb/lib/i18n/interpolate/ruby.rb#L27
Seems like you could use something like Regexp.last_match.captures.compact.first
to get a capture group more reliably.
What I tried to do
Added a new interpolation pattern and called
#interpolate
:What I expected to happen
Expected it to return
"Example interpolated text"
.What actually happened
Looks like it failed to use the capture group between the
$(
and)
and instead used the whole match. I think this could be related to the use ofRegexp.union
here: https://github.com/ruby-i18n/i18n/blob/0888807ab2fe4f4c8a4b780f5654a8175df61feb/lib/i18n/interpolate/ruby.rb#L22-L23From the docs:
Versions of i18n, rails, and anything else you think is necessary
i18n version 1.8.10