i18n_routing 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -0
- data/lib/i18n_routing_rails3.rb +8 -1
- data/spec/i18n_routing/i18n_spec.rb +8 -8
- metadata +7 -4
data/README.rdoc
CHANGED
@@ -6,6 +6,12 @@ All necessary informations are available on the wiki : http://wiki.github.com/kw
|
|
6
6
|
|
7
7
|
Works with Rails 2.3 and Rails3 !
|
8
8
|
|
9
|
+
== I18n gem version warning
|
10
|
+
|
11
|
+
Be careful when running Rails 2.3 with the shipped i18n gem: this is an old i18n version and i18_routing will install the latest i18n version as a gem.
|
12
|
+
This latest version may be incompatible with some old usages.
|
13
|
+
Furthermore, if the i18n gem is present on your system, Rails will load it and skip the shipped version; Keep that in mind.
|
14
|
+
|
9
15
|
== Contributors
|
10
16
|
|
11
17
|
* kwi (Guillaume Luccisano)
|
data/lib/i18n_routing_rails3.rb
CHANGED
@@ -136,6 +136,13 @@ module I18nRouting
|
|
136
136
|
# end
|
137
137
|
#
|
138
138
|
def localized(locales = I18n.available_locales, opts = {})
|
139
|
+
# Add if not added Rails.root/config/locales/*.yml in the I18n.load_path
|
140
|
+
if !@i18n_routing_path_set and defined?(Rails) and Rails.respond_to?(:root) and Rails.root
|
141
|
+
I18n.load_path = (I18n.load_path << Dir[Rails.root.join('config', 'locales', '*.yml')]).uniq
|
142
|
+
@i18n_routing_path_set = true
|
143
|
+
end
|
144
|
+
|
145
|
+
|
139
146
|
old_value = @locales
|
140
147
|
@locales = locales
|
141
148
|
@i18n_verbose ||= opts.delete(:verbose)
|
@@ -358,4 +365,4 @@ module I18nRouting
|
|
358
365
|
end
|
359
366
|
|
360
367
|
ActionDispatch::Routing::Mapper.send :include, I18nRouting::Mapper
|
361
|
-
Rack::Mount::Route.send :include, I18nRouting::RackMountRoute
|
368
|
+
Rack::Mount::Route.send :include, I18nRouting::RackMountRoute
|
@@ -2,11 +2,11 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe :localized_routes do
|
4
4
|
|
5
|
-
|
5
|
+
$r = nil # Global routes in order to speed up testing
|
6
6
|
|
7
7
|
before(:all) do
|
8
8
|
|
9
|
-
if
|
9
|
+
if !$r
|
10
10
|
if !rails3?
|
11
11
|
ActionController::Routing::Routes.clear!
|
12
12
|
ActionController::Routing::Routes.draw do |map|
|
@@ -34,7 +34,7 @@ describe :localized_routes do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
|
37
|
+
$r = ActionController::Routing::Routes
|
38
38
|
|
39
39
|
class UrlTester
|
40
40
|
include ActionController::UrlWriter
|
@@ -42,8 +42,8 @@ describe :localized_routes do
|
|
42
42
|
|
43
43
|
else
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
$r = ActionDispatch::Routing::RouteSet.new
|
46
|
+
$r.draw do
|
47
47
|
match 'not_about' => "not_about#show", :as => :not_about
|
48
48
|
resources :not_users
|
49
49
|
resource :not_contact
|
@@ -77,18 +77,18 @@ describe :localized_routes do
|
|
77
77
|
end
|
78
78
|
|
79
79
|
class UrlTester; end
|
80
|
-
UrlTester.send :include,
|
80
|
+
UrlTester.send :include, $r.url_helpers
|
81
81
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
end
|
86
86
|
|
87
|
-
let(:nested_routes) {
|
87
|
+
let(:nested_routes) { $r.named_routes.instance_eval { routes } }
|
88
88
|
let(:routes) { UrlTester.new }
|
89
89
|
|
90
90
|
def url_for(opts)
|
91
|
-
|
91
|
+
$r.generate_extras(opts).first
|
92
92
|
end
|
93
93
|
|
94
94
|
context "do not break existing behavior" do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 2
|
9
|
+
version: 0.3.2
|
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-
|
17
|
+
date: 2010-06-02 00:00:00 +02: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
|
@@ -63,6 +64,7 @@ rdoc_options: []
|
|
63
64
|
require_paths:
|
64
65
|
- lib
|
65
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
66
68
|
requirements:
|
67
69
|
- - ">="
|
68
70
|
- !ruby/object:Gem::Version
|
@@ -70,6 +72,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
72
|
- 0
|
71
73
|
version: "0"
|
72
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
73
76
|
requirements:
|
74
77
|
- - ">="
|
75
78
|
- !ruby/object:Gem::Version
|
@@ -81,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
84
|
requirements: []
|
82
85
|
|
83
86
|
rubyforge_project: i18n_routing
|
84
|
-
rubygems_version: 1.3.
|
87
|
+
rubygems_version: 1.3.7
|
85
88
|
signing_key:
|
86
89
|
specification_version: 3
|
87
90
|
summary: I18n routing module for Rails 2.3.x and Rails 3. Translate your routes with ease !
|