Extract hardcoded lists to Redo::RestaurantsList

This commit is contained in:
Juan Barreneche
2013-03-14 18:02:20 -03:00
parent 3d4d7420ae
commit ce755697fc
3 changed files with 21 additions and 1 deletions

View File

@@ -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 "[]".

View File

@@ -44,7 +44,13 @@ module ActionView
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 }

View File

@@ -19,4 +19,13 @@ class LocalizedTemplatesTest < ActionController::TestCase
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