Sha256: 83f4ca2cda141fd7b7124ff033e1af782ce2e134eedd3b85eaef0b735a4d3a71

Contents?: true

Size: 656 Bytes

Versions: 79

Compression:

Stored size: 656 Bytes

Contents

# frozen_string_literal: true

# Enables cascading I18n definitions
#
# Example:
#
# en:
#   welcome: Gidday!
#
# Without cascading:

# I18n.translate("greetings.welcome") # => "translation missing: en.greetings.welcome"
#
# With cascading:
#
# I18n.translate("greetings.welcome") # => "Gidday!"
#
# For more information:
# http://svenfuchs.com/2011/2/11/organizing-translations-with-i18n-cascade-and-i18n-missingtranslations
#
module CoreExtensions
  module I18n
    module AlwaysCascade
      def translate(key, options = {})
        super(key, options.merge(cascade: { offset: 2, skip_root: false }))
      end
      alias t translate
    end
  end
end

Version data entries

79 entries across 79 versions & 1 rubygems

Version Path
renalware-core-2.0.167 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.166 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.165 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.164 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.163 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.162 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.161 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.160 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.159 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.158 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.157 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.156 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.155 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.153 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.152 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.151 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.149 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.148 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.147 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.146 lib/core_extensions/i18n/always_cascade.rb