Sha256: 1a981d143ff914733c2e53f5adc2ec20b7c9f704d850486105ae483db466ac6d

Contents?: true

Size: 1.09 KB

Versions: 13

Compression:

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

13 entries across 13 versions & 1 rubygems

Version Path
brainsome_typus-4.0.0.beta13 lib/typus/i18n.rb
brainsome_typus-4.0.0.beta12 lib/typus/i18n.rb
brainsome_typus-4.0.0.beta11 lib/typus/i18n.rb
brainsome_typus-4.0.0.beta10 lib/typus/i18n.rb
brainsome_typus-4.0.0.beta9 lib/typus/i18n.rb
brainsome_typus-4.0.0.beta8 lib/typus/i18n.rb
brainsome_typus-4.0.0.beta7 lib/typus/i18n.rb
brainsome_typus-4.0.0.beta6 lib/typus/i18n.rb
brainsome_typus-4.0.0.beta5 lib/typus/i18n.rb
brainsome_typus-4.0.0.beta4 lib/typus/i18n.rb
brainsome_typus-4.0.0.beta3 lib/typus/i18n.rb
brainsome_typus-4.0.0.beta2 lib/typus/i18n.rb
brainsome_typus-4.0.0.beta1 lib/typus/i18n.rb