i18n_routing 0.4.4 → 0.4.5

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.5 (November 04, 2010)
2
+
3
+ * Fixing Rails 3 scope bug with missing / and no translations
4
+
1
5
  0.4.4 (November 03, 2010)
2
6
 
3
7
  * Fix bug with locale with a dash like pt-br
@@ -296,10 +296,9 @@ module I18nRouting
296
296
  ts.gsub!('(.:format)', '')
297
297
 
298
298
  tp = @options[:as] && I18nRouting.translation_for(@options[:as], :named_routes) ||
299
- !ts.blank? && I18nRouting.translation_for(ts, :named_routes_path) || ''
300
-
299
+ !ts.blank? && I18nRouting.translation_for(ts, :named_routes_path) || ts
301
300
 
302
- @localized_path = (@scope[:path] || '/') + tp
301
+ @localized_path = File.join((@scope[:path] || ''), tp).gsub(/\/$/, '')
303
302
 
304
303
  # If a translated path exists, set localized infos
305
304
  if @localized_path and @localized_path != @path
@@ -40,7 +40,12 @@ describe :localized_routes do
40
40
  end
41
41
  end
42
42
 
43
- map.localized_root '/', :controller => "about", :action => "show", :path_prefix => ':locale'
43
+ map.with_options :path_prefix => ':locale' do |l|
44
+ l.localized_root '/', :controller => "about", :action => "show"
45
+ l.about_with_locale 'about', :controller => "about", :action => "show"
46
+ l.about_with_locale_with_sep 'about', :controller => "about", :action => "show"
47
+ end
48
+
44
49
  map.resources :drones, :path_prefix => 'doubledrones/unimatrix/zero'
45
50
  end
46
51
  end
@@ -65,6 +70,8 @@ describe :localized_routes do
65
70
 
66
71
  scope '/:locale', :constraints => { :locale => /[a-z]{2}/ } do
67
72
  match '/' => "about#show", :as => :localized_root
73
+ match 'about' => "about#show", :as => :about_with_locale
74
+ match '/about' => "about#show", :as => :about_with_locale_with_sep
68
75
  end
69
76
 
70
77
  resources :users do
@@ -167,6 +174,15 @@ describe :localized_routes do
167
174
  it "single resource should have by default the pluralized controller" do
168
175
  nested_routes[:foo].defaults[:controller].should == 'foos'
169
176
  end
177
+
178
+ it "scope with parameters should be respected" do
179
+ routes.send(:localized_root_path, I18n.locale).should == "/#{I18n.locale}"
180
+ end
181
+
182
+ it "scope with parameters should be respected when filled" do
183
+ routes.send(:about_with_locale_path, I18n.locale).should == "/#{I18n.locale}/about"
184
+ routes.send(:about_with_locale_with_sep_path, I18n.locale).should == "/#{I18n.locale}/about"
185
+ end
170
186
 
171
187
  end
172
188
 
@@ -180,6 +196,11 @@ describe :localized_routes do
180
196
  routes.send(:localized_root_path, I18n.locale).should == "/#{I18n.locale}"
181
197
  end
182
198
 
199
+ it "scope with parameters should be respected when filled" do
200
+ routes.send(:about_with_locale_path, I18n.locale).should == "/#{I18n.locale}/#{I18n.t :about, :scope => :named_routes_path}"
201
+ routes.send(:about_with_locale_with_sep_path, I18n.locale).should == "/#{I18n.locale}/#{I18n.t :about, :scope => :named_routes_path}"
202
+ end
203
+
183
204
  it "named_route generates route using localized values" do
184
205
  routes.send(:about_path).should == "/#{I18n.t :about, :scope => :named_routes_path}"
185
206
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 4
9
- version: 0.4.4
8
+ - 5
9
+ version: 0.4.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Guillaume Luccisano
@@ -14,13 +14,14 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-03 00:00:00 -07:00
17
+ date: 2010-11-04 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: i18n
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - ">"
26
27
  - !ruby/object:Gem::Version
@@ -64,6 +65,7 @@ rdoc_options: []
64
65
  require_paths:
65
66
  - lib
66
67
  required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
67
69
  requirements:
68
70
  - - ">="
69
71
  - !ruby/object:Gem::Version
@@ -71,6 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
73
  - 0
72
74
  version: "0"
73
75
  required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
74
77
  requirements:
75
78
  - - ">="
76
79
  - !ruby/object:Gem::Version
@@ -82,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
85
  requirements: []
83
86
 
84
87
  rubyforge_project: i18n_routing
85
- rubygems_version: 1.3.6
88
+ rubygems_version: 1.3.7
86
89
  signing_key:
87
90
  specification_version: 3
88
91
  summary: I18n routing module for Rails 2.3.x and Rails 3. Translate your routes with ease !