Module: StompBase::I18nHelper
- Included in:
- ApplicationController, ApplicationHelper
- Defined in:
- lib/stomp_base/i18n_helper.rb
Instance Method Summary collapse
- #available_locales ⇒ Object
- #current_locale ⇒ Object
- #locale_name(locale) ⇒ Object
- #t(key, options = {}) ⇒ Object
Instance Method Details
#available_locales ⇒ Object
13 14 15 |
# File 'lib/stomp_base/i18n_helper.rb', line 13 def available_locales StompBase.configuration.available_locales end |
#current_locale ⇒ Object
17 18 19 |
# File 'lib/stomp_base/i18n_helper.rb', line 17 def current_locale StompBase.locale end |
#locale_name(locale) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/stomp_base/i18n_helper.rb', line 21 def locale_name(locale) case locale.to_sym when :en "English" when :ja "日本語" else locale.to_s.capitalize end end |
#t(key, options = {}) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/stomp_base/i18n_helper.rb', line 5 def t(key, = {}) # For StompBase-specific translation keys, automatically add prefix key_string = key.to_s key = "stomp_base.#{key_string}" unless key_string.start_with?("stomp_base.") I18n.t(key, **, locale: StompBase.locale) end |