Sha256: 9d55b0ee929a15767522f6c163d7b4a4c4cfe48b844a1d8d04630cd5f6f08262

Contents?: true

Size: 631 Bytes

Versions: 35

Compression:

Stored size: 631 Bytes

Contents

# 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

35 entries across 35 versions & 1 rubygems

Version Path
renalware-core-2.0.16 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.15 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.14 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.13 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.12 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.11 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.9 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.8 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.7 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.5 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.4 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.3 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.2 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.1 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.0 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.0.pre.rc13 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.0.pre.rc11 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.0.pre.rc10 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.0.pre.rc9 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.0.pre.rc8 lib/core_extensions/i18n/always_cascade.rb