Permalink
Browse files

Remove initial locale from yml when converting to json and create a s…

…eperate file for each locale in the file
  • Loading branch information...
kmees committed Jan 27, 2013
1 parent 599f8e4 commit 6704cfda95546e36c47aced7fc9acc29afdae2c5
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/guard/i18next.rb
View
@@ -37,8 +37,11 @@ def run_on_change(paths)
locale = YAML.load(input.read)
input.close
- File.open(options[:output] + "/#{filename}.json", "w") do |f|
- f.puts locale.to_json
+ locale.keys.each do |locale_key|
+ locale_filename = filename.end_with? locale_key ? filename : "#{filename}.#{locale_key}"
+ File.open(options[:output] + "/#{locale_filename}.json", "w") do |f|
+ f.puts locale[:locale_key].to_json
+ end
end
end
end

0 comments on commit 6704cfd

Please sign in to comment.