Sha256: e4379fa92541dd108d35a51b1e0c616194742b628411b82242e26f64cf97c5b5
Contents?: true
Size: 748 Bytes
Versions: 4
Compression:
Stored size: 748 Bytes
Contents
module I18n module Js class StaticAssetRenderer def self.json_for_locale(current_locale) translations = I18n::Js::Translator.new(I18n::Js.config[:only]).translations default_locale = Rails.application.config.i18n.default_locale scoped_translation = translations.select { |locale, value| [nil, locale.to_s].include?(current_locale) } scoped_translation = { current_locale.to_sym => translations[default_locale.to_sym].deep_merge(scoped_translation[current_locale.to_sym])} unless current_locale.nil? || current_locale == default_locale scoped_translation.to_json end def self.extract_locale_from_filename(filename) filename[/translation\-(\w*)/, 1] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems