Permalink
Browse files

Merge pull request #97 from nledez/master

Fix to close issue rails/rails#1499 i18n with key/value backend
  • Loading branch information...
2 parents dece3da + e2b0fe4 commit cd5ad8a14e5b647e10ca6cc9d4194fc9cb700ac0 @tigrish tigrish committed Jul 5, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/i18n/backend/key_value.rb
@@ -73,7 +73,7 @@ def store_translations(locale, data, options = {})
raise "Key-value stores cannot handle procs"
end
- @store[key] = ActiveSupport::JSON.encode(value) unless value.is_a?(Symbol)
+ @store[key] = ActiveSupport::JSON.encode([value]) unless value.is_a?(Symbol)
end
end
@@ -90,7 +90,7 @@ def available_locales
def lookup(locale, key, scope = [], options = {})
key = normalize_flat_keys(locale, key, scope, options[:separator])
value = @store["#{locale}.#{key}"]
- value = ActiveSupport::JSON.decode(value) if value
+ value = ActiveSupport::JSON.decode(value)[0] if value
value.is_a?(Hash) ? value.deep_symbolize_keys : value
end
end

0 comments on commit cd5ad8a

Please sign in to comment.