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)
trs = {}
path = []
msgstr = ''
- f.each_line { |line|
+ f.each_line do |line|
line.strip!
if line[0..8] == 'msgctxt "'
path = line[9..-2].split(':')
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
langcode = File.basename(filename, '.po')
-tr = {langcode => po2hash(pofile)}
+tr = { langcode => po2hash(pofile) }
print tr.to_yaml