route_translator 14.0.0 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/LICENSE +4 -4
- data/README.md +3 -17
- data/lib/route_translator/version.rb +1 -1
- data/lib/route_translator.rb +0 -2
- metadata +6 -7
- data/lib/route_translator/railtie.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 989686cf863c7ad7bcb4ec753bc75941f921b640c65a29327c5b61c8985639cd
|
4
|
+
data.tar.gz: 06f38a03d46d4be48903572a892699f3a3d10c25748da312bc68b5d3d930a56c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d04d86bb053135734cf9de7c2efe889126ebae0188694c29b832139ded7593b286aacd8bd56bf99724253527192991747f5c070967290c7d88d13382051ff6b
|
7
|
+
data.tar.gz: 842b4a399320eccc69338a67fc229c06c29390188574cc7d2e166138010c01c0b66469c8bdde8b26a60c773c43ec52adafdd216391e594cbcba37d6d1bbb9173
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 14.1.0 / 2023-10-05
|
4
|
+
|
5
|
+
* [FEATURE] Rails 7.1 compatibility
|
6
|
+
|
7
|
+
## 14.0.1 / 2023-09-03
|
8
|
+
|
9
|
+
* [BUGFIX] Fix eager load on booting ([#296](https://github.com/enriclluelles/route_translator/issues/296))
|
10
|
+
|
3
11
|
## 14.0.0 / 2023-09-02
|
4
12
|
|
5
13
|
* [FEATURE] BREAKING CHANGE: Force standard nested separator (Upgrade guide at [#285](https://github.com/enriclluelles/route_translator/pull/285))
|
data/LICENSE
CHANGED
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
10
10
|
furnished to do so, subject to the following conditions:
|
11
11
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
14
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -11,8 +11,6 @@ It started as a fork of the awesome [translate_routes](https://github.com/raul/t
|
|
11
11
|
|
12
12
|
Right now it works with Rails 6.1 and 7.x
|
13
13
|
|
14
|
-
|
15
|
-
|
16
14
|
## Quick Start
|
17
15
|
|
18
16
|
1. If you have this `routes.rb` file originally:
|
@@ -27,7 +25,7 @@ Right now it works with Rails 6.1 and 7.x
|
|
27
25
|
end
|
28
26
|
```
|
29
27
|
|
30
|
-
The output of `
|
28
|
+
The output of `bundle exec rails routes` would be:
|
31
29
|
|
32
30
|
```
|
33
31
|
admin_cars GET /admin/cars(.:format) admin/cars#index
|
@@ -91,7 +89,7 @@ Right now it works with Rails 6.1 and 7.x
|
|
91
89
|
pricing: prix
|
92
90
|
```
|
93
91
|
|
94
|
-
5. Your routes are translated! Here's the output of your `
|
92
|
+
5. Your routes are translated! Here's the output of your `bundle exec rails routes` now:
|
95
93
|
|
96
94
|
```
|
97
95
|
Prefix Verb URI Pattern Controller#Action
|
@@ -149,7 +147,6 @@ Right now it works with Rails 6.1 and 7.x
|
|
149
147
|
|
150
148
|
Note: you might be tempted to use `before_action` instead of `around_action`: just don't. That could lead to [thread-related issues](https://github.com/enriclluelles/route_translator/issues/44).
|
151
149
|
|
152
|
-
|
153
150
|
### Changing the Language
|
154
151
|
|
155
152
|
To change the language and reload the appropriate route while staying on the same page, use the following code snippet:
|
@@ -164,7 +161,6 @@ If the page contains a localized slug, the above snippet does not work and a cus
|
|
164
161
|
|
165
162
|
More information at [Generating translated URLs](https://github.com/enriclluelles/route_translator/wiki/Generating-translated-URLs)
|
166
163
|
|
167
|
-
|
168
164
|
### Namespaces
|
169
165
|
|
170
166
|
You can translate a namespace route by either its `name` or `path` option:
|
@@ -204,7 +200,7 @@ You can translate a namespace route by either its `name` or `path` option:
|
|
204
200
|
sold: vendues
|
205
201
|
```
|
206
202
|
|
207
|
-
4. Your namespaces are translated! Here's the output of your `
|
203
|
+
4. Your namespaces are translated! Here's the output of your `bundle exec rails routes` now:
|
208
204
|
|
209
205
|
```
|
210
206
|
Prefix Verb URI Pattern Controller#Action
|
@@ -216,7 +212,6 @@ You can translate a namespace route by either its `name` or `path` option:
|
|
216
212
|
sold_cars_cars_en GET /sold/cars(.:format) sold_cars/cars#index {:locale=>"en"}
|
217
213
|
```
|
218
214
|
|
219
|
-
|
220
215
|
### Inflections
|
221
216
|
|
222
217
|
At the moment inflections are not supported, but you can use the following workaround:
|
@@ -259,8 +254,6 @@ edit_category_en GET /categories/:id/edit(.:format) categories#edit {:loca
|
|
259
254
|
DELETE /categories/:id(.:format) categories#destroy {:locale=>"en"}
|
260
255
|
```
|
261
256
|
|
262
|
-
|
263
|
-
|
264
257
|
## Configuration
|
265
258
|
|
266
259
|
You can configure RouteTranslator via an initializer or using the different environment config files.
|
@@ -272,7 +265,6 @@ RouteTranslator.config do |config|
|
|
272
265
|
end
|
273
266
|
```
|
274
267
|
|
275
|
-
|
276
268
|
### Available Configurations
|
277
269
|
|
278
270
|
| Option | Description | Default |
|
@@ -329,7 +321,6 @@ This is to avoid odd behaviour brought about by route conflicts and because `hos
|
|
329
321
|
|
330
322
|
NOTE: locale from parameters has priority over the one from hosts.
|
331
323
|
|
332
|
-
|
333
324
|
### Translations for similar routes with different namespaces
|
334
325
|
|
335
326
|
If you have routes that (partially) share names in one locale, but must be translated differently in another locale, for example:
|
@@ -382,7 +373,6 @@ people_products_es GET /people/productos_favoritos(.:format) people/produ
|
|
382
373
|
|
383
374
|
The gem will lookup translations under `controllers` scope first and then lookup translations under `routes` scope.
|
384
375
|
|
385
|
-
|
386
376
|
### Change locale parameter position in the path
|
387
377
|
|
388
378
|
If you need complex routing as `/:country/:locale/path/to/some/pages`, you can specify the position of your locale parameter in the following way:
|
@@ -395,8 +385,6 @@ scope ':country/:locale' do
|
|
395
385
|
end
|
396
386
|
```
|
397
387
|
|
398
|
-
|
399
|
-
|
400
388
|
## Testing
|
401
389
|
Testing your controllers with routes-translator is easy, just add a locale parameter as `String` for your localized routes. Otherwise, an `ActionController::UrlGenerationError` will raise.
|
402
390
|
|
@@ -411,8 +399,6 @@ describe 'GET index' do
|
|
411
399
|
end
|
412
400
|
```
|
413
401
|
|
414
|
-
|
415
|
-
|
416
402
|
## Contributing
|
417
403
|
|
418
404
|
Please read through our [contributing guidelines](CONTRIBUTING.md). Included are directions for opening issues, coding standards, and notes on development.
|
data/lib/route_translator.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: route_translator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.
|
4
|
+
version: 14.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geremia Taglialatela
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-
|
13
|
+
date: 2023-10-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: actionpack
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '6.1'
|
22
22
|
- - "<"
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: '7.
|
24
|
+
version: '7.2'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
version: '6.1'
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '7.
|
34
|
+
version: '7.2'
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: activesupport
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
version: '6.1'
|
42
42
|
- - "<"
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: '7.
|
44
|
+
version: '7.2'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
47
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -51,7 +51,7 @@ dependencies:
|
|
51
51
|
version: '6.1'
|
52
52
|
- - "<"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '7.
|
54
|
+
version: '7.2'
|
55
55
|
description: Translates the Rails routes of your application into the languages defined
|
56
56
|
in your locale files
|
57
57
|
email:
|
@@ -73,7 +73,6 @@ files:
|
|
73
73
|
- lib/route_translator/extensions/route_set.rb
|
74
74
|
- lib/route_translator/extensions/test_case.rb
|
75
75
|
- lib/route_translator/host.rb
|
76
|
-
- lib/route_translator/railtie.rb
|
77
76
|
- lib/route_translator/route.rb
|
78
77
|
- lib/route_translator/translator.rb
|
79
78
|
- lib/route_translator/translator/path.rb
|