Skip to content

Commit

Permalink
Merge pull request #97 from nledez/master
Browse files Browse the repository at this point in the history
Fix to close issue rails/rails#1499 i18n with key/value backend
  • Loading branch information
tigrish committed Jul 5, 2012
2 parents dece3da + e2b0fe4 commit cd5ad8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/i18n/backend/key_value.rb
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit cd5ad8a

Please sign in to comment.