Module: I18nNamespace::I18n::ClassMethods
- Defined in:
- lib/i18n_namespace/config.rb
Instance Method Summary collapse
- #namespace ⇒ Object
- #namespace=(ns) ⇒ Object
- #store_resolved_translation(locale, key, value, options = {}) ⇒ Object
Instance Method Details
#namespace ⇒ Object
12 13 14 |
# File 'lib/i18n_namespace/config.rb', line 12 def namespace config.namespace end |
#namespace=(ns) ⇒ Object
16 17 18 19 |
# File 'lib/i18n_namespace/config.rb', line 16 def namespace=(ns) raise "Namespace contains unsupported objects. Allowed are: String, Symbol, Array[Symbol, String] or NilClass. Inspection: #{ns.inspect}" unless valid_namespace?(ns) config.namespace = ns end |
#store_resolved_translation(locale, key, value, options = {}) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/i18n_namespace/config.rb', line 21 def store_resolved_translation(locale, key, value, = {}) raise "Key has to be a String" unless key.is_a? String raise "Value has to be a String or NilClass" if !value.is_a?(String) && !value.is_a?(NilClass) resolved = key.split('.').reverse.inject(value) {|a, n| {n => a}} backend.store_translations locale, resolved, end |