Sha256: 96f703a76b8c1e051bf2ee2802f43786372f1e46b0f7e7bddc50042570840216

Contents?: true

Size: 888 Bytes

Versions: 4

Compression:

Stored size: 888 Bytes

Contents

module Padrino
  module Helpers
    ##
    # Helpers related to locale i18n translation within templates.
    #
    module TranslationHelpers
      ##
      # Delegates to I18n.translate with no additional functionality.
      #
      # @param [Symbol] *args
      #   The keys to retrieve.
      #
      # @return [String]
      #  The translation for the specified keys.
      #
      def translate(*args)
        options = args.last.is_a?(Hash) ? args.pop : {}
        I18n.translate(*args, **options)
      end
      alias :t :translate

      ##
      # Delegates to I18n.localize with no additional functionality.
      #
      # @param [Symbol] *args
      #   The keys to retrieve.
      #
      # @return [String]
      #  The translation for the specified keys.
      #
      def localize(*args)
        I18n.localize(*args)
      end
      alias :l :localize
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
padrino-helpers-0.16.0.pre3 lib/padrino-helpers/translation_helpers.rb
padrino-helpers-0.16.0.pre2 lib/padrino-helpers/translation_helpers.rb
padrino-helpers-0.15.3 lib/padrino-helpers/translation_helpers.rb
padrino-helpers-0.15.2 lib/padrino-helpers/translation_helpers.rb