mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:44:49 +08:00
FIX: Detect {{foo}} as interpolation key
This commit is contained in:
parent
c788737eed
commit
b8fc699164
|
@ -1,6 +1,6 @@
|
|||
class I18nInterpolationKeysFinder
|
||||
def self.find(text)
|
||||
keys = text.scan(I18n::INTERPOLATION_PATTERN)
|
||||
keys = text.scan(Regexp.union(I18n::INTERPOLATION_PATTERN, /\{\{(\w+)\}\}/))
|
||||
keys.flatten!
|
||||
keys.compact!
|
||||
keys.uniq!
|
||||
|
|
|
@ -4,8 +4,8 @@ require "i18n/i18n_interpolation_keys_finder"
|
|||
RSpec.describe I18nInterpolationKeysFinder do
|
||||
describe '#find' do
|
||||
it 'should return the right keys' do
|
||||
expect(described_class.find('%{first} %{second}'))
|
||||
.to eq(['first', 'second'])
|
||||
expect(described_class.find('%{first} %{second} {{third}}'))
|
||||
.to eq(['first', 'second', 'third'])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user