Sha256: 67a90d85f376725f85aef736ba915d8a07917ca0a415d7f97f15d7f3b762de0f

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

# -*- encoding: utf-8 -*-

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(key, options = {})
        options[:default] ||= key
        ::I18n.t(key, options)
      end

      def default_locale
        :en
      end

      def available_locales
        { "Brazilian Portuguese" => "pt-BR",
          "Català" => "ca",
          "German" => "de",
          "Greek"  => "el",
          "Italiano" => "it",
          "English" => "en",
          "Español" => "es",
          "Français" => "fr",
          "Magyar" => "hu",
          "Portuguese" => "pt-PT",
          "Russian" => "ru",
          "中文" => "zh-CN" }
      end

    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
typus-3.1.8 lib/typus/i18n.rb
typus-3.1.7 lib/typus/i18n.rb
typus-3.1.6 lib/typus/i18n.rb
typus-3.1.5 lib/typus/i18n.rb
typus-3.1.4 lib/typus/i18n.rb
typus-3.1.3 lib/typus/i18n.rb