i18n_routing 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ 0.4.1 (September 11, 2010)
2
+
3
+ * Fix a Rails3 bug for named routes and prefixed path
4
+
1
5
  0.4.0 (September 08, 2010)
2
6
 
3
7
  * Full support for Rails 3.0.0
@@ -290,7 +290,7 @@ module I18nRouting
290
290
  I18n.locale = locale
291
291
  ts = @path.gsub(/^\//, '')
292
292
  ts.gsub!('(.:format)', '')
293
- @localized_path = '/' + (I18nRouting.translation_for(ts, :named_routes_path) || ts)
293
+ @localized_path = (@scope[:path] || '/') + (!ts.blank? ? (I18nRouting.translation_for(ts, :named_routes_path) || ts) : '')
294
294
 
295
295
  # If a translated path exists, set localized infos
296
296
  if @localized_path and @localized_path != @path
@@ -16,10 +16,10 @@ describe :localized_routes do
16
16
 
17
17
  map.localized(I18n.available_locales, :verbose => false) do
18
18
  map.about 'about', :controller => 'about', :action => :show
19
-
19
+
20
20
  map.resources :users, :member => {:level => :get}, :collection => {:groups => :get}
21
21
  map.resource :contact
22
-
22
+
23
23
  map.resources :authors do |m|
24
24
  m.resources :books
25
25
  end
@@ -30,7 +30,7 @@ describe :localized_routes do
30
30
  mm.resources :bars
31
31
  end
32
32
  end
33
-
33
+
34
34
  map.resources :universes do |m|
35
35
  m.resources :galaxies do |mm|
36
36
  mm.resources :planets do |mmm|
@@ -38,7 +38,8 @@ describe :localized_routes do
38
38
  end
39
39
  end
40
40
  end
41
-
41
+
42
+ map.localized_root '/', :controller => "about", :action => "show", :path_prefix => ':locale'
42
43
  map.resources :drones, :path_prefix => 'doubledrones/unimatrix/zero'
43
44
  end
44
45
  end
@@ -60,6 +61,10 @@ describe :localized_routes do
60
61
  localized(I18n.available_locales, :verbose => false) do
61
62
  match 'about' => "about#show", :as => :about
62
63
 
64
+ scope '/:locale', :constraints => { :locale => /[a-z]{2}/ } do
65
+ match '/' => "about#show", :as => :localized_root
66
+ end
67
+
63
68
  resources :users do
64
69
  member do
65
70
  get :level
@@ -166,6 +171,10 @@ describe :localized_routes do
166
171
  before do
167
172
  I18n.locale = :fr
168
173
  end
174
+
175
+ it "scope with parameters should be respected" do
176
+ routes.send(:localized_root_path, I18n.locale).should == "/#{I18n.locale}"
177
+ end
169
178
 
170
179
  it "named_route generates route using localized values" do
171
180
  routes.send(:about_path).should == "/#{I18n.t :about, :scope => :named_routes_path}"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 0
9
- version: 0.4.0
8
+ - 1
9
+ version: 0.4.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Guillaume Luccisano
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-09 00:00:00 +02:00
17
+ date: 2010-09-11 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency