e9s 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -1
- data/README.textile +44 -25
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/e9s.gemspec +8 -8
- data/lib/e9s.rb +1 -0
- data/lib/generators/enrichments/enrichments_generator.rb +1 -1
- metadata +10 -10
data/CHANGELOG
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
= E9s CHANGELOG
|
2
2
|
|
3
|
+
== Version 2.2.1 (November 9, 2010)
|
4
|
+
|
5
|
+
* Fixed the Rails generators
|
6
|
+
* Explicitly requiring E9s::Engine
|
7
|
+
* Using Rich-CMS v2.1.2 and higher
|
8
|
+
* Using Rich-i18n v1.3.2 and higher
|
9
|
+
|
3
10
|
== Version 2.2.0 (November 8, 2010)
|
4
11
|
|
5
12
|
* Made E9s Rails 2 and 3 compatible (woot!)
|
6
13
|
* Using Rich-CMS v2.1.1 and higher
|
7
14
|
* Using Rich-i18n v1.3.1 and higher
|
8
|
-
* Using Rich-pluralization v1.0.6 and higher
|
9
15
|
|
10
16
|
== Version 2.1.4 (October 20, 2010)
|
11
17
|
|
data/README.textile
CHANGED
@@ -46,7 +46,7 @@ Add E9s in @Gemfile@ as a gem dependency:
|
|
46
46
|
Run the following in your console to install with Bundler:
|
47
47
|
|
48
48
|
<pre>
|
49
|
-
bundle install
|
49
|
+
sudo bundle install
|
50
50
|
</pre>
|
51
51
|
|
52
52
|
h3. Using E9s as gem in Rails 2
|
@@ -75,6 +75,25 @@ h3. Using E9s as plugin in Rails 2
|
|
75
75
|
script/plugin install git://github.com/archan937/e9s.git
|
76
76
|
</pre>
|
77
77
|
|
78
|
+
h3. Testing E9s out-of-the-box
|
79
|
+
|
80
|
+
Run the Rails console:
|
81
|
+
|
82
|
+
<pre>
|
83
|
+
rails c
|
84
|
+
</pre>
|
85
|
+
|
86
|
+
Start translating in Dutch:
|
87
|
+
|
88
|
+
<pre>
|
89
|
+
>> I18n.locale = :nl
|
90
|
+
=> :nl
|
91
|
+
>> "Male / Female".t.to_s
|
92
|
+
=> "Man / Vrouw"
|
93
|
+
>> "MORE HOUSES".t.to_s
|
94
|
+
=> "MEER HUIZEN"
|
95
|
+
</pre>
|
96
|
+
|
78
97
|
h2. Use the provided Rails generator
|
79
98
|
|
80
99
|
In order to manage translations and/or CMS content. You need the following entities:
|
@@ -102,7 +121,7 @@ h4. In Rails 2
|
|
102
121
|
Run the following in your console:
|
103
122
|
|
104
123
|
<pre>
|
105
|
-
script/generate enrichments
|
124
|
+
script/generate enrichments -m
|
106
125
|
</pre>
|
107
126
|
|
108
127
|
h2. Start specifying translations
|
@@ -264,25 +283,25 @@ When translating text, you possibly want to know the @key@, the @value@, the @lo
|
|
264
283
|
>> "MORE".t.class
|
265
284
|
=> Rich::I18n::Core::EnrichedString
|
266
285
|
>> "MORE".t.meta_data
|
267
|
-
=> {
|
286
|
+
=> {"value"=>"meer", "locale"=>:nl, "derivative_key"=>"MORE", "key"=>"word.more"}
|
268
287
|
</pre>
|
269
288
|
|
270
289
|
Keep in mind that combined translations are possible and fortunately EnrichedString is able to cope with that. A concatenated translation has @merged_strings@ which contains every segments:
|
271
290
|
|
272
291
|
<pre>
|
273
|
-
>> "More
|
274
|
-
=> "Meer
|
275
|
-
>> "More
|
276
|
-
=> ["Meer", " ", "
|
277
|
-
>> "More
|
278
|
-
=>
|
279
|
-
>> "More
|
280
|
-
=> {
|
281
|
-
>> "More
|
282
|
-
=> {
|
283
|
-
>> "
|
292
|
+
>> "More streets".t.to_s
|
293
|
+
=> "Meer straten"
|
294
|
+
>> "More answers".t.merged_strings.collect(&:to_s)
|
295
|
+
=> ["Meer", " ", "antwoorden"]
|
296
|
+
>> "More answers".t.meta_data
|
297
|
+
=> {}
|
298
|
+
>> "More answers".t.merged_strings.first.meta_data
|
299
|
+
=> {"value"=>"meer", "locale"=>:nl, "derivative_key"=>"More", "key"=>"word.more"}
|
300
|
+
>> "More answers".t.merged_strings.last.meta_data
|
301
|
+
=> {"value"=>"antwoord", "locale"=>:nl, "derivative_key"=>"answers", "key"=>"word.answer"}
|
302
|
+
>> ("one".t + " " + "question".t).to_s
|
284
303
|
=> "één vraag"
|
285
|
-
>> ("
|
304
|
+
>> ("one".t + " " + "question".t).merged_strings.collect(&:to_s)
|
286
305
|
=> ["één", " ", "vraag"]
|
287
306
|
</pre>
|
288
307
|
|
@@ -293,8 +312,8 @@ E9s adds the @to_output@ method to the String class. This returns the an @i18n t
|
|
293
312
|
<pre>
|
294
313
|
>> E9s::Engine.enable_enriched_output = true
|
295
314
|
=> true
|
296
|
-
>> "More
|
297
|
-
=> "<i18n data-value
|
315
|
+
>> "More answers".t.to_s
|
316
|
+
=> "<i18n data-value='meer' data-locale='nl' data-key='word.more' data-derivative_key='More' data-editable_input_type='' data-i18n_translation='Meer'></i18n> <i18n data-value='antwoord' data-locale='nl' data-key='word.answer' data-derivative_key='answers' data-editable_input_type='' data-i18n_translation='antwoorden'></i18n>"
|
298
317
|
</pre>
|
299
318
|
|
300
319
|
This can be very handy when implementing a CMS in which users change translations. Please note that "http://github.com/archan937/e9s-demo":http://github.com/archan937/e9s-demo uses this feature to highlight translations. Later on this will also be used in "Rich-CMS":http://github.com/archan937/rich_cms, a gem / plugin that makes inplace translating possible (please be patient for this to be released).
|
@@ -304,21 +323,21 @@ h3. I18n examples
|
|
304
323
|
As a result of the YAML file specified above, you will get the following translations in your Rails console:
|
305
324
|
|
306
325
|
<pre>
|
307
|
-
>> "word.house".t
|
326
|
+
>> "word.house".t.to_s
|
308
327
|
=> "huis"
|
309
|
-
>> "word.Event".t
|
328
|
+
>> "word.Event".t.to_s
|
310
329
|
=> "Event"
|
311
|
-
>> "LETTERS".t
|
330
|
+
>> "LETTERS".t.to_s
|
312
331
|
=> "BRIEVEN"
|
313
|
-
>> "application.index.Welcome_to_our_site".t
|
332
|
+
>> "application.index.Welcome_to_our_site".t.to_s
|
314
333
|
=> "Welcome to our site"
|
315
|
-
>> "word.users".t
|
334
|
+
>> "word.users".t.to_s
|
316
335
|
=> "gebruikers"
|
317
|
-
>> "Signs".t
|
336
|
+
>> "Signs".t.to_s
|
318
337
|
=> "Tekens"
|
319
|
-
>> "MORE USERS".t
|
338
|
+
>> "MORE USERS".t.to_s
|
320
339
|
=> "MEER GEBRUIKERS"
|
321
|
-
>> "More houses".t
|
340
|
+
>> "More houses".t.to_s
|
322
341
|
=> "Meer huizen"
|
323
342
|
</pre>
|
324
343
|
|
data/Rakefile
CHANGED
@@ -12,8 +12,8 @@ begin
|
|
12
12
|
gemspec.homepage = "http://codehero.es/rails_gems_plugins/e9s"
|
13
13
|
gemspec.author = "Paul Engel"
|
14
14
|
|
15
|
-
gemspec.add_dependency "rich_cms" , ">= 2.1.
|
16
|
-
gemspec.add_dependency "rich_i18n" , ">= 1.3.
|
15
|
+
gemspec.add_dependency "rich_cms" , ">= 2.1.2"
|
16
|
+
gemspec.add_dependency "rich_i18n" , ">= 1.3.2"
|
17
17
|
gemspec.add_dependency "rich_pluralization", ">= 1.0.6"
|
18
18
|
end
|
19
19
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.1
|
data/e9s.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{e9s}
|
8
|
-
s.version = "2.2.
|
8
|
+
s.version = "2.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Paul Engel"]
|
12
|
-
s.date = %q{2010-11-
|
12
|
+
s.date = %q{2010-11-09}
|
13
13
|
s.description = %q{E9s was created due to the need of simply implementing I18n within a Rails application. This simplifies internationalization of your Rails application making a Rails developers life much easier. E9s is divided into modules (as gem and plugin): Rich-CMS (http://github.com/archan937/rich_cms) , Rich-i18n (http://github.com/archan937/rich_i18n) and Rich-pluralization (http://github.com/archan937/rich_pluralization).}
|
14
14
|
s.email = %q{paul.engel@holder.nl}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -50,17 +50,17 @@ Gem::Specification.new do |s|
|
|
50
50
|
s.specification_version = 3
|
51
51
|
|
52
52
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
|
-
s.add_runtime_dependency(%q<rich_cms>, [">= 2.1.
|
54
|
-
s.add_runtime_dependency(%q<rich_i18n>, [">= 1.3.
|
53
|
+
s.add_runtime_dependency(%q<rich_cms>, [">= 2.1.2"])
|
54
|
+
s.add_runtime_dependency(%q<rich_i18n>, [">= 1.3.2"])
|
55
55
|
s.add_runtime_dependency(%q<rich_pluralization>, [">= 1.0.6"])
|
56
56
|
else
|
57
|
-
s.add_dependency(%q<rich_cms>, [">= 2.1.
|
58
|
-
s.add_dependency(%q<rich_i18n>, [">= 1.3.
|
57
|
+
s.add_dependency(%q<rich_cms>, [">= 2.1.2"])
|
58
|
+
s.add_dependency(%q<rich_i18n>, [">= 1.3.2"])
|
59
59
|
s.add_dependency(%q<rich_pluralization>, [">= 1.0.6"])
|
60
60
|
end
|
61
61
|
else
|
62
|
-
s.add_dependency(%q<rich_cms>, [">= 2.1.
|
63
|
-
s.add_dependency(%q<rich_i18n>, [">= 1.3.
|
62
|
+
s.add_dependency(%q<rich_cms>, [">= 2.1.2"])
|
63
|
+
s.add_dependency(%q<rich_i18n>, [">= 1.3.2"])
|
64
64
|
s.add_dependency(%q<rich_pluralization>, [">= 1.0.6"])
|
65
65
|
end
|
66
66
|
end
|
data/lib/e9s.rb
CHANGED
@@ -4,7 +4,7 @@ class EnrichmentsGenerator < Rails::Generators::Base
|
|
4
4
|
class_option :user_model , :type => :string , :default => "User" , :aliases => "-u" , :desc => "The name of the Authlogic user model."
|
5
5
|
class_option :content_model , :type => :string , :default => "CmsContent" , :aliases => "-c" , :desc => "The name of the CMS content model."
|
6
6
|
class_option :translation_model, :type => :string , :default => "Translation", :aliases => "-t" , :desc => "The name of the I18n translation model."
|
7
|
-
class_option :migrate , :type => :boolean, :default => false , :aliases => "-m" , :desc => "Run 'rake db:migrate' after generating model and migration"
|
7
|
+
class_option :migrate , :type => :boolean, :default => false , :aliases => "-m" , :desc => "Run 'rake db:migrate' after generating model and migration."
|
8
8
|
|
9
9
|
def generate_rich_cms_files
|
10
10
|
generate "rich:authlogic_user", options[:user_model]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: e9s
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 2.2.
|
9
|
+
- 1
|
10
|
+
version: 2.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Paul Engel
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-09 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 15
|
30
30
|
segments:
|
31
31
|
- 2
|
32
32
|
- 1
|
33
|
-
-
|
34
|
-
version: 2.1.
|
33
|
+
- 2
|
34
|
+
version: 2.1.2
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -42,12 +42,12 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
45
|
+
hash: 31
|
46
46
|
segments:
|
47
47
|
- 1
|
48
48
|
- 3
|
49
|
-
-
|
50
|
-
version: 1.3.
|
49
|
+
- 2
|
50
|
+
version: 1.3.2
|
51
51
|
type: :runtime
|
52
52
|
version_requirements: *id002
|
53
53
|
- !ruby/object:Gem::Dependency
|