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.125 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.124 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.123 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.121 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.120 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.119 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.118 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.117 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.116 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.115 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.113 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.112 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.111 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.110 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.109 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.108 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.106 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.105 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.104 lib/core_extensions/i18n/always_cascade.rb
renalware-core-2.0.103 lib/core_extensions/i18n/always_cascade.rb