route_translator 5.0.4 → 5.0.5
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 +5 -0
- data/lib/route_translator/extensions/mapper.rb +16 -6
- data/lib/route_translator/translator.rb +10 -10
- data/lib/route_translator/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b3b566e8efb88b086812e1308e50a25a665b5b1a
|
|
4
|
+
data.tar.gz: 43ba2e28fd4e1b24b3451c54e8aae47ad4961693
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5588fc472c0c4b192b7610e8a31091fbdaa93c9ba57749e8e281d10744537f52f3a24a8e913837bb83ad2f3230cf8c950ba0e709977da332204376b050cd2bec
|
|
7
|
+
data.tar.gz: fe53b0f81af8176c9f1cf53d07b869b0a18da4d3bbe09a29f7868faedcd3416e2999557b9b2b95a17dca1ad48f5632b5e59704050cb2bc60d40ef46bde6f3bf3
|
data/CHANGELOG.md
CHANGED
|
@@ -10,8 +10,11 @@ module ActionDispatch
|
|
|
10
10
|
@localized = false
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
# rubocop:disable Lint/UnderscorePrefixedVariableName
|
|
14
|
+
def add_route(action, controller, options, _path, to, via, formatted, anchor, options_constraints) # :nodoc:
|
|
15
|
+
return super unless @localized
|
|
16
|
+
|
|
17
|
+
path = path_for_action(action, _path)
|
|
15
18
|
raise ArgumentError, 'path is required' if path.blank?
|
|
16
19
|
|
|
17
20
|
action = action.to_s
|
|
@@ -35,10 +38,17 @@ module ActionDispatch
|
|
|
35
38
|
|
|
36
39
|
mapping = Mapping.build(@scope, @set, ast, controller, default_action, to, via, formatted, options_constraints, anchor, options)
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
@set.add_localized_route(mapping, ast, as, anchor, @scope, path, controller, default_action, to, via, formatted, options_constraints, options)
|
|
42
|
+
end
|
|
43
|
+
# rubocop:enable Lint/UnderscorePrefixedVariableName
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
def define_generate_prefix(app, name)
|
|
48
|
+
return super unless @localized
|
|
49
|
+
|
|
50
|
+
RouteTranslator::Translator.available_locales.each do |locale|
|
|
51
|
+
super(app, "#{name}_#{locale.to_s.underscore}")
|
|
42
52
|
end
|
|
43
53
|
end
|
|
44
54
|
end
|
|
@@ -8,16 +8,6 @@ module RouteTranslator
|
|
|
8
8
|
class << self
|
|
9
9
|
private
|
|
10
10
|
|
|
11
|
-
def available_locales
|
|
12
|
-
locales = RouteTranslator.available_locales
|
|
13
|
-
locales.concat(RouteTranslator.native_locales) if RouteTranslator.native_locales.present?
|
|
14
|
-
# Make sure the default locale is translated in last place to avoid
|
|
15
|
-
# problems with wildcards when default locale is omitted in paths. The
|
|
16
|
-
# default routes will catch all paths like wildcard if it is translated first.
|
|
17
|
-
locales.delete I18n.default_locale
|
|
18
|
-
locales.push I18n.default_locale
|
|
19
|
-
end
|
|
20
|
-
|
|
21
11
|
def host_locales_option?
|
|
22
12
|
RouteTranslator.config.host_locales.present?
|
|
23
13
|
end
|
|
@@ -35,6 +25,16 @@ module RouteTranslator
|
|
|
35
25
|
|
|
36
26
|
module_function
|
|
37
27
|
|
|
28
|
+
def available_locales
|
|
29
|
+
locales = RouteTranslator.available_locales
|
|
30
|
+
locales.concat(RouteTranslator.native_locales) if RouteTranslator.native_locales.present?
|
|
31
|
+
# Make sure the default locale is translated in last place to avoid
|
|
32
|
+
# problems with wildcards when default locale is omitted in paths. The
|
|
33
|
+
# default routes will catch all paths like wildcard if it is translated first.
|
|
34
|
+
locales.delete I18n.default_locale
|
|
35
|
+
locales.push I18n.default_locale
|
|
36
|
+
end
|
|
37
|
+
|
|
38
38
|
def translations_for(route_set, path, name, options_constraints, options)
|
|
39
39
|
RouteTranslator::Translator::RouteHelpers.add name, route_set.named_routes
|
|
40
40
|
|
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: 5.0.
|
|
4
|
+
version: 5.0.5
|
|
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: 2016-
|
|
13
|
+
date: 2016-12-15 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activesupport
|
|
@@ -86,14 +86,14 @@ dependencies:
|
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 0.8.
|
|
89
|
+
version: 0.8.17
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: 0.8.
|
|
96
|
+
version: 0.8.17
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: minitest
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -140,28 +140,28 @@ dependencies:
|
|
|
140
140
|
requirements:
|
|
141
141
|
- - "~>"
|
|
142
142
|
- !ruby/object:Gem::Version
|
|
143
|
-
version: '
|
|
143
|
+
version: '12.0'
|
|
144
144
|
type: :development
|
|
145
145
|
prerelease: false
|
|
146
146
|
version_requirements: !ruby/object:Gem::Requirement
|
|
147
147
|
requirements:
|
|
148
148
|
- - "~>"
|
|
149
149
|
- !ruby/object:Gem::Version
|
|
150
|
-
version: '
|
|
150
|
+
version: '12.0'
|
|
151
151
|
- !ruby/object:Gem::Dependency
|
|
152
152
|
name: rubocop
|
|
153
153
|
requirement: !ruby/object:Gem::Requirement
|
|
154
154
|
requirements:
|
|
155
155
|
- - "~>"
|
|
156
156
|
- !ruby/object:Gem::Version
|
|
157
|
-
version: 0.
|
|
157
|
+
version: 0.46.0
|
|
158
158
|
type: :development
|
|
159
159
|
prerelease: false
|
|
160
160
|
version_requirements: !ruby/object:Gem::Requirement
|
|
161
161
|
requirements:
|
|
162
162
|
- - "~>"
|
|
163
163
|
- !ruby/object:Gem::Version
|
|
164
|
-
version: 0.
|
|
164
|
+
version: 0.46.0
|
|
165
165
|
- !ruby/object:Gem::Dependency
|
|
166
166
|
name: simplecov
|
|
167
167
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
219
219
|
version: '0'
|
|
220
220
|
requirements: []
|
|
221
221
|
rubyforge_project:
|
|
222
|
-
rubygems_version: 2.5.
|
|
222
|
+
rubygems_version: 2.5.2
|
|
223
223
|
signing_key:
|
|
224
224
|
specification_version: 4
|
|
225
225
|
summary: Translate your Rails routes in a simple manner
|