Sha256: 08aba9306aa0bb251a81eb2ee693c1da8953f2996c7331421eacd7c4fb042f1f

Contents?: true

Size: 667 Bytes

Versions: 11

Compression:

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

      def default_locale
        :en
      end

    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
typus-3.1.0.rc11 lib/typus/i18n.rb
typus-3.1.0.rc10 lib/typus/i18n.rb
typus-3.1.0.rc9 lib/typus/i18n.rb
typus-3.1.0.rc8 lib/typus/i18n.rb
typus-3.1.0.rc7 lib/typus/i18n.rb
typus-3.1.0.rc6 lib/typus/i18n.rb
typus-3.1.0.rc5 lib/typus/i18n.rb
typus-3.1.0.rc4 lib/typus/i18n.rb
typus-3.1.0.rc3 lib/typus/i18n.rb
typus-3.1.0.rc2 lib/typus/i18n.rb
typus-3.1.0.rc1 lib/typus/i18n.rb