dragoman 0.0.1 → 0.0.2
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/lib/dragoman/mapper.rb +1 -1
- data/lib/dragoman/mapper_rails3.rb +1 -1
- data/lib/dragoman/version.rb +1 -1
- data/spec/fixtures/config/routes.rb +2 -0
- data/spec/routing/routes_spec.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4090b145af56cf395749d4563c858dc9d7ec438e
|
4
|
+
data.tar.gz: 4f1f281ed36a13365785fafa7eb487157372db5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4000a0878013f2345310d757ab55e0d98d3862021f632a0bb1220f3ea0596133be2840a88aba3ceb418ce3007769e245e624e8aa2826ea9fc757cd2c14bad75e
|
7
|
+
data.tar.gz: ffd681555d10500818eeefa7858ca2b9ff3df0dc3e326a2d203fa7e522f9a262d309bee554aecd475fd94589cdc00c1901396a80923329525012faad35083a1d
|
data/lib/dragoman/mapper.rb
CHANGED
@@ -26,7 +26,7 @@ module Dragoman
|
|
26
26
|
|
27
27
|
def add_route_with_localization(action, options)
|
28
28
|
if @current_locale
|
29
|
-
options[:path] = Dragoman::Translator.translate_path(action, @current_locale)
|
29
|
+
options[:path] = Dragoman::Translator.translate_path(action, @current_locale) if action.present? && !canonical_action?(action)
|
30
30
|
options[:locale] = @current_locale
|
31
31
|
end
|
32
32
|
add_route_without_localization action, options
|
@@ -29,7 +29,7 @@ module Dragoman
|
|
29
29
|
|
30
30
|
def add_route_with_localization(action, options)
|
31
31
|
if @current_locale
|
32
|
-
options[:path] = Dragoman::Translator.translate_path(action, @current_locale)
|
32
|
+
options[:path] = Dragoman::Translator.translate_path(action, @current_locale) if action.present? && !canonical_action?(action, true)
|
33
33
|
options[:locale] = @current_locale
|
34
34
|
end
|
35
35
|
add_route_without_localization action, options
|
data/lib/dragoman/version.rb
CHANGED
data/spec/routing/routes_spec.rb
CHANGED
@@ -45,6 +45,11 @@ describe 'routes' do
|
|
45
45
|
assert_routing '/products', :controller => 'products', :action => 'index', :locale => :en
|
46
46
|
end
|
47
47
|
|
48
|
+
it 'skips empty paths' do
|
49
|
+
expect(empty_nl_path).to eq '/'
|
50
|
+
expect(empty_en_path).to eq '/'
|
51
|
+
end
|
52
|
+
|
48
53
|
describe 'adds untranslated path helpers' do
|
49
54
|
it 'uses the I18n locale' do
|
50
55
|
I18n.locale = :nl
|