Sha256: 9ad14879c2707a3af23676740e738d99b3c9d3f80ce2cc265de6d1a7fe4cd061

Contents?: true

Size: 582 Bytes

Versions: 7

Compression:

Stored size: 582 Bytes

Contents

# frozen_string_literal: true

module Archangel
  module Liquid
    module Tags
      ##
      # Locale custom tag for Liquid
      #
      # Example
      #   {% locale %} #=> "en"
      #
      class LocaleTag < ApplicationTag
        ##
        # Render the locale for the theme
        #
        # @param context [Object] the Liquid context
        # @return [String] the locale
        #
        def render(context)
          context.registers[:view].locale
        end
      end
    end
  end
end

::Liquid::Template.register_tag("locale", Archangel::Liquid::Tags::LocaleTag)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
archangel-0.0.8 lib/archangel/liquid/tags/locale_tag.rb
archangel-0.0.7 lib/archangel/liquid/tags/locale_tag.rb
archangel-0.0.6 lib/archangel/liquid/tags/locale_tag.rb
archangel-0.0.5 lib/archangel/liquid/tags/locale_tag.rb
archangel-0.0.4 lib/archangel/liquid/tags/locale_tag.rb
archangel-0.0.3 lib/archangel/liquid/tags/locale_tag.rb
archangel-0.0.2 lib/archangel/liquid/tags/locale_tag.rb