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...
1 parent 599f8e4 commit 68fab3203a824f3acc921989e5147e72cf3fd5a5 @kmees committed Jan 27, 2013
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 68fab32

Please sign in to comment.