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/middleware.rb,
lib/isomorfeus/i18n/missing_keys.rb,
lib/isomorfeus/i18n/handler/locale_handler.rb

Defined Under Namespace

Modules: I18n

Class Attribute Summary collapse

Instance 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 Attribute Details

#current_localeObject

Returns the value of attribute current_locale.



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

def current_locale
  @current_locale
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



39
40
41
42
# File 'lib/isomorfeus/i18n/config.rb', line 39

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

#default_localeObject



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

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

#default_locale=(loc) ⇒ Object



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

def default_locale=(loc)
  Isomorfeus.raise_error(message: "Locale #{loc} not available as default locale!") unless available_locales.include?(loc)
  Isomorfeus.store.dispatch(type: 'I18N_LOAD', data: { locale: loc })
  loc
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

#locale_pathObject



75
76
77
# File 'lib/isomorfeus/i18n/config.rb', line 75

def locale_path
  @locale_path
end

#locale_path=(path) ⇒ Object



79
80
81
# File 'lib/isomorfeus/i18n/config.rb', line 79

def locale_path=(path)
  @locale_path = path
end