Module: Refinery::I18n

Includes:
ActiveSupport::Configurable
Defined in:
lib/refinery/i18n.rb,
lib/refinery/i18n/engine.rb,
lib/refinery/i18n/configuration.rb

Defined Under Namespace

Classes: Engine

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.built_in_localesObject

Returns the value of attribute built_in_locales



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/refinery/i18n.rb', line 10

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

Class Method Details

.current_frontend_localeObject



39
40
41
42
43
44
45
46
47
# File 'lib/refinery/i18n.rb', line 39

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

.enabled?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/refinery/i18n.rb', line 49

def enabled?
  config.enabled
end

.has_locale?(locale) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/refinery/i18n.rb', line 53

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