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
-
.i18n_type ⇒ Object
Returns the value of attribute i18n_type.
Instance Method Summary collapse
- #available_locales ⇒ Object
- #available_locales=(locs_arr) ⇒ Object
- #i18n_domain ⇒ Object
- #i18n_domain=(domain) ⇒ Object
- #locale ⇒ Object
- #locale=(loc) ⇒ Object
- #locale_path ⇒ Object
- #locale_path=(path) ⇒ Object
- #negotiated_locale ⇒ Object
- #negotiated_locale=(l) ⇒ Object
Class Attribute Details
.i18n_type ⇒ Object
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_locales ⇒ Object
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_domain ⇒ Object
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 ⇒ Object
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_path ⇒ Object
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_locale ⇒ Object
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 |