diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/alaveteli_localization.rb | 1 | ||||
-rw-r--r-- | lib/routing_filters.rb | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/alaveteli_localization.rb b/lib/alaveteli_localization.rb index 6daab124a..2b6978c92 100644 --- a/lib/alaveteli_localization.rb +++ b/lib/alaveteli_localization.rb @@ -7,6 +7,7 @@ class AlaveteliLocalization I18n.locale = default_locale I18n.available_locales = available_locales.map { |locale_name| locale_name.to_sym } I18n.default_locale = default_locale + RoutingFilter::Conditionallyprependlocale.locales = available_locales end def set_default_text_domain(name, path) diff --git a/lib/routing_filters.rb b/lib/routing_filters.rb index a9a62b8db..5b5da6870 100644 --- a/lib/routing_filters.rb +++ b/lib/routing_filters.rb @@ -22,5 +22,13 @@ module RoutingFilter prepend_segment!(result, locale) if prepend_locale?(locale) end end + + # Reset the locale pattern when the locales are set. + class << self + def locales=(locales) + @@locales_pattern = nil + @@locales = locales.map(&:to_sym) + end + end end end |