Sha256: e70c0ed948d21beed1fd251eb3e21ebc60c7904f3cd2300f3a1f50a2eccf413f

Contents?: true

Size: 984 Bytes

Versions: 26

Compression:

Stored size: 984 Bytes

Contents

module I18n
  module Backend
    class Simple
      # Monkey-patch-in localization debugging.. ( see: http://www.unixgods.org/~tilo/Rails/which_l10n_strings_is_rails_trying_to_lookup.html )
      # Enable with ENV['I18N_DEBUG']=1 on the command line in server startup, or ./config/environments/*.rb file.
      #
      def lookup(locale, key, scope = [], options = {})
        init_translations unless initialized?
        keys = I18n.normalize_keys(locale, key, scope, options[:separator])

        puts "I18N keys: #{keys}"  if ENV['I18N_DEBUG']

        keys.reduce(translations) do |result, _key|
          _key = _key.to_sym
          return nil unless result.is_a?(Hash) && result.key?(_key)
          result = result[_key]
          result = resolve(locale, _key, result, options.merge(scope: nil)) if result.is_a?(Symbol)

          puts "\t\t => " + result.to_s + "\n" if ENV['I18N_DEBUG'] && (result.class == String)

          result
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
gaku_core-0.3.0 config/initializers/i18n.rb
gaku_core-0.3.0.pre.4 config/initializers/i18n.rb
gaku_core-0.3.0.pre.3 config/initializers/i18n.rb
gaku_core-0.3.0.pre.2 config/initializers/i18n.rb
gaku_core-0.3.0.pre.1 config/initializers/i18n.rb
gaku_core-0.3.0.pre.0 config/initializers/i18n.rb
gaku-0.2.4 core/config/initializers/i18n.rb
gaku_core-0.2.4 config/initializers/i18n.rb
gaku-0.2.3 core/config/initializers/i18n.rb
gaku_core-0.2.3 config/initializers/i18n.rb
gaku-0.2.2 core/config/initializers/i18n.rb
gaku_core-0.2.2 config/initializers/i18n.rb
gaku-0.2.1 core/config/initializers/i18n.rb
gaku_core-0.2.1 config/initializers/i18n.rb
gaku-0.2.0 core/config/initializers/i18n.rb
gaku_core-0.2.0 config/initializers/i18n.rb
gaku-0.1.1 core/config/initializers/i18n.rb
gaku_core-0.1.1 config/initializers/i18n.rb
gaku-0.1.0 core/config/initializers/i18n.rb
gaku_core-0.1.0 config/initializers/i18n.rb