From c4296b59a7f9d667d295f9c37b71f7849b818fb3 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Tue, 28 Jan 2025 22:47:15 +0100 Subject: Big overhaul patch and style changes --- vendor/plugins/routing-filter/lib/routing_filter/locale.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'vendor/plugins') 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 def around_recognize(path, env, &block) locale = nil path.sub! %r(^/([a-zA-Z]{2})(?=/|$)) do locale = $1; '' end - returning yield do |params| + yield.tap do |params| params[:locale] = locale if locale end end def around_generate(*args, &block) locale = args.extract_options!.delete(:locale) || I18n.locale - returning yield do |result| + yield.tap do |result| if locale.to_sym != @@default_locale target = result.is_a?(Array) ? result.first : result target.sub!(%r(^(http.?://[^/]*)?(.*))){ "#{$1}/#{locale}#{$2}" } @@ -32,4 +32,4 @@ module RoutingFilter end end end -end \ No newline at end of file +end -- cgit v1.3