Module: Mova::Translator::Overridable
- Included in:
- Mova::Translator
- Defined in:
- lib/mova/translator.rb
Overview
Instance Method Summary collapse
-
#default(locales, keys, get_options) ⇒ String
Default value if no translation was found.
- #initialize(opts = {}) ⇒ Object
-
#keys_to_try(key) ⇒ Array<String, Symbol>
Keys that should be tried until non-empty translation would be found.
-
#locales_to_try(current_locale) ⇒ Array<String, Symbol>
Locales that should be tried until non-empty translation would be found.
Instance Method Details
#default(locales, keys, get_options) ⇒ String
Returns default value if no translation was found.
74 75 76 |
# File 'lib/mova/translator.rb', line 74 def default(locales, keys, ) EMPTY_TRANSLATION end |
#initialize(opts = {}) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/mova/translator.rb', line 23 def initialize(opts = {}) @storage = opts.fetch(:storage) do require "mova/storage/memory" Storage::Memory.new end end |
#keys_to_try(key) ⇒ Array<String, Symbol>
Returns keys that should be tried until non-empty translation would be found.
58 59 60 |
# File 'lib/mova/translator.rb', line 58 def keys_to_try(key) [key] end |
#locales_to_try(current_locale) ⇒ Array<String, Symbol>
Returns locales that should be tried until non-empty translation would be found.
42 43 44 |
# File 'lib/mova/translator.rb', line 42 def locales_to_try(current_locale) [current_locale] end |