localyzed 0.0.2.8 → 0.0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
|
|
1
1
|
module LocalizedController
|
2
|
+
def self.included(base)
|
3
|
+
base.send :before_filter :set_locale
|
4
|
+
# redirects_to localized path if path not loaclized and request not ajax or api
|
5
|
+
base.send :before_filter, :redirect_to_localized_path_if
|
6
|
+
end
|
2
7
|
|
3
8
|
def url_options
|
4
9
|
{:locale => I18n.locale.to_s}.merge(super)
|
5
10
|
end
|
6
11
|
|
7
|
-
before_filter :set_locale
|
8
|
-
|
9
|
-
# redirects_to localized path if path not loaclized and request not ajax or api
|
10
|
-
before_filter :redirect_to_localized_path_if
|
11
|
-
|
12
12
|
# sets the locale by checking user data then request param then session data then retrieving accept language data
|
13
13
|
def set_locale
|
14
14
|
if user_signed_in? and cl = (current_user.respond_to?(:language) ? current_user.language : 'en') and I18n.available_locales.include?(cl)
|
data/lib/localyzed/version.rb
CHANGED