Module: Isomorfeus

Defined in:
lib/isomorfeus/i18n/init.rb,
lib/isomorfeus/i18n/config.rb,
lib/isomorfeus/i18n/reducer.rb,
lib/isomorfeus/i18n/version.rb,
lib/isomorfeus/i18n/handler/locale_handler.rb

Defined Under Namespace

Modules: I18n

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.i18n_typeObject

Returns the value of attribute i18n_type.



4
5
6
# File 'lib/isomorfeus/i18n/config.rb', line 4

def i18n_type
  @i18n_type
end

Instance Method Details

#available_localesObject



7
8
9
10
# File 'lib/isomorfeus/i18n/config.rb', line 7

def available_locales
  result = Redux.fetch_by_path(:i18n_state, :available_locales)
  result ? result : ['en']
end

#available_locales=(locs_arr) ⇒ Object



45
46
47
48
# File 'lib/isomorfeus/i18n/config.rb', line 45

def available_locales=(locs_arr)
  FastGettext.available_locales = locs_arr
  @available_locales = locs_arr
end

#i18n_domainObject



12
13
14
15
# File 'lib/isomorfeus/i18n/config.rb', line 12

def i18n_domain
  result = Redux.fetch_by_path(:i18n_state, :domain)
  result ? result : 'app'
end

#i18n_domain=(domain) ⇒ Object



17
18
19
20
# File 'lib/isomorfeus/i18n/config.rb', line 17

def i18n_domain=(domain)
  Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { domain: domain })
  domain
end

#localeObject



22
23
24
25
# File 'lib/isomorfeus/i18n/config.rb', line 22

def locale
  result = Redux.fetch_by_path(:i18n_state, :locale)
  result ? result : available_locales.first
end

#locale=(loc) ⇒ Object



27
28
29
30
31
# File 'lib/isomorfeus/i18n/config.rb', line 27

def locale=(loc)
  Isomorfeus.raise_error(message: "Locale #{loc} not available!") unless available_locales.include?(loc)
  Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { locale: locale })
  loc
end

#locale_pathObject



69
70
71
# File 'lib/isomorfeus/i18n/config.rb', line 69

def locale_path
  @locale_path
end

#locale_path=(path) ⇒ Object



73
74
75
# File 'lib/isomorfeus/i18n/config.rb', line 73

def locale_path=(path)
  @locale_path = path
end

#negotiated_localeObject



33
34
35
# File 'lib/isomorfeus/i18n/config.rb', line 33

def negotiated_locale
  @negotiated_locale
end

#negotiated_locale=(l) ⇒ Object



37
38
39
# File 'lib/isomorfeus/i18n/config.rb', line 37

def negotiated_locale=(l)
  @negotiated_locale = l
end