X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/34e3e51456774127d43408b7ab65c24f41373f62..ef7f3d800cbdd49b692df10d312e5fd880e2e938:/script/locale/po2yaml diff --git a/script/locale/po2yaml b/script/locale/po2yaml index e181bf3d5..ea78ce2c6 100755 --- a/script/locale/po2yaml +++ b/script/locale/po2yaml @@ -11,7 +11,7 @@ def add_translation(hash, keys, value) if keys.empty? hash[key] = value else - unless hash.has_key? key + unless hash.key? key hash[key] = {} end add_translation(hash[key], keys, value) @@ -23,7 +23,7 @@ def po2hash(f) trs = {} path = [] msgstr = '' - f.each_line { |line| + f.each_line do |line| line.strip! if line[0..8] == 'msgctxt "' path = line[9..-2].split(':') @@ -31,12 +31,12 @@ def po2hash(f) msgstr = line[8..-2] end - if !path.empty? and !msgstr.empty? + if !path.empty? && !msgstr.empty? add_translation(trs, path, msgstr) path = [] msgstr = '' end - } + end trs end @@ -45,6 +45,6 @@ pofile = File.open(filename, "r") langcode = File.basename(filename, '.po') -tr = {langcode => po2hash(pofile)} +tr = { langcode => po2hash(pofile) } print tr.to_yaml