Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Globalite4js
- require "yaml"
- wtf = [true, false]
- Dir.foreach("lang/ui") do |lang|
- if (lang.split('.').last == 'yml')
- yaml = YAML.load_file("lang/ui/"+lang)
- file = File.open("public/javascripts/lang/ui/"+lang.split('.')[0] + ".js", 'w')
- file.write("var globalite = {")
- i = 1
- yaml.each_pair do |key, value|
- key = key.to_s
- value = value.to_s
- if wtf.include?(key)
- yaml.delete(key)
- yaml[key] = value
- end
- yaml[key] = value if wtf.include?(value)
- yaml[key] = value.tr('{}', '%')
- (i == yaml.size) ? file.write("\"#{key}\" : \"#{value}\" }" ) : file.write("\"#{key}\" : \"#{value}\", \n" )
- i += 1
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment