Sha256: 6c53e61a137a18ca2a88db15a146efeaab63d30289ae3760ee15da1c59efcf36

Contents?: true

Size: 539 Bytes

Versions: 26

Compression:

Stored size: 539 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

        end

        ::Liquid::Template.register_filter(Translate)

      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
locomotivecms_steam-1.5.0.beta3 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.5.0.beta2 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.5.0.beta1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.4.1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.4.0 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.4.0.rc2 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.4.0.rc1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.4.0.pre.rc.1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.3.0 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.3.0.rc2 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.1.2 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.2.1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.3.0.rc1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.2.0 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.2.0.rc3 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.2.0.rc2 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.2.0.rc1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.2.0.beta1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.1.1 lib/locomotive/steam/liquid/filters/translate.rb
locomotivecms_steam-1.1.0 lib/locomotive/steam/liquid/filters/translate.rb