mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
Add spec to notify us when translations have invalid interpolation keys.
This commit is contained in:
@ -59,6 +59,16 @@ describe "i18n integrity checks" do
|
|||||||
end
|
end
|
||||||
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|
|
Dir["#{Rails.root}/config/locales/client.*.yml"].each do |path|
|
||||||
it "has valid client YAML for '#{path}'" do
|
it "has valid client YAML for '#{path}'" do
|
||||||
yaml = YAML.load_file(path)
|
yaml = YAML.load_file(path)
|
||||||
|
Reference in New Issue
Block a user