#!/usr/bin/env ruby # -*- coding: utf-8 -*- =begin Copyright (C) 2011-2014 Takashi SUGA You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive. =end require 'pp' require 'yaml' require 'fileutils' require 'net/https' HEADER = <
([^> ]+?)\.ymlyaml[code]['date'], 'time'=>yaml[code]['time'], 'datetime'=>yaml[code]['datetime']} end open("locales/locales/autoload.rb", 'w') do |script| script.puts HEADER yamls.each_key do |key| script.puts " autoload :Locale_%-8s 'when_exe/locales/%s'" % [key + ',', key] end script.puts " end" script.puts "end" end yamls.each_pair do |key, value| open("locales/locales/#{key}.rb", 'w') do |script| script.puts HEADER script.puts "\n # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/#{key.sub(/_/,'-')}.yml" script.puts "\n Locale_#{key} =" script.write(value.pretty_inspect) script.puts " end" script.puts "end" end end