svenfuchs/i18n — Issue #120: I18n.backend.translate error when default is empty
Author: vraravam
Created: 2011-11-10 10:59:39+00:00
State: open

Rails' ActionView::Helpers::NumberHelper methods (number_to_currency, number_to_percentage) call to its own number_with_precision - which in turn call i18n's I18n::Backend::Base.translate.
The calling example is:
```ruby
I18n.translate(:'number.format', :locale => options[:locale], :default => {})
```

As you can see, the last parameter is an empty hash. Tracing this into the I18n::Backend::Base.translate will result in:
```ruby
if options.empty?
entry = resolve(locale, key, entry, options)
else
count, default = options.values_at(:count, :default)
values = options.except(*RESERVED_KEYS)
# ************ START BUG FIX ************
entry = entry.nil? && default.present? && !default.empty? ?
# ************ END BUG FIX ************
# ************ START ORIGINAL CODE ************
# entry = entry.nil? && default ?
# ************ END ORIGINAL CODE ************
default(locale, key, default, options) : resolve(locale, key, entry, options)
end
```
The fix is in the above lines of code. Could you please include it in the next version?