Sha256: cca04dff0b5bdc11a3ee7e2a5bf6340de35c046f587f0e98294b36c3e18adb74

Contents?: true

Size: 619 Bytes

Versions: 10

Compression:

Stored size: 619 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

10 entries across 10 versions & 1 rubygems

Version Path
typus-3.0.12 lib/typus/i18n.rb
typus-3.0.11 lib/typus/i18n.rb
typus-3.0.11.rc5 lib/typus/i18n.rb
typus-3.0.11.rc4 lib/typus/i18n.rb
typus-3.0.11.rc3 lib/typus/i18n.rb
typus-3.0.11.rc2 lib/typus/i18n.rb
typus-3.0.11.rc1 lib/typus/i18n.rb
typus-3.0.10 lib/typus/i18n.rb
typus-3.0.9 lib/typus/i18n.rb
typus-3.0.8 lib/typus/i18n.rb