Module: Translation
- Extended by:
- ActiveSupport::Concern
- Included in:
- Noticed::Base
- Defined in:
- lib/noticed/translation.rb
Instance Method Summary collapse
-
#i18n_scope ⇒ Object
Returns the
i18n_scopefor 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.
5 6 7 |
# File 'lib/noticed/translation.rb', line 5 def i18n_scope :notifications end |
#scope_translation_key(key) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/noticed/translation.rb', line 14 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
9 10 11 |
# File 'lib/noticed/translation.rb', line 9 def translate(key, **) I18n.translate(scope_translation_key(key), **) end |