diff options
| author | hukl <contact@smyck.org> | 2009-02-20 09:10:57 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-02-20 09:10:57 +0100 |
| commit | d579a7ce703773f236a1b7d7f0828a45427b5787 (patch) | |
| tree | d2feaadf606946d07a353f8772e2c8b37be96319 | |
| parent | f2fadda259d17046d55b0144fba4b44748ff4a93 (diff) | |
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
| -rw-r--r-- | app/helpers/admin_helper.rb | 4 | ||||
| -rw-r--r-- | 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 | |||
| 3 | def language_selector | 3 | def language_selector |
| 4 | case I18n.locale | 4 | case I18n.locale |
| 5 | when :de | 5 | when :de |
| 6 | link_to 'Deutsch', edit_node_path(@node, :locale => :en) | 6 | link_to 'English', url_for(:locale => :en) |
| 7 | when :en | 7 | when :en |
| 8 | link_to 'Deutsch', :locale => :de, :controller => params[:controller], :action => params[:action] | 8 | link_to 'Deutsch', url_for(:locale => :de) |
| 9 | end | 9 | end |
| 10 | end | 10 | end |
| 11 | end \ No newline at end of file | 11 | 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' | |||
| 3 | 3 | ||
| 4 | module RoutingFilter | 4 | module RoutingFilter |
| 5 | class Locale < Base | 5 | class Locale < Base |
| 6 | @@default_locale = :en | 6 | @@default_locale = :he |
| 7 | cattr_reader :default_locale | 7 | cattr_reader :default_locale |
| 8 | 8 | ||
| 9 | class << self | 9 | class << self |
| @@ -26,7 +26,9 @@ module RoutingFilter | |||
| 26 | locale = args.extract_options!.delete(:locale) || I18n.locale | 26 | locale = args.extract_options!.delete(:locale) || I18n.locale |
| 27 | returning yield do |result| | 27 | returning yield do |result| |
| 28 | if locale.to_sym != @@default_locale | 28 | if locale.to_sym != @@default_locale |
| 29 | result.sub!(%r(^(http.?://[^/]*)?(.*))){ "#{$1}/#{locale}#{$2}" } | 29 | if result.respond_to?(:sub) |
| 30 | result.sub!(%r(^(http.?://[^/]*)?(.*))){ "#{$1}/#{locale}#{$2}" } | ||
| 31 | end | ||
| 30 | end | 32 | end |
| 31 | end | 33 | end |
| 32 | end | 34 | end |
