Sha256: d2d6553f38c2e2071ec44332d1b43b359524176bcda6b30ea030acda7362dc40

Contents?: true

Size: 562 Bytes

Versions: 6

Compression:

Stored size: 562 Bytes

Contents

require 'i18n'
require 'active_support/core_ext/array/extract_options'

module Spree
  class TranslationHelperWrapper # :nodoc:
    include ActionView::Helpers::TranslationHelper
  end

  class << self
    # Add spree namespace and delegate to Rails TranslationHelper for some nice
    # extra functionality. e.g return reasonable strings for missing translations
    def translate(key, options = {})
      options[:scope] = [:spree, *options[:scope]]
      TranslationHelperWrapper.new.translate(key, options)
    end

    alias_method :t, :translate
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
solidus_core-1.3.2 lib/spree/i18n.rb
solidus_core-1.3.1 lib/spree/i18n.rb
solidus_core-1.3.0 lib/spree/i18n.rb
solidus_core-1.3.0.rc2 lib/spree/i18n.rb
solidus_core-1.3.0.rc1 lib/spree/i18n.rb
solidus_core-1.3.0.beta1 lib/spree/i18n.rb