Sha256: 1fddd00b291d351c5378028caaf663af62bc2b0fc6401d8035ec73e614b9ec55

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

# Encoding: UTF-8 <-- required, please leave this in.
require 'refinerycms-core'
require 'routing-filter'

module Refinery
  autoload :I18nGenerator, 'generators/refinery/i18n_generator'

  module I18n
    class << self
      attr_accessor :built_in_locales

      def built_in_locales
        @built_in_locales ||= {
          :en => 'English',
          :fr => 'Français',
          :nl => 'Nederlands',
          :'pt-BR' => 'Português',
          :da => 'Dansk',
          :nb => 'Norsk Bokmål',
          :sl => 'Slovenian',
          :es => 'Español',
          :it => 'Italiano',
          :de => 'Deutsch',
          :lv => 'Latviski',
          :ru => 'Русский',
          :sv => 'Svenska',
          :pl => 'Polski',
          :'zh-CN' => 'Simplified Chinese',
          :'zh-TW' => 'Traditional Chinese',
          :el => 'Ελληνικά',
          :rs => 'Srpski',
          :cs => 'Česky',
          :sk => 'Slovenský',
          :ja => '日本語',
          :bg => 'Български'
        }
      end

      def current_frontend_locale
        if Globalize.locale.present? && Globalize.locale.to_s != config.default_frontend_locale.to_s
          Globalize.locale
        elsif config.default_frontend_locale.present?
          config.default_frontend_locale
        else
          ::I18n.locale
        end
      end

      def enabled?
        config.enabled
      end

      def has_locale?(locale)
        config.locales.has_key?(locale.try(:to_sym))
      end
    end

    require 'refinery/i18n/engine'
    require 'refinery/i18n/configuration'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
refinerycms-i18n-2.0.2 lib/refinery/i18n.rb
refinerycms-i18n-2.0.0 lib/refinery/i18n.rb