route_translator 14.0.0 → 14.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -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 +2 -3
- 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: 7fcad9eea1b8f21a0cd9f080b7d265e99e506832b36e841e73269f32f8889fe4
|
4
|
+
data.tar.gz: b56954aecf4c3bf8b4f0574f85902cf3b4a39e479732ad9f0d9115db4ee1026e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86e095fd11dc008b616056bfcfc2af1a49e61d0326422b4c54e7bd6bba158efea335fdc9d852c0dc888c93049956f0fdd5abd1d61f30b35efcd7c2b90887707a
|
7
|
+
data.tar.gz: 11e1ce6b4304f48afd72903cdf9192cec31e7b3142ba715ae9192821aac9a70acc8344b5c1914f8b7efe59b1b33146502dad300bd3429ad5a09cfa46605bd073
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 14.0.1 / 2023-09-03
|
4
|
+
|
5
|
+
* [BUGFIX] Fix eager load on booting ([#296](https://github.com/enriclluelles/route_translator/issues/296))
|
6
|
+
|
3
7
|
## 14.0.0 / 2023-09-02
|
4
8
|
|
5
9
|
* [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.0.
|
4
|
+
version: 14.0.1
|
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-09-
|
13
|
+
date: 2023-09-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: actionpack
|
@@ -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
|