]> git.openstreetmap.org Git - rails.git/commitdiff
Make it easier to test alternative locales
authorTom Hughes <tom@compton.nu>
Fri, 26 Oct 2012 20:41:03 +0000 (21:41 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 26 Oct 2012 20:41:03 +0000 (21:41 +0100)
Allow a locale=xx parameter in the URL to select the locale.

app/controllers/application_controller.rb

index 8f9ae29481b8baeee5517deb1c5e80c6670c9eec..70a635404038efbc04beb0eb8231c85b90db644d 100644 (file)
@@ -278,7 +278,7 @@ class ApplicationController < ActionController::Base
       end
     end
 
-    I18n.locale = request.compatible_language_from(I18n.available_locales) || I18n.default_locale
+    I18n.locale = params[:locale] || request.compatible_language_from(I18n.available_locales) || I18n.default_locale
 
     response.headers['Content-Language'] = I18n.locale.to_s
   end