Skip to content

Commit

Permalink
Remove initial locale from yml when converting to json and create a s…
Browse files Browse the repository at this point in the history
…eperate file for each locale in the file
  • Loading branch information
kevicency committed Jan 27, 2013
1 parent 599f8e4 commit 6704cfd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/guard/i18next.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6704cfd

Please sign in to comment.