localyzed 0.0.1.5 → 0.0.1.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,8 @@ class ActionController::Base
|
|
22
22
|
# if !request.xhr then non ajax request then ensure the path is localized (/^(en|fr)\/.*/)
|
23
23
|
def redirect_to_localized_path_if
|
24
24
|
@translatable = true # used to display or hide the languages menu
|
25
|
-
|
25
|
+
# Rails.env != test to make controller specs pass if locale is defined but path is not well written
|
26
|
+
if ( !request.xhr? && ( ( !request.path.match(/\/(en|fr)(\/|$)/) && Rails.env != 'test' ) || params[:locale] != I18n.locale.to_s) && request.method == 'GET')
|
26
27
|
flash.keep
|
27
28
|
redirect_to(url_for(params.merge(:locale => I18n.locale.to_s, :from_l => (params[:locale] if params[:locale]))), :status => :moved_permanently)
|
28
29
|
end
|
data/lib/localyzed/version.rb
CHANGED