translate_routes 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +19 -17
- data/lib/translate_routes.rb +1 -0
- metadata +4 -3
data/README.markdown
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
TranslateRoutes
|
1
|
+
TranslateRoutes
|
2
2
|
===============
|
3
3
|
|
4
4
|
This branch works with Rails 3.x, you can find branches for Rails [2.1.x](http://github.com/raul/translate_routes/tree/rails2.1), [2.2.x](http://github.com/raul/translate_routes/tree/rails2.2) and [2.3.x](http://github.com/raul/translate_routes/tree/rails2.3)
|
5
5
|
|
6
|
-
This Rails plugin provides a simple way to translate your URLs to any number of languages, even on a fully working application.
|
6
|
+
This Rails plugin provides a simple way to translate your URLs to any number of languages, even on a fully working application.
|
7
7
|
|
8
|
-
It works fine with all kind of routing definitions, including RESTful and named routes.
|
8
|
+
It works fine with all kind of routing definitions, including RESTful and named routes.
|
9
9
|
**Your current code will remain untouched**: your current routing code, helpers and links will be translated transparently - even in your tests.
|
10
10
|
(Un)installing it is a very clean and simple process, so why don't you give it a chance? ;)
|
11
11
|
|
@@ -29,11 +29,11 @@ Let's start with a tiny example. Of course you need to define your routes first,
|
|
29
29
|
3) Append a line to your routes.rb file to activate the translations. If you loaded the translations file with
|
30
30
|
your other I18n translations files, the line will be:
|
31
31
|
|
32
|
-
|
33
|
-
|
32
|
+
ActionDispatch::Routing::Translator.i18n('es')
|
33
|
+
|
34
34
|
and if you want to keep the file separated (e.g: config/i18n-routes.yml), the line to append is:
|
35
35
|
|
36
|
-
|
36
|
+
ActionDispatch::Routing::Translator.translate_from_file('config','i18n-routes.yml')
|
37
37
|
|
38
38
|
You can see it working by executing `rake routes` on the shell:
|
39
39
|
|
@@ -48,17 +48,17 @@ As we can see, a new spanish route has been setted up and a `locale` parameter h
|
|
48
48
|
|
49
49
|
before_filter :set_locale_from_url
|
50
50
|
|
51
|
-
Now your application recognizes the different routes and sets the `I18n.locale` value on your controllers,
|
52
|
-
but what about the routes generation? As you can see on the previous `rake routes` execution, the
|
53
|
-
`contact_es_es_path` and `contact_en_us_path` routing helpers have been generated and are
|
54
|
-
available in your controllers and views. Additionally, a `contact_path` helper has been generated, which
|
55
|
-
generates the routes according to the current request's locale. This way your link
|
51
|
+
Now your application recognizes the different routes and sets the `I18n.locale` value on your controllers,
|
52
|
+
but what about the routes generation? As you can see on the previous `rake routes` execution, the
|
53
|
+
`contact_es_es_path` and `contact_en_us_path` routing helpers have been generated and are
|
54
|
+
available in your controllers and views. Additionally, a `contact_path` helper has been generated, which
|
55
|
+
generates the routes according to the current request's locale. This way your link
|
56
56
|
|
57
57
|
This means that if you use named routes **you don't need to modify your application links** because the routing helpers are automatically adapted to the current locale.
|
58
58
|
|
59
59
|
5) Hey, but what about my tests?
|
60
60
|
|
61
|
-
Of course, your functional and integration testing involves some requests.
|
61
|
+
Of course, your functional and integration testing involves some requests.
|
62
62
|
The plugin includes some code to add a default locale parameter so they can remain untouched.
|
63
63
|
Append it to your `test_helper` and it will be applied.
|
64
64
|
|
@@ -73,8 +73,8 @@ Feedback, questions and comments will be always welcome at raul@murciano.net
|
|
73
73
|
Credits
|
74
74
|
-------
|
75
75
|
* Main development:
|
76
|
-
* Raul Murciano <http://raul.murciano.net> - code
|
77
|
-
* Domestika INTERNET S.L <http://domestika.org> - incredible support, really nice people to work with!
|
76
|
+
* Raul Murciano <http://raul.murciano.net> - code
|
77
|
+
* Domestika INTERNET S.L <http://domestika.org> - incredible support, really nice people to work with!
|
78
78
|
|
79
79
|
* Contributors:
|
80
80
|
* [Aitor Garay-Romero](http://github.com/aitorgr)
|
@@ -85,16 +85,18 @@ Credits
|
|
85
85
|
* [Kristian Mandrup](http://github.com/kristianmandrup)
|
86
86
|
* [Pieter Visser](http://github.com/pietervisser)
|
87
87
|
* [Marian Theisen](http://github.com/cice)
|
88
|
+
* [Enric Lluelles](http://github.com/enriclluelles)
|
89
|
+
* [Jaime Iniesta](http://github.com/jaimeiniesta)
|
88
90
|
|
89
91
|
Rails routing resources
|
90
92
|
-----------------------
|
91
|
-
* David Black's 'Rails Routing' ebook rocks! - 'Ruby for Rails' too, BTW.
|
93
|
+
* David Black's 'Rails Routing' ebook rocks! - 'Ruby for Rails' too, BTW.
|
92
94
|
* Obie Fernandez's 'The Rails Way' - the definitive RoR reference, great work Obie!
|
93
95
|
* As a part of the impressive Rails Guides set there is an [awesome document about rails routing](http://guides.rails.info/routing_outside_in.html) by Mike Gunderloy:
|
94
96
|
|
95
97
|
|
96
98
|
License
|
97
99
|
-------
|
98
|
-
Copyright (c) 2007 Released under the MIT license (see MIT-LICENSE)
|
99
|
-
Raul Murciano <http://raul.murciano.net>
|
100
|
+
Copyright (c) 2007 Released under the MIT license (see MIT-LICENSE)
|
101
|
+
Raul Murciano <http://raul.murciano.net>
|
100
102
|
Domestika INTERNET S.L. <http://domestika.org>
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'route_translator'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: translate_routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 2
|
10
|
+
version: 3.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Raul Murciano
|
@@ -29,6 +29,7 @@ extra_rdoc_files:
|
|
29
29
|
- README.markdown
|
30
30
|
files:
|
31
31
|
- lib/route_translator.rb
|
32
|
+
- lib/translate_routes.rb
|
32
33
|
- lib/translate_routes_test_helper.rb
|
33
34
|
- README.markdown
|
34
35
|
- test/translate_routes_test.rb
|