Sha256: d24f94df28c4f0ed6d5ad429643d89b55c1e3f4570538db6652a8997798aaa14

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

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

module Typus
  module I18n

    class << self

      # Instead of having to translate strings and defining a default
      # value to avoid "missing translation" messages:
      #
      #     I18n.t("Hello World!", :default => 'Hello World!')
      #
      # We define a Typus translation method which will set up a default
      # value for you: (Interpolation still works)
      #
      #     Typus::I18n.t("Hello World!")
      #     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

2 entries across 2 versions & 1 rubygems

Version Path
typus-3.1.10 lib/typus/i18n.rb
typus-3.1.9 lib/typus/i18n.rb