Sha256: baa5f6edba87bc5ea4d39a71667c964359050531a58a5beedfedc4b2d6b0fa80

Contents?: true

Size: 621 Bytes

Versions: 4

Compression:

Stored size: 621 Bytes

Contents

module Typus

  module I18n

    class << self

      ##
      # Instead of having to translate strings and defining a default value:
      #
      #     Typus::I18n.t("Hello World!", :default => 'Hello World!')
      #
      # We define this method to define the value only once:
      #
      #     Typus::I18n.t("Hello World!")
      #
      # Note that interpolation still works:
      #
      #     Typus::I18n.t("Hello %{world}!", :world => @world)
      #
      def t(msg, *args)
        options = args.extract_options!
        options[:default] = msg
        ::I18n.t(msg, options)
      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
typus-3.0.7 lib/typus/i18n.rb
typus-3.0.6 lib/typus/i18n.rb
typus-3.0.5 lib/typus/i18n.rb
typus-3.0.4 lib/typus/i18n.rb