From d579a7ce703773f236a1b7d7f0828a45427b5787 Mon Sep 17 00:00:00 2001 From: hukl Date: Fri, 20 Feb 2009 09:10:57 +0100 Subject: fix for routing filter and helpers, need to talk to svenfuchs about that ;) hardcoded default_locale within the plugin and not considering globbed routes as it seems --- app/helpers/admin_helper.rb | 4 ++-- vendor/plugins/routing-filter/lib/routing_filter/locale.rb | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 7122584..c230797 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -3,9 +3,9 @@ module AdminHelper def language_selector case I18n.locale when :de - link_to 'Deutsch', edit_node_path(@node, :locale => :en) + link_to 'English', url_for(:locale => :en) when :en - link_to 'Deutsch', :locale => :de, :controller => params[:controller], :action => params[:action] + link_to 'Deutsch', url_for(:locale => :de) end end end \ No newline at end of file diff --git a/vendor/plugins/routing-filter/lib/routing_filter/locale.rb b/vendor/plugins/routing-filter/lib/routing_filter/locale.rb index b7fcc31..0aa6adc 100644 --- a/vendor/plugins/routing-filter/lib/routing_filter/locale.rb +++ b/vendor/plugins/routing-filter/lib/routing_filter/locale.rb @@ -3,7 +3,7 @@ require 'routing_filter/base' module RoutingFilter class Locale < Base - @@default_locale = :en + @@default_locale = :he cattr_reader :default_locale class << self @@ -26,7 +26,9 @@ module RoutingFilter locale = args.extract_options!.delete(:locale) || I18n.locale returning yield do |result| if locale.to_sym != @@default_locale - result.sub!(%r(^(http.?://[^/]*)?(.*))){ "#{$1}/#{locale}#{$2}" } + if result.respond_to?(:sub) + result.sub!(%r(^(http.?://[^/]*)?(.*))){ "#{$1}/#{locale}#{$2}" } + end end end end -- cgit v1.3