localizer 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +8 -4
- data/VERSION +1 -1
- data/lib/localizer/config.rb +0 -1
- data/lib/localizer/routes.rb +5 -5
- data/localizer.gemspec +79 -0
- metadata +21 -10
- data/install.rb +0 -1
data/README
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
Localizer
|
2
2
|
=========
|
3
3
|
|
4
|
-
|
4
|
+
Helps with routes and helpers for Rails 2 localization.
|
5
5
|
|
6
|
+
_for now you'll have to browse code to understand usage, sorry..._
|
6
7
|
|
7
8
|
Example
|
8
9
|
=======
|
9
10
|
|
10
|
-
|
11
|
+
yoursite.com/my_action
|
12
|
+
yoursite.com/it/my_action
|
13
|
+
yoursite.com/en/my_action
|
14
|
+
yoursite.com/es/my_action
|
15
|
+
...
|
11
16
|
|
12
|
-
|
13
|
-
Copyright (c) 2009 [name of plugin creator], released under the MIT license
|
17
|
+
Copyright (c) 2009 Elia Schito, released under the MIT license
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/localizer/config.rb
CHANGED
@@ -17,7 +17,6 @@ module Localizer
|
|
17
17
|
options = pages.last.kind_of?(Hash) ? pages.pop : {}
|
18
18
|
raise ArgumentError "Missing oprtion :from => controller" unless options[:from]
|
19
19
|
config.controllers[options[:from].to_s] = pages
|
20
|
-
Rails.logger.error "******" + @config.inspect
|
21
20
|
config.locales = options[:to]
|
22
21
|
end
|
23
22
|
end
|
data/lib/localizer/routes.rb
CHANGED
@@ -9,7 +9,6 @@ module Localizer
|
|
9
9
|
def localize_path controller, action_name
|
10
10
|
self.with_options :controller => controller, :action => action_name do |site|
|
11
11
|
site.with_options :requirements => {:locale => /\w\w/} do |site_with_locale|
|
12
|
-
puts action_name
|
13
12
|
site_with_locale.connect ":locale" if action_name.to_s == 'index'
|
14
13
|
site_with_locale.connect ":locale/#{action_name}"
|
15
14
|
site_with_locale.connect ":locale/#{action_name}.htm"
|
@@ -25,7 +24,6 @@ module Localizer
|
|
25
24
|
|
26
25
|
def localize_paths_for controller, *action_names
|
27
26
|
for action_name in action_names
|
28
|
-
Rails.logger.error "******** #{controller} => #{action_name.to_s}"
|
29
27
|
localize_path controller, action_name.to_s
|
30
28
|
end
|
31
29
|
end
|
@@ -36,9 +34,11 @@ module Localizer
|
|
36
34
|
end
|
37
35
|
end
|
38
36
|
|
39
|
-
def localized_resource resource_name
|
40
|
-
|
41
|
-
|
37
|
+
def localized_resource resource_name, options = {}
|
38
|
+
options.merge! :path_prefix => ':locale',
|
39
|
+
:requirements => {:locale => Localizer.config.locales}
|
40
|
+
|
41
|
+
resources resource_name, options do |resource|
|
42
42
|
yield resource if block_given?
|
43
43
|
end
|
44
44
|
end
|
data/localizer.gemspec
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{localizer}
|
8
|
+
s.version = "0.1.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Elia Schito"]
|
12
|
+
s.date = %q{2010-04-30}
|
13
|
+
s.description = %q{Includes localization helpers for: routing, views and controllers.}
|
14
|
+
s.email = %q{perlelia@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"MIT-LICENSE",
|
20
|
+
"README",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"init.rb",
|
24
|
+
"lib/localizer.rb",
|
25
|
+
"lib/localizer/assets/flags/de.gif",
|
26
|
+
"lib/localizer/assets/flags/de_big.png",
|
27
|
+
"lib/localizer/assets/flags/de_medium.png",
|
28
|
+
"lib/localizer/assets/flags/en.gif",
|
29
|
+
"lib/localizer/assets/flags/en_big.png",
|
30
|
+
"lib/localizer/assets/flags/en_medium.png",
|
31
|
+
"lib/localizer/assets/flags/es.gif",
|
32
|
+
"lib/localizer/assets/flags/es_big.png",
|
33
|
+
"lib/localizer/assets/flags/es_medium.png",
|
34
|
+
"lib/localizer/assets/flags/fr.gif",
|
35
|
+
"lib/localizer/assets/flags/fr_big.png",
|
36
|
+
"lib/localizer/assets/flags/fr_medium.png",
|
37
|
+
"lib/localizer/assets/flags/gb.gif",
|
38
|
+
"lib/localizer/assets/flags/gb_big.png",
|
39
|
+
"lib/localizer/assets/flags/gb_medium.png",
|
40
|
+
"lib/localizer/assets/flags/it.gif",
|
41
|
+
"lib/localizer/assets/flags/it_big.png",
|
42
|
+
"lib/localizer/assets/flags/it_medium.png",
|
43
|
+
"lib/localizer/assets/flags/shadow.gif",
|
44
|
+
"lib/localizer/assets/flags/us.gif",
|
45
|
+
"lib/localizer/assets/flags/us_big.png",
|
46
|
+
"lib/localizer/assets/flags/us_medium.png",
|
47
|
+
"lib/localizer/config.rb",
|
48
|
+
"lib/localizer/controller.rb",
|
49
|
+
"lib/localizer/helper.rb",
|
50
|
+
"lib/localizer/routes.rb",
|
51
|
+
"localizer.gemspec",
|
52
|
+
"tasks/localizer_tasks.rake",
|
53
|
+
"test/localizer_test.rb",
|
54
|
+
"test/test_helper.rb",
|
55
|
+
"uninstall.rb"
|
56
|
+
]
|
57
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
58
|
+
s.require_paths = ["lib"]
|
59
|
+
s.rubygems_version = %q{1.3.6}
|
60
|
+
s.summary = %q{Rails Plugin for easing simple sites localization.}
|
61
|
+
s.test_files = [
|
62
|
+
"test/localizer_test.rb",
|
63
|
+
"test/test_helper.rb"
|
64
|
+
]
|
65
|
+
|
66
|
+
if s.respond_to? :specification_version then
|
67
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
68
|
+
s.specification_version = 3
|
69
|
+
|
70
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
71
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
72
|
+
else
|
73
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
74
|
+
end
|
75
|
+
else
|
76
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: localizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Elia Schito
|
@@ -9,19 +14,23 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-04-30 00:00:00 +02:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 2
|
30
|
+
- 9
|
23
31
|
version: 1.2.9
|
24
|
-
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
25
34
|
description: "Includes localization helpers for: routing, views and controllers."
|
26
35
|
email: perlelia@gmail.com
|
27
36
|
executables: []
|
@@ -36,7 +45,6 @@ files:
|
|
36
45
|
- Rakefile
|
37
46
|
- VERSION
|
38
47
|
- init.rb
|
39
|
-
- install.rb
|
40
48
|
- lib/localizer.rb
|
41
49
|
- lib/localizer/assets/flags/de.gif
|
42
50
|
- lib/localizer/assets/flags/de_big.png
|
@@ -64,6 +72,7 @@ files:
|
|
64
72
|
- lib/localizer/controller.rb
|
65
73
|
- lib/localizer/helper.rb
|
66
74
|
- lib/localizer/routes.rb
|
75
|
+
- localizer.gemspec
|
67
76
|
- tasks/localizer_tasks.rake
|
68
77
|
- test/localizer_test.rb
|
69
78
|
- test/test_helper.rb
|
@@ -81,18 +90,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
90
|
requirements:
|
82
91
|
- - ">="
|
83
92
|
- !ruby/object:Gem::Version
|
93
|
+
segments:
|
94
|
+
- 0
|
84
95
|
version: "0"
|
85
|
-
version:
|
86
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
97
|
requirements:
|
88
98
|
- - ">="
|
89
99
|
- !ruby/object:Gem::Version
|
100
|
+
segments:
|
101
|
+
- 0
|
90
102
|
version: "0"
|
91
|
-
version:
|
92
103
|
requirements: []
|
93
104
|
|
94
105
|
rubyforge_project:
|
95
|
-
rubygems_version: 1.3.
|
106
|
+
rubygems_version: 1.3.6
|
96
107
|
signing_key:
|
97
108
|
specification_version: 3
|
98
109
|
summary: Rails Plugin for easing simple sites localization.
|
data/install.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Install hook code here
|