Sha256: 7e0295d4ab4b2f926e346c137d083955fbf4dfa82c0b8aeeff3410d0c1610b22

Contents?: true

Size: 568 Bytes

Versions: 14

Compression:

Stored size: 568 Bytes

Contents

module Locomotive
  module Steam
    module Liquid
      module Filters

        module Translate

          def translate(input, options = nil, legacy_scope = nil)
            options ||= {}

            unless options.respond_to?(:values) # String
              options = { 'locale' => options, 'scope' => legacy_scope }
            end

            @context.registers[:services].translator.translate(input, options) || input
          end

          alias t translate

        end

        ::Liquid::Template.register_filter(Translate)

      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
locomotivecms_steam-1.8.0.alpha2 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.8.0.alpha1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.7.1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.7.0 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.6.1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.6.0 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.6.0.rc1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.6.0.beta1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.5.3 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.5.2 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.5.1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.5.0 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.5.0.rc1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.5.0.rc0 lib/locomotive/steam/liquid/filters/translate.rb