summaryrefslogtreecommitdiff
path: root/vendor/plugins
diff options
context:
space:
mode:
authorCharlie Root <root@web.ccc.local>2025-01-28 22:47:15 +0100
committerCharlie Root <root@web.ccc.local>2025-01-28 22:47:15 +0100
commitc4296b59a7f9d667d295f9c37b71f7849b818fb3 (patch)
treeccbace3a183c075991a0dfeb1dd9e6f25e901cf3 /vendor/plugins
parentdfbaadf0210b02a8bb54380c2c50302413dcf6d6 (diff)
Big overhaul patch and style changes
Diffstat (limited to 'vendor/plugins')
-rw-r--r--vendor/plugins/routing-filter/lib/routing_filter/locale.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/vendor/plugins/routing-filter/lib/routing_filter/locale.rb b/vendor/plugins/routing-filter/lib/routing_filter/locale.rb
index 6fc3e11..7c86a40 100644
--- a/vendor/plugins/routing-filter/lib/routing_filter/locale.rb
+++ b/vendor/plugins/routing-filter/lib/routing_filter/locale.rb
@@ -17,14 +17,14 @@ module RoutingFilter
17 def around_recognize(path, env, &block) 17 def around_recognize(path, env, &block)
18 locale = nil 18 locale = nil
19 path.sub! %r(^/([a-zA-Z]{2})(?=/|$)) do locale = $1; '' end 19 path.sub! %r(^/([a-zA-Z]{2})(?=/|$)) do locale = $1; '' end
20 returning yield do |params| 20 yield.tap do |params|
21 params[:locale] = locale if locale 21 params[:locale] = locale if locale
22 end 22 end
23 end 23 end
24 24
25 def around_generate(*args, &block) 25 def around_generate(*args, &block)
26 locale = args.extract_options!.delete(:locale) || I18n.locale 26 locale = args.extract_options!.delete(:locale) || I18n.locale
27 returning yield do |result| 27 yield.tap do |result|
28 if locale.to_sym != @@default_locale 28 if locale.to_sym != @@default_locale
29 target = result.is_a?(Array) ? result.first : result 29 target = result.is_a?(Array) ? result.first : result
30 target.sub!(%r(^(http.?://[^/]*)?(.*))){ "#{$1}/#{locale}#{$2}" } 30 target.sub!(%r(^(http.?://[^/]*)?(.*))){ "#{$1}/#{locale}#{$2}" }
@@ -32,4 +32,4 @@ module RoutingFilter
32 end 32 end
33 end 33 end
34 end 34 end
35end \ No newline at end of file 35end