Sha256: 43338ac62ae7a6e0eb665598ea85387ac57509e59939d562c9cb2019fcbb13a3

Contents?: true

Size: 534 Bytes

Versions: 8

Compression:

Stored size: 534 Bytes

Contents

module Locomotive
  module Builder
    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)
            else
              "[unknown translation key: #{key}]"
            end
          end

        end

        ::Liquid::Template.register_filter(Translate)

      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
locomotivecms_builder-1.0.0.alpha8 lib/locomotive/builder/liquid/filters/translate.rb
locomotivecms_builder-1.0.0.alpha7 lib/locomotive/builder/liquid/filters/translate.rb
locomotivecms_builder-1.0.0.alpha6 lib/locomotive/builder/liquid/filters/translate.rb
locomotivecms_builder-1.0.0.alpha5 lib/locomotive/builder/liquid/filters/translate.rb
locomotivecms_builder-1.0.0.alpha4 lib/locomotive/builder/liquid/filters/translate.rb
locomotivecms_builder-1.0.0.alpha3 lib/locomotive/builder/liquid/filters/translate.rb
locomotivecms_builder-1.0.0.alpha2 lib/locomotive/builder/liquid/filters/translate.rb
locomotivecms_builder-1.0.0.alpha1 lib/locomotive/builder/liquid/filters/translate.rb