diff --git a/lib/lit/cache.rb b/lib/lit/cache.rb index 6c034100..eddd40dc 100644 --- a/lib/lit/cache.rb +++ b/lib/lit/cache.rb @@ -253,7 +253,7 @@ def parse_value(v, locale) where(localization_key_id: lk.id).first new_value = loca.get_value if loca && loca.get_value.present? end - when String then + when String, Numeric, TrueClass, FalseClass then new_value = v when Hash then new_value = nil diff --git a/lib/lit/i18n_backend.rb b/lib/lit/i18n_backend.rb index a9056a07..ed3f3b2b 100644 --- a/lib/lit/i18n_backend.rb +++ b/lib/lit/i18n_backend.rb @@ -90,12 +90,16 @@ def store_item(locale, data, scope = [], unless_changed = false) store_item(locale, value, scope + [key], unless_changed) end # end - elsif data.respond_to?(:to_str) - key = ([locale] + scope).join('.') - @cache.update_locale(key, data, false, unless_changed) - elsif data.nil? + else key = ([locale] + scope).join('.') - @cache.delete_locale(key, unless_changed) + if data.nil? + key = ([locale] + scope).join('.') + @cache.delete_locale(key, unless_changed) + elsif data.is_a?(Array) + @cache.update_locale(key, data, true, unless_changed) + else + @cache.update_locale(key, data, false, unless_changed) + end end end