diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-22 14:56:09 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-22 14:56:09 +0000 |
commit | fe7c0d648444bcd4d7e5803f480b1ede62e14553 (patch) | |
tree | 3286fb22485eb1fc8e6e6fda6b5feb69ecbf45e9 /vendor/plugins/gloc-1.1.0/tasks | |
parent | 384cbadce6fb55ccc6cb7a15ebce4beaf10bc11f (diff) | |
download | redmine-fe7c0d648444bcd4d7e5803f480b1ede62e14553.tar.gz redmine-fe7c0d648444bcd4d7e5803f480b1ede62e14553.zip |
Added polish translation (Tomasz Gawryl).
Added a gloc task to update lang files based on the english file content.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@749 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'vendor/plugins/gloc-1.1.0/tasks')
-rw-r--r-- | vendor/plugins/gloc-1.1.0/tasks/gloc.rake | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/plugins/gloc-1.1.0/tasks/gloc.rake b/vendor/plugins/gloc-1.1.0/tasks/gloc.rake index 8da73779e..88f3472ec 100644 --- a/vendor/plugins/gloc-1.1.0/tasks/gloc.rake +++ b/vendor/plugins/gloc-1.1.0/tasks/gloc.rake @@ -27,4 +27,27 @@ namespace :gloc do puts count.keys.sort.map{|x|" WARNING: Duplicate key '#{x}' (#{count[x]} occurances)"}.join("\n") unless count.empty?
}
end
+
+ desc 'Updates language files based on em.yml content'
+ task :update do
+ dir = ENV['DIR'] || './lang'
+
+ en_strings = {}
+ en_file = File.open(File.join(dir,'en.yml'), 'r')
+ en_file.each_line {|line| en_strings[$1] = $2 if line =~ %r{^([\w_]+):\s(.+)$} }
+ en_file.close
+
+ files = Dir.glob(File.join(dir,'*.{yaml,yml}'))
+ files.each do |file|
+ puts "Updating file #{file}"
+ keys = IO.readlines(file).collect {|line| $1 if line =~ %r{^([\w_]+):\s(.+)$} }.compact
+ lang = File.open(file, 'a')
+ en_strings.each do |key, str|
+ next if keys.include?(key)
+ puts "added: #{key}"
+ lang << "#{key}: #{str}\n"
+ end
+ lang.close
+ end
+ end
end
\ No newline at end of file |