fnando/i18n-js — pull request #221 by Deradon (2014-06-11 14:36:34+00:00)
Title: Fix using multi-star scope with top-level translation key

Given the following locales.yml

:en
foo: 'Foo'

and the following scope: "*.*.formats"

this error is raised:

Failures:

1) I18n::JS filters filters translations using multi-star scope
Failure/Error: result = I18n::JS.scoped_translations("*.*.formats")
NoMethodError:
undefined method `has_key?' for "Foo":String
# ./lib/i18n/js.rb:134:in `filter'
# ./lib/i18n/js.rb:130:in `block in filter'
# ./lib/i18n/js.rb:127:in `each'
# ./lib/i18n/js.rb:127:in
# `filter'
# ./lib/i18n/js.rb:130:in
# `block in filter'
# ./lib/i18n/js.rb:127:in `each'
# ./lib/i18n/js.rb:127:in
# `filter'
# ./lib/i18n/js.rb:113:in `block in scoped_translations'
# ./lib/i18n/js.rb:112:in
# `each'
# ./lib/i18n/js.rb:112:in `scoped_translations'
# ./spec/i18n_js_spec.rb:82:in
# `block (3 levels) in ''`

This commit will fix it by type-checking.