mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 09:10:25 +08:00
Add spec to notify us when translations have invalid interpolation keys.
This commit is contained in:
parent
48fb19d9e4
commit
b9fbc95ef4
1 changed files with 10 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue