OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/tasks/check-translations.rb

34 lines
623 B

#!/usr/bin/env ruby
require 'yaml'
langdir = File.join(File.dirname(__FILE__), '..', '..', 'config', 'locales')
template_file = "#{langdir}/en.yml"
template = YAML::load_file(template_file)['en']
errors = false
Dir.glob("#{langdir}/*.yml").each {|lang_file|
next if lang_file == template_file
lang = YAML::load_file(lang_file)
l = lang.keys[0]
template.each_pair {|key, txt|
if ! lang[l][key]
puts "missing: ${l}: #{key}"
errors = true
end
}
lang[l].keys.each {|k|
if !template[k]
puts "obsolete: #{l}: #{k}"
errors = true
end
}
}
puts "All OK!" unless errors