mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 11:51:43 +08:00
Add spec to notify us when translations have invalid interpolation keys.
This commit is contained in:
parent
48fb19d9e4
commit
b9fbc95ef4
|
@ -59,6 +59,16 @@ describe "i18n integrity checks" do
|
|||
end
|
||||
end
|
||||
|
||||
Dir["#{Rails.root}/config/locales/{client,server}.*.yml"].each do |path|
|
||||
it "does not contain invalid interpolation keys for '#{path}'" do
|
||||
matches = File.read(path).scan(/%\{([^a-zA-Z\s]+)\}|\{\{([^a-zA-Z\s]+)\}\}/)
|
||||
matches.flatten!
|
||||
matches.compact!
|
||||
matches.uniq!
|
||||
expect(matches).to eq([])
|
||||
end
|
||||
end
|
||||
|
||||
Dir["#{Rails.root}/config/locales/client.*.yml"].each do |path|
|
||||
it "has valid client YAML for '#{path}'" do
|
||||
yaml = YAML.load_file(path)
|
||||
|
|
Loading…
Reference in New Issue
Block a user