i18n_routing 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -1
- data/lib/i18n_routing_rails32.rb +6 -23
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -6,7 +6,7 @@ All necessary informations are available on the wiki: http://wiki.github.com/kwi
|
|
6
6
|
|
7
7
|
For any question, use the i18_routing google group: http://groups.google.com/group/i18n-routing
|
8
8
|
|
9
|
-
Works with Rails 2.3, 3.0 and 3.
|
9
|
+
Works with Rails 2.3, 3.0, 3.1 and 3.2
|
10
10
|
|
11
11
|
== TODO for next releases (written the 9th of June 2010)
|
12
12
|
|
@@ -29,5 +29,6 @@ Furthermore, if the i18n gem is present on your system, Rails will load it and s
|
|
29
29
|
* rudionrails (Rudolf Schmidt)
|
30
30
|
* fishman (Reza Jelveh)
|
31
31
|
* toXXIc
|
32
|
+
* jdcrutchley (Jamie Crutchley)
|
32
33
|
|
33
34
|
Copyright (c) 2010-2011 Guillaume Luccisano - g-mai|: guillaume.luccisano, released under the MIT license
|
data/lib/i18n_routing_rails32.rb
CHANGED
@@ -389,15 +389,15 @@ module I18nRouting
|
|
389
389
|
module JourneyRoute
|
390
390
|
# Alias methods in order to handle i18n routes
|
391
391
|
def self.included(mod)
|
392
|
-
mod.send :alias_method_chain, :format, :i18n_routing
|
393
392
|
mod.send :alias_method_chain, :initialize, :i18n_routing
|
393
|
+
mod.send :alias_method_chain, :score, :i18n_routing
|
394
394
|
end
|
395
395
|
|
396
396
|
# During route initialization, if a condition i18n_locale is present
|
397
397
|
# Delete it, store it in @locale, and add it to @defaults
|
398
398
|
def initialize_with_i18n_routing(name, app, path, constraints, defaults = {})
|
399
399
|
@locale = if constraints.key?(:i18n_locale)
|
400
|
-
c =
|
400
|
+
c = constraints.delete(:i18n_locale)
|
401
401
|
# In rails 3.0 it's a regexp otherwise it's a string, so we need to call source on the regexp
|
402
402
|
(c.respond_to?(:source) ? c.source : c).to_sym
|
403
403
|
else
|
@@ -406,30 +406,13 @@ module I18nRouting
|
|
406
406
|
initialize_without_i18n_routing(name, app, path, constraints, defaults)
|
407
407
|
end
|
408
408
|
|
409
|
-
#
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
return nil if @locale and @locale != I18n.locale.to_sym
|
414
|
-
format_without_i18n_routing(path_options)
|
415
|
-
end
|
416
|
-
end
|
417
|
-
|
418
|
-
|
419
|
-
# Journey::Formatter module
|
420
|
-
# Exists in order to inject the current locale in the routing options
|
421
|
-
module JourneyFormatter
|
422
|
-
def self.included(mod)
|
423
|
-
mod.send :alias_method_chain, :non_recursive, :i18n_routing
|
424
|
-
end
|
425
|
-
|
426
|
-
def non_recursive_with_i18n_routing(cache, options)
|
427
|
-
options << [:i18n_locale, I18n.locale.to_s]
|
428
|
-
non_recursive_without_i18n_routing(cache, options)
|
409
|
+
# Return low score for routes that don't match the current locale
|
410
|
+
def score_with_i18n_routing constraints
|
411
|
+
return -1 if @locale && @locale != I18n.locale.to_sym
|
412
|
+
score_without_i18n_routing constraints
|
429
413
|
end
|
430
414
|
end
|
431
415
|
end
|
432
416
|
|
433
417
|
ActionDispatch::Routing::Mapper.send :include, I18nRouting::Mapper
|
434
418
|
Journey::Route.send :include, I18nRouting::JourneyRoute
|
435
|
-
Journey::Formatter.send :include, I18nRouting::JourneyFormatter
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n_routing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-30 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
16
|
-
requirement: &
|
16
|
+
requirement: &71984090 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>'
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 0.3.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *71984090
|
25
25
|
description: I18n_routing is a plugin for Ruby on Rails that lets you easily translate
|
26
26
|
your routes trough the I18n api included in Rails since version 2.2
|
27
27
|
email: guillaume.luccisano@gmail.com
|
@@ -61,7 +61,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
61
61
|
version: '0'
|
62
62
|
segments:
|
63
63
|
- 0
|
64
|
-
hash:
|
64
|
+
hash: 738454813
|
65
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
67
67
|
requirements:
|