Sha256: 78db8843e5e18af631f25d1155bed7d0894a78bbbcd0608ce94b7a658cdc4540
Contents?: true
Size: 642 Bytes
Versions: 3
Compression:
Stored size: 642 Bytes
Contents
namespace :vue do desc "Translate Rails' locale into Vue's locale" task :translate do Dir.foreach("config/locales/").each do |locale| next if File.extname(locale).strip.downcase != ".yml" config = YAML.load_file("config/locales/#{locale}") name = locale.to_s.split('.').first if locale.to_s.split('.') != nil if name != nil hash = Hash.new hash[name] = config[name] File.open("app/javascript/locales/#{name}.json", 'w') { |file| file.puts JSON.pretty_generate(hash) $stdout.puts "Created app/javascript/locales/#{name}.json" } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vueonrails-1.0.0.beta5 | lib/tasks/translate.rake |
vueonrails-1.0.0.beta3 | lib/tasks/translate.rake |
vueonrails-1.0.0.beta2 | lib/tasks/translate.rake |