route_translator 9.0.0 → 12.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/LICENSE +1 -1
- data/README.md +4 -6
- data/lib/route_translator/extensions/mapper.rb +1 -1
- data/lib/route_translator/extensions/route_set.rb +6 -14
- data/lib/route_translator/host.rb +8 -8
- data/lib/route_translator/translator/path/segment.rb +3 -4
- data/lib/route_translator/translator/path.rb +1 -2
- data/lib/route_translator/translator.rb +5 -6
- data/lib/route_translator/version.rb +1 -1
- data/lib/route_translator.rb +2 -5
- metadata +32 -75
- data/lib/route_translator/host_path_consistency_lambdas.rb +0 -21
- data/lib/route_translator/locale_sanitizer.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67af9e1b02cca5669da31e3de5ee80a70010828cdf8b7b40ad9e281a4b336384
|
4
|
+
data.tar.gz: 9464d33a1006b8208ecddb10bac6fbea0b582d0183cc8be3b726307e665ace80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e65a1a4017de472931459fa414e0066ebf9f3c1dadcfc2889093bda3ea67a7e2aa031e89e2e39d9c6821e5b55d25b3fa0d5084c9604413fe6176d45a0b90619
|
7
|
+
data.tar.gz: ad478ac354cfd4aa7732aa6bc9921cf2f9f544e716e6a2e3d8b1f4788b4aff3f0a0274348f4b41c10098a22ac70c789598cfb2ca7fa557c34892090946d9e83f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 12.0.0 / 2021-11-28
|
4
|
+
|
5
|
+
* [BUGFIX] Fix disable_fallback behavior ([#241](https://github.com/enriclluelles/route_translator/issues/241))
|
6
|
+
* [ENHANCEMENT] Update development dependencies
|
7
|
+
|
8
|
+
## 11.0.1 / 2021-11-15
|
9
|
+
|
10
|
+
* [ENHANCEMENT] Require MFA to publish gems
|
11
|
+
* [ENHANCEMENT] Update development dependencies
|
12
|
+
|
13
|
+
## 11.0.0 / 2021-09-26
|
14
|
+
|
15
|
+
* [FEATURE] Drop Ruby 2.4 support
|
16
|
+
* [FEATURE] Drop Rails 5.0 and 5.1 support
|
17
|
+
* [ENHANCEMENT] Update development dependencies
|
18
|
+
|
19
|
+
## 10.0.0 / 2021-01-16
|
20
|
+
|
21
|
+
* [BUGFIX] Verify host path consistency by default ([#91](https://github.com/enriclluelles/route_translator/issues/91), [#171](https://github.com/enriclluelles/route_translator/issues/171))
|
22
|
+
* [FEATURE] Remove the option to verify host path consistency
|
23
|
+
* [ENHANCEMENT] Avoid duplicate routes when using host_locales ([#87](https://github.com/enriclluelles/route_translator/issues/87), [#171](https://github.com/enriclluelles/route_translator/issues/171))
|
24
|
+
* [ENHANCEMENT] Test against Ruby 3.0.0
|
25
|
+
* [ENHANCEMENT] Update development dependencies
|
26
|
+
|
3
27
|
## 9.0.0 / 2020-11-07
|
4
28
|
|
5
29
|
* [ENHANCEMENT] Check for `empty?` instead of `any?` on available_locales array
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2007 Raul Murciano [http://raul.murciano.net], Domestika INTERNET S.L. [http://domestika.org], 2015 Enric Lluelles [http://enric.lluell.es],
|
3
|
+
Copyright (c) 2007 Raul Murciano [http://raul.murciano.net], Domestika INTERNET S.L. [http://domestika.org], 2015 Enric Lluelles [http://enric.lluell.es], 2021 Geremia Taglialatela
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# RouteTranslator
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/route_translator.svg)](https://badge.fury.io/rb/route_translator)
|
4
|
-
[![
|
5
|
-
[![Build Status](https://travis-ci.org/enriclluelles/route_translator.svg?branch=master)](https://travis-ci.org/enriclluelles/route_translator)
|
4
|
+
[![Build Status](https://github.com/enriclluelles/route_translator/actions/workflows/ruby.yml/badge.svg)](https://github.com/enriclluelles/route_translator/actions)
|
6
5
|
[![Maintainability](https://api.codeclimate.com/v1/badges/1c369ce6147724b353fc/maintainability)](https://codeclimate.com/github/enriclluelles/route_translator/maintainability)
|
7
6
|
[![Coverage Status](https://coveralls.io/repos/github/enriclluelles/route_translator/badge.svg?branch=master)](https://coveralls.io/github/enriclluelles/route_translator?branch=master)
|
8
7
|
|
@@ -10,7 +9,7 @@ RouteTranslator is a gem to allow you to manage the translations of your app rou
|
|
10
9
|
|
11
10
|
It started as a fork of the awesome [translate_routes](https://github.com/raul/translate_routes) plugin by [Raúl Murciano](https://github.com/raul).
|
12
11
|
|
13
|
-
Right now it works with Rails 5.
|
12
|
+
Right now it works with Rails 5.2 and Rails 6.x
|
14
13
|
|
15
14
|
|
16
15
|
|
@@ -281,7 +280,6 @@ end
|
|
281
280
|
| `host_locales` | Sets `I18n.locale` based on `request.host`. Useful for apps accepting requests from more than one domain. See below for more details | `{}` |
|
282
281
|
| `locale_param_key` | The param key used to set the locale to the newly generated routes | `:locale` |
|
283
282
|
| `locale_segment_proc` | The locale segment of the url will by default be `locale.to_s.downcase`. You can supply your own mechanism via a Proc that takes `locale` as an argument, e.g. `->(locale) { locale.to_s.upcase }` | `false` |
|
284
|
-
| `verify_host_path_consistency` | Forces a matching of the host associated locale with the translated path locale as part of the route definition. By default, if you use different hosts to translate your application, all translated paths will work on all hosts | `false` |
|
285
283
|
|
286
284
|
|
287
285
|
### Host-based Locale
|
@@ -313,13 +311,13 @@ RouteTranslator.config.host_locales = { 'russia.*' => :ru, '*.com' => :en } #
|
|
313
311
|
RouteTranslator.config.host_locales = { '*.com' => :en, 'russia.*' => :ru } # 'russia.com' will have locale :en
|
314
312
|
```
|
315
313
|
|
316
|
-
If `host_locales` option is set, the following options will be forced
|
314
|
+
If `host_locales` option is set, the following options will be forced:
|
317
315
|
|
318
316
|
```ruby
|
319
317
|
@config.force_locale = false
|
320
318
|
@config.generate_unlocalized_routes = false
|
321
319
|
@config.generate_unnamed_unlocalized_routes = false
|
322
|
-
@config.hide_locale =
|
320
|
+
@config.hide_locale = true
|
323
321
|
```
|
324
322
|
|
325
323
|
This is to avoid odd behaviour brought about by route conflicts and because `host_locales` forces and hides the host-locale dynamically.
|
@@ -38,7 +38,7 @@ module ActionDispatch
|
|
38
38
|
ast = Journey::Parser.parse path
|
39
39
|
|
40
40
|
mapping = Mapping.build(@scope, @set, ast, controller, default_action, to, via, formatted, options_constraints, anchor, options)
|
41
|
-
@set.add_localized_route(mapping,
|
41
|
+
@set.add_localized_route(mapping, as, anchor, @scope, path, controller, default_action, to, via, formatted, options_constraints, options)
|
42
42
|
end
|
43
43
|
# rubocop:enable Lint/UnderscorePrefixedVariableName, Metrics/PerceivedComplexity
|
44
44
|
|
@@ -5,20 +5,20 @@ require 'action_dispatch'
|
|
5
5
|
module ActionDispatch
|
6
6
|
module Routing
|
7
7
|
class RouteSet
|
8
|
-
def add_localized_route(mapping,
|
8
|
+
def add_localized_route(mapping, name, anchor, scope, path, controller, default_action, to, via, formatted, options_constraints, options)
|
9
9
|
route = RouteTranslator::Route.new(self, path, name, options_constraints, options, mapping)
|
10
10
|
|
11
11
|
RouteTranslator::Translator.translations_for(route) do |locale, translated_name, translated_path, translated_options_constraints, translated_options|
|
12
12
|
translated_path_ast = ::ActionDispatch::Journey::Parser.parse(translated_path)
|
13
13
|
translated_mapping = translate_mapping(locale, self, translated_options, translated_path_ast, scope, controller, default_action, to, formatted, via, translated_options_constraints, anchor)
|
14
14
|
|
15
|
-
|
15
|
+
add_route translated_mapping, translated_name
|
16
16
|
end
|
17
17
|
|
18
18
|
if RouteTranslator.config.generate_unnamed_unlocalized_routes
|
19
|
-
|
19
|
+
add_route mapping, nil
|
20
20
|
elsif RouteTranslator.config.generate_unlocalized_routes
|
21
|
-
|
21
|
+
add_route mapping, name
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -33,20 +33,12 @@ module ActionDispatch
|
|
33
33
|
options: scope[:options] ? scope[:options].merge(translated_options) : translated_options
|
34
34
|
}
|
35
35
|
|
36
|
-
if RouteTranslator.config.
|
37
|
-
scope_params[:blocks].push RouteTranslator::
|
36
|
+
if RouteTranslator.config.host_locales.present?
|
37
|
+
scope_params[:blocks].push RouteTranslator::Host.lambdas_for_locale(locale)
|
38
38
|
end
|
39
39
|
|
40
40
|
::ActionDispatch::Routing::Mapper::Mapping.build scope_params, route_set, translated_path_ast, controller, default_action, to, via, formatted, translated_options_constraints, anchor, translated_options
|
41
41
|
end
|
42
|
-
|
43
|
-
def add_route_to_set(mapping, path_ast, name, anchor)
|
44
|
-
if method(:add_route).arity == 4
|
45
|
-
add_route mapping, path_ast, name, anchor
|
46
|
-
else
|
47
|
-
add_route mapping, name
|
48
|
-
end
|
49
|
-
end
|
50
42
|
end
|
51
43
|
end
|
52
44
|
end
|
@@ -5,20 +5,16 @@ module RouteTranslator
|
|
5
5
|
class << self
|
6
6
|
private
|
7
7
|
|
8
|
+
def lambdas
|
9
|
+
@lambdas ||= {}
|
10
|
+
end
|
11
|
+
|
8
12
|
def regex_for(host_string)
|
9
13
|
escaped = Regexp.escape(host_string).gsub('\*', '.*?').gsub('\.', '\.?')
|
10
14
|
Regexp.new("^#{escaped}$", Regexp::IGNORECASE)
|
11
15
|
end
|
12
16
|
end
|
13
17
|
|
14
|
-
def native_locale?(locale)
|
15
|
-
locale.to_s.include?('native_')
|
16
|
-
end
|
17
|
-
|
18
|
-
def native_locales
|
19
|
-
config.host_locales.values.map { |locale| :"native_#{locale}" }
|
20
|
-
end
|
21
|
-
|
22
18
|
module_function
|
23
19
|
|
24
20
|
def locale_from_host(host)
|
@@ -28,5 +24,9 @@ module RouteTranslator
|
|
28
24
|
locales &= I18n.available_locales
|
29
25
|
locales.first&.to_sym
|
30
26
|
end
|
27
|
+
|
28
|
+
def lambdas_for_locale(locale)
|
29
|
+
lambdas[locale] ||= ->(req) { locale == RouteTranslator::Host.locale_from_host(req.host) }
|
30
|
+
end
|
31
31
|
end
|
32
32
|
end
|
@@ -9,7 +9,7 @@ module RouteTranslator
|
|
9
9
|
|
10
10
|
def fallback_options(str, locale)
|
11
11
|
if RouteTranslator.config.disable_fallback && locale.to_s != I18n.default_locale.to_s
|
12
|
-
{ scope: :routes, fallback:
|
12
|
+
{ scope: :routes, fallback: false }
|
13
13
|
else
|
14
14
|
{ scope: :routes, default: str }
|
15
15
|
end
|
@@ -25,15 +25,14 @@ module RouteTranslator
|
|
25
25
|
opts = { locale: locale, scope: scope }
|
26
26
|
|
27
27
|
if I18n.t(str, **opts.merge(exception_handler: handler)).is_a?(I18n::MissingTranslation)
|
28
|
-
I18n.t str, **opts.merge(fallback_options(str, locale))
|
28
|
+
I18n.t! str, **opts.merge(fallback_options(str, locale))
|
29
29
|
else
|
30
30
|
I18n.t str, **opts
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
def translate_string(str, locale, scope)
|
35
|
-
|
36
|
-
translated_resource = translate_resource(str, sanitized_locale, scope)
|
35
|
+
translated_resource = translate_resource(str, locale.to_s, scope)
|
37
36
|
|
38
37
|
Addressable::URI.normalize_component translated_resource
|
39
38
|
end
|
@@ -9,8 +9,7 @@ module RouteTranslator
|
|
9
9
|
private
|
10
10
|
|
11
11
|
def display_locale?(locale)
|
12
|
-
!RouteTranslator.config.hide_locale && !
|
13
|
-
(!default_locale?(locale) || config_requires_locale?)
|
12
|
+
!RouteTranslator.config.hide_locale && (!default_locale?(locale) || config_requires_locale?)
|
14
13
|
end
|
15
14
|
|
16
15
|
def config_requires_locale?
|
@@ -10,8 +10,10 @@ module RouteTranslator
|
|
10
10
|
private
|
11
11
|
|
12
12
|
def locale_from_args(args)
|
13
|
-
|
14
|
-
|
13
|
+
return if RouteTranslator.config.host_locales.blank?
|
14
|
+
|
15
|
+
args_hash = args.find { |arg| arg.is_a?(Hash) }
|
16
|
+
args_hash&.fetch(:locale, nil)
|
15
17
|
end
|
16
18
|
|
17
19
|
def translate_name(name, locale, named_routes_names)
|
@@ -26,7 +28,7 @@ module RouteTranslator
|
|
26
28
|
translated_options = options.dup
|
27
29
|
|
28
30
|
if translated_options.exclude?(RouteTranslator.locale_param_key)
|
29
|
-
translated_options[RouteTranslator.locale_param_key] =
|
31
|
+
translated_options[RouteTranslator.locale_param_key] = locale.to_s
|
30
32
|
end
|
31
33
|
|
32
34
|
translated_options
|
@@ -53,7 +55,6 @@ module RouteTranslator
|
|
53
55
|
|
54
56
|
def available_locales
|
55
57
|
locales = RouteTranslator.available_locales
|
56
|
-
locales.concat(RouteTranslator.native_locales) if RouteTranslator.native_locales.present?
|
57
58
|
# Make sure the default locale is translated in last place to avoid
|
58
59
|
# problems with wildcards when default locale is omitted in paths. The
|
59
60
|
# default routes will catch all paths like wildcard if it is translated first.
|
@@ -82,8 +83,6 @@ module RouteTranslator
|
|
82
83
|
|
83
84
|
locale = if args_locale
|
84
85
|
args_locale.to_s.underscore
|
85
|
-
elsif kaller.respond_to?("#{old_name}_native_#{current_locale_name}_#{suffix}")
|
86
|
-
"native_#{current_locale_name}"
|
87
86
|
elsif kaller.respond_to?("#{old_name}_#{current_locale_name}_#{suffix}")
|
88
87
|
current_locale_name
|
89
88
|
else
|
data/lib/route_translator.rb
CHANGED
@@ -6,8 +6,6 @@ require 'addressable/uri'
|
|
6
6
|
require 'route_translator/extensions'
|
7
7
|
require 'route_translator/translator'
|
8
8
|
require 'route_translator/host'
|
9
|
-
require 'route_translator/host_path_consistency_lambdas'
|
10
|
-
require 'route_translator/locale_sanitizer'
|
11
9
|
|
12
10
|
module RouteTranslator
|
13
11
|
extend RouteTranslator::Host
|
@@ -23,8 +21,7 @@ module RouteTranslator
|
|
23
21
|
hide_locale: false,
|
24
22
|
host_locales: {},
|
25
23
|
locale_param_key: :locale,
|
26
|
-
locale_segment_proc: false
|
27
|
-
verify_host_path_consistency: false
|
24
|
+
locale_segment_proc: false
|
28
25
|
}.freeze
|
29
26
|
|
30
27
|
Configuration = Struct.new(*DEFAULT_CONFIGURATION.keys)
|
@@ -36,7 +33,7 @@ module RouteTranslator
|
|
36
33
|
@config.force_locale = false
|
37
34
|
@config.generate_unlocalized_routes = false
|
38
35
|
@config.generate_unnamed_unlocalized_routes = false
|
39
|
-
@config.hide_locale =
|
36
|
+
@config.hide_locale = true
|
40
37
|
end
|
41
38
|
end
|
42
39
|
|
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:
|
4
|
+
version: 12.0.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:
|
13
|
+
date: 2021-11-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: actionpack
|
@@ -18,40 +18,40 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 5.
|
21
|
+
version: '5.2'
|
22
22
|
- - "<"
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: '
|
24
|
+
version: '7.0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
28
|
requirements:
|
29
29
|
- - ">="
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version: 5.
|
31
|
+
version: '5.2'
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '7.0'
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: activesupport
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 5.
|
41
|
+
version: '5.2'
|
42
42
|
- - "<"
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: '
|
44
|
+
version: '7.0'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
47
|
version_requirements: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
49
|
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version: 5.
|
51
|
+
version: '5.2'
|
52
52
|
- - "<"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '7.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: addressable
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '2.
|
75
|
+
version: '2.4'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '2.
|
82
|
+
version: '2.4'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: byebug
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,20 +100,6 @@ dependencies:
|
|
100
100
|
- - "<"
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '12'
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: coveralls_reborn
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: 0.18.0
|
110
|
-
type: :development
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - "~>"
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: 0.18.0
|
117
103
|
- !ruby/object:Gem::Dependency
|
118
104
|
name: minitest
|
119
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,20 +120,20 @@ dependencies:
|
|
134
120
|
requirements:
|
135
121
|
- - ">="
|
136
122
|
- !ruby/object:Gem::Version
|
137
|
-
version: 5.
|
123
|
+
version: '5.2'
|
138
124
|
- - "<"
|
139
125
|
- !ruby/object:Gem::Version
|
140
|
-
version: '
|
126
|
+
version: '7.0'
|
141
127
|
type: :development
|
142
128
|
prerelease: false
|
143
129
|
version_requirements: !ruby/object:Gem::Requirement
|
144
130
|
requirements:
|
145
131
|
- - ">="
|
146
132
|
- !ruby/object:Gem::Version
|
147
|
-
version: 5.
|
133
|
+
version: '5.2'
|
148
134
|
- - "<"
|
149
135
|
- !ruby/object:Gem::Version
|
150
|
-
version: '
|
136
|
+
version: '7.0'
|
151
137
|
- !ruby/object:Gem::Dependency
|
152
138
|
name: rake
|
153
139
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,67 +149,39 @@ dependencies:
|
|
163
149
|
- !ruby/object:Gem::Version
|
164
150
|
version: '13.0'
|
165
151
|
- !ruby/object:Gem::Dependency
|
166
|
-
name:
|
152
|
+
name: simplecov
|
167
153
|
requirement: !ruby/object:Gem::Requirement
|
168
154
|
requirements:
|
169
|
-
- - "
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
version: 1.2.0
|
172
|
-
type: :development
|
173
|
-
prerelease: false
|
174
|
-
version_requirements: !ruby/object:Gem::Requirement
|
175
|
-
requirements:
|
176
|
-
- - "~>"
|
155
|
+
- - ">="
|
177
156
|
- !ruby/object:Gem::Version
|
178
|
-
version:
|
179
|
-
-
|
180
|
-
name: rubocop-performance
|
181
|
-
requirement: !ruby/object:Gem::Requirement
|
182
|
-
requirements:
|
183
|
-
- - "~>"
|
157
|
+
version: 0.18.5
|
158
|
+
- - "<"
|
184
159
|
- !ruby/object:Gem::Version
|
185
|
-
version: '
|
160
|
+
version: '0.22'
|
186
161
|
type: :development
|
187
162
|
prerelease: false
|
188
163
|
version_requirements: !ruby/object:Gem::Requirement
|
189
164
|
requirements:
|
190
|
-
- - "
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: 0.18.5
|
168
|
+
- - "<"
|
191
169
|
- !ruby/object:Gem::Version
|
192
|
-
version: '
|
170
|
+
version: '0.22'
|
193
171
|
- !ruby/object:Gem::Dependency
|
194
|
-
name:
|
172
|
+
name: simplecov-lcov
|
195
173
|
requirement: !ruby/object:Gem::Requirement
|
196
174
|
requirements:
|
197
175
|
- - "~>"
|
198
176
|
- !ruby/object:Gem::Version
|
199
|
-
version:
|
177
|
+
version: 0.8.0
|
200
178
|
type: :development
|
201
179
|
prerelease: false
|
202
180
|
version_requirements: !ruby/object:Gem::Requirement
|
203
181
|
requirements:
|
204
182
|
- - "~>"
|
205
183
|
- !ruby/object:Gem::Version
|
206
|
-
version:
|
207
|
-
- !ruby/object:Gem::Dependency
|
208
|
-
name: simplecov
|
209
|
-
requirement: !ruby/object:Gem::Requirement
|
210
|
-
requirements:
|
211
|
-
- - ">="
|
212
|
-
- !ruby/object:Gem::Version
|
213
|
-
version: 0.18.5
|
214
|
-
- - "<"
|
215
|
-
- !ruby/object:Gem::Version
|
216
|
-
version: '0.20'
|
217
|
-
type: :development
|
218
|
-
prerelease: false
|
219
|
-
version_requirements: !ruby/object:Gem::Requirement
|
220
|
-
requirements:
|
221
|
-
- - ">="
|
222
|
-
- !ruby/object:Gem::Version
|
223
|
-
version: 0.18.5
|
224
|
-
- - "<"
|
225
|
-
- !ruby/object:Gem::Version
|
226
|
-
version: '0.20'
|
184
|
+
version: 0.8.0
|
227
185
|
description: Translates the Rails routes of your application into the languages defined
|
228
186
|
in your locale files
|
229
187
|
email:
|
@@ -243,8 +201,6 @@ files:
|
|
243
201
|
- lib/route_translator/extensions/route_set.rb
|
244
202
|
- lib/route_translator/extensions/test_case.rb
|
245
203
|
- lib/route_translator/host.rb
|
246
|
-
- lib/route_translator/host_path_consistency_lambdas.rb
|
247
|
-
- lib/route_translator/locale_sanitizer.rb
|
248
204
|
- lib/route_translator/route.rb
|
249
205
|
- lib/route_translator/translator.rb
|
250
206
|
- lib/route_translator/translator/path.rb
|
@@ -255,6 +211,7 @@ homepage: https://github.com/enriclluelles/route_translator
|
|
255
211
|
licenses:
|
256
212
|
- MIT
|
257
213
|
metadata:
|
214
|
+
rubygems_mfa_required: 'true'
|
258
215
|
bug_tracker_uri: https://github.com/enriclluelles/route_translator/issues
|
259
216
|
changelog_uri: https://github.com/enriclluelles/route_translator/blob/master/CHANGELOG.md
|
260
217
|
source_code_uri: https://github.com/enriclluelles/route_translator
|
@@ -266,14 +223,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
266
223
|
requirements:
|
267
224
|
- - ">="
|
268
225
|
- !ruby/object:Gem::Version
|
269
|
-
version: '2.
|
226
|
+
version: '2.5'
|
270
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
228
|
requirements:
|
272
229
|
- - ">="
|
273
230
|
- !ruby/object:Gem::Version
|
274
231
|
version: '0'
|
275
232
|
requirements: []
|
276
|
-
rubygems_version: 3.1.
|
233
|
+
rubygems_version: 3.1.6
|
277
234
|
signing_key:
|
278
235
|
specification_version: 4
|
279
236
|
summary: Translate your Rails routes in a simple manner
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RouteTranslator
|
4
|
-
module HostPathConsistencyLambdas
|
5
|
-
class << self
|
6
|
-
private
|
7
|
-
|
8
|
-
def lambdas
|
9
|
-
@lambdas ||= {}
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
module_function
|
14
|
-
|
15
|
-
def for_locale(locale)
|
16
|
-
sanitized_locale = RouteTranslator::LocaleSanitizer.sanitize(locale)
|
17
|
-
|
18
|
-
lambdas[sanitized_locale] ||= ->(req) { sanitized_locale == RouteTranslator::Host.locale_from_host(req.host).to_s }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|