X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/baf10cd39289cd7e94a819305e46f43e85a136c6..5cbd4038edb32b0304bd766e70fc680ea447b52b:/script/locale/po2yaml diff --git a/script/locale/po2yaml b/script/locale/po2yaml index ea78ce2c6..a4b8ac8b7 100755 --- a/script/locale/po2yaml +++ b/script/locale/po2yaml @@ -11,9 +11,8 @@ def add_translation(hash, keys, value) if keys.empty? hash[key] = value else - unless hash.key? key - hash[key] = {} - end + hash[key] ||= {} + add_translation(hash[key], keys, value) end hash @@ -31,11 +30,11 @@ def po2hash(f) msgstr = line[8..-2] end - if !path.empty? && !msgstr.empty? - add_translation(trs, path, msgstr) - path = [] - msgstr = '' - end + next if path.empty? || msgstr.empty? + + add_translation(trs, path, msgstr) + path = [] + msgstr = '' end trs end