Module: Netfira::WebConnect::Model::Record::Translations
- Defined in:
- lib/netfira/web_connect/model/record/translations.rb
Overview
This module is mixed into records that have translations.
Instance Method Summary collapse
-
#get_translated_string(key) ⇒ Object
Called when getting a translated string, e.g.
- #locale ⇒ Object
-
#set_translated_string(key, value) ⇒ Object
Called when assigning a translated string, e.g.
Instance Method Details
#get_translated_string(key) ⇒ Object
Called when getting a translated string, e.g. product.description
8 9 10 |
# File 'lib/netfira/web_connect/model/record/translations.rb', line 8 def get_translated_string(key) translated_string_for key end |
#locale ⇒ Object
21 22 23 |
# File 'lib/netfira/web_connect/model/record/translations.rb', line 21 def locale shop.locale end |
#set_translated_string(key, value) ⇒ Object
Called when assigning a translated string, e.g. product.description = ‘Stuff’
13 14 15 16 17 18 19 |
# File 'lib/netfira/web_connect/model/record/translations.rb', line 13 def set_translated_string(key, value) if Hash === value replace_translations_for key, value else translated_string_for(key)[nil] = value end end |