Module: Avm::Sources::Base::Locale

Defined in:
lib/avm/sources/base/locale.rb

Constant Summary collapse

LOCALE_KEY =
'locale'

Instance Method Summary collapse

Instance Method Details

#configured_localeObject



16
17
18
# File 'lib/avm/sources/base/locale.rb', line 16

def configured_locale
  configuration_entry(LOCALE_KEY).value
end

#default_localeObject



20
21
22
# File 'lib/avm/sources/base/locale.rb', line 20

def default_locale
  ::I18n.default_locale
end

#i18n_translate(entry_suffix, values = {}) ⇒ String

Parameters:

  • entry_suffix (String)
  • values (Hash) (defaults to: {})

Returns:

  • (String)


27
28
29
# File 'lib/avm/sources/base/locale.rb', line 27

def i18n_translate(entry_suffix, values = {})
  self.class.i18n_translate(entry_suffix, values.merge(__locale: locale))
end

#localeObject



12
13
14
# File 'lib/avm/sources/base/locale.rb', line 12

def locale
  configured_locale || default_locale
end