]> git.openstreetmap.org Git - rails.git/blobdiff - script/locale/po2yaml
Fix rubocop style issues
[rails.git] / script / locale / po2yaml
index ea78ce2c64a3e1135fe18840f2cea47e4d3c71af..a4b8ac8b7939366da132f70747c6abc9df021824 100755 (executable)
@@ -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