Module: Noticed::Translation
Instance Method Summary collapse
-
#i18n_scope ⇒ Object
Returns the
i18n_scope
for the class. - #scope_translation_key(key) ⇒ Object
- #translate(key, **options) ⇒ Object (also: #t)
Instance Method Details
#i18n_scope ⇒ Object
Returns the i18n_scope
for the class. Overwrite if you want custom lookup.
6 7 8 |
# File 'lib/noticed/translation.rb', line 6 def i18n_scope :notifications end |
#scope_translation_key(key) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/noticed/translation.rb', line 15 def scope_translation_key(key) if key.to_s.start_with?(".") "#{i18n_scope}.#{self.class.name.underscore}#{key}" else key end end |
#translate(key, **options) ⇒ Object Also known as: t
10 11 12 |
# File 'lib/noticed/translation.rb', line 10 def translate(key, **) I18n.translate(scope_translation_key(key), **) end |