Permalink
Browse files

Extract hardcoded lists to Redo::RestaurantsList

  • Loading branch information...
1 parent 3d4d742 commit ce755697fc926b7fa5c783a27ca814574045c961 @jbarreneche committed Mar 14, 2013
View
@@ -1,5 +1,10 @@
## unreleased ##
+* Include I18n locale fallbacks in view lookup.
+ Fixes GH#3512.
+
+ *Juan Barreneche*
+
* Fix incorrectly appended square brackets to a multiple select box
if an explicit name has been given and it already ends with "[]".
@@ -44,7 +44,13 @@ def initialize_details(details)
module Accessors #:nodoc:
end
- register_detail(:locale) { [I18n.locale, I18n.default_locale].uniq }
+ register_detail(:locale) do
+ locales = [I18n.locale]
+ locales.concat(I18n.fallbacks[I18n.locale]) if I18n.respond_to? :fallbacks
+ locales << I18n.default_locale
+ locales.uniq!
+ locales
+ end
register_detail(:formats) { Mime::SET.symbols }
register_detail(:handlers){ Template::Handlers.extensions }
@@ -19,4 +19,13 @@ def test_default_locale_template_is_used_when_locale_is_missing
get :hello_world
assert_equal "Hello World", @response.body
end
+
+ def test_use_fallback_locales
+ I18n.locale = :"de-AT"
+ I18n.backend.class.send(:include, I18n::Backend::Fallbacks)
+ I18n.fallbacks[:"de-AT"] = [:de]
+
+ get :hello_world
+ assert_equal "Gutten Tag", @response.body
+ end
end

0 comments on commit ce75569

Please sign in to comment.