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