2 # po2yaml, for converting gettext .po to the RoR translation YAML
4 # - To create a language's yaml from a given po file
5 # po2yaml de.po > de.yml
9 def add_translation(hash, keys, value)
16 add_translation(hash[key], keys, value)
27 if line[0..8] == 'msgctxt "'
28 path = line[9..-2].split(':')
29 elsif line[0..7] == 'msgstr "'
33 next if path.empty? || msgstr.empty?
35 add_translation(trs, path, msgstr)
43 pofile = File.open(filename, "r")
45 langcode = File.basename(filename, '.po')
47 tr = { langcode => po2hash(pofile) }