From c54df5795479d07cb3a3a0611c92cd55d4b69790 Mon Sep 17 00:00:00 2001 From: friflaj Date: Sun, 14 Nov 2010 11:17:03 +0100 Subject: [PATCH] Don't update translations, just report errors (potential character encoding problems) --- config/locales/todo.rb | 33 ++++++++++++++++++++++++++++++ lib/tasks/update_translations.rake | 31 ---------------------------- 2 files changed, 33 insertions(+), 31 deletions(-) create mode 100755 config/locales/todo.rb delete mode 100755 lib/tasks/update_translations.rake diff --git a/config/locales/todo.rb b/config/locales/todo.rb new file mode 100755 index 0000000000..11aebcc58d --- /dev/null +++ b/config/locales/todo.rb @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby + +require 'yaml' + +langdir = File.dirname(__FILE__) + +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 diff --git a/lib/tasks/update_translations.rake b/lib/tasks/update_translations.rake deleted file mode 100755 index 49b52edb41..0000000000 --- a/lib/tasks/update_translations.rake +++ /dev/null @@ -1,31 +0,0 @@ -desc 'Update translation files' - -require 'yaml' - -namespace :redmine do - namespace :backlogs do - task :update_translations => :environment do - langdir = File.dirname(File.dirname(File.dirname(__FILE__))) + '/config/locales' - template_file = "#{langdir}/en.yml" - template = YAML::load_file(template_file)['en'] - - 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| - next if lang[l][key] - lang[l][key] = "[[#{txt}]]" - } - lang[l].keys.each {|k| - lang[l].delete(k) unless template[k] - } - - File.open( lang_file, 'w' ) do |out| - YAML.dump(lang, out) - end - } - end - end -end