1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2024-12-05 02:23:04 +00:00
mpw/test/test_translate.rb

32 lines
583 B
Ruby
Raw Normal View History

2016-11-12 15:54:41 +00:00
#!/usr/bin/ruby
require 'yaml'
require 'test/unit'
class TestTranslate < Test::Unit::TestCase
def test_00_check_translate
missing = 0
Dir.glob('i18n/*.yml').each do |yaml|
lang = File.basename(yaml, '.yml')
translate = YAML.load_file(yaml)
2017-02-22 18:23:55 +00:00
`grep -r -o "I18n.t('.*)" bin/ lib/ | cut -d"'" -f2`.each_line do |line|
2016-11-12 15:54:41 +00:00
begin
t = translate[lang]
line.strip.split('.').each do |v|
t = t[v]
end
assert(!t.to_s.empty?)
rescue
puts "#{lang}.#{line}"
missing = 1
end
end
end
assert_equal(0, missing)
end
end