Sha256: d1e520253d1f2b133ceec3a1842ef735bf0ebdce165aee2ac48f050566a8d214
Contents?: true
Size: 841 Bytes
Versions: 1
Compression:
Stored size: 841 Bytes
Contents
require 'v8' module EmberRailsI18n module Helper def self.output_locale(locale, translations = nil) locale_str = locale.to_s # load default translations translations ||= YAML::load(File.open("#{Rails.root}/config/locales/client.#{locale_str}.yml")) result = "I18n.translations = #{translations.to_json};\n" result << "I18n.locale = '#{locale_str}';\n" result << File.read("#{gempath}/lib/javascripts/moment.js") result << moment_locale(locale_str) result end def self.moment_locale(locale_str) filename = gempath + "/lib/javascripts/moment_locale/#{locale_str}.js" if File.exists?(filename) File.read(filename) << "\n" end || "" end def self.gempath File.expand_path(File.join(File.dirname(__FILE__), '../../')) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ember-rails-i18n-0.0.1 | lib/ember-rails-i18n/helper.rb |