Sha256: 91690264421ffa164a16e777724e7d6524a4c5c60f33d75cd6f0f0674a728fb9

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

Stored size: 537 Bytes

Contents

module Locomotive
  module Wagon
    module Liquid
      module Filters
        module Translate

          def translate(key, locale = nil)
            translation = @context.registers[:mounting_point].translations[key.to_s]

            if translation
              translation.get(locale) || translation.get(Locomotive::Mounter.locale.to_s)
            else
              "[unknown translation key: #{key}]"
            end
          end

        end

        ::Liquid::Template.register_filter(Translate)

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
locomotivecms_wagon-1.0.2 lib/locomotive/wagon/liquid/filters/translate.rb
locomotivecms_wagon-1.0.1 lib/locomotive/wagon/liquid/filters/translate.rb