e9s 2.0.1 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,15 @@
1
1
  = E9s CHANGELOG
2
2
 
3
+ == Version 2.1.1 (October 1, 2010)
4
+
5
+ * Added rails generator 'enrichments'
6
+ * Updated gem dependencies
7
+
8
+ == Version 2.1.0 (August 15, 2010)
9
+
10
+ * Added Rich-CMS (yay!)
11
+ * Being to translate in the frontend
12
+
3
13
  == Version 2.0.1 (July 22, 2010)
4
14
 
5
15
  * Fixed requiring modules on initialization
data/README.textile CHANGED
@@ -1,19 +1,26 @@
1
1
 
2
2
  h1. E9s
3
3
 
4
- Enrichments (e9s) for internationalization (i18n) and localized pluralization
4
+ Enrichments (e9s) for pluggable a CMS, internationalization (i18n) and localized pluralization
5
5
 
6
6
  h2. Introduction
7
7
 
8
- 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-i18n":http://github.com/archan937/rich_i18n and "Rich-pluralization":http://github.com/archan937/rich_pluralization. A list of E9s' features:
8
+ 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. A list of E9s' features:
9
+
10
+ h3. Pluggable CMS
11
+
12
+ * @Easy setup@ - Rich-CMS only has a two-liner setup
13
+ * @Authentication@ - Easily specify the authentication logic to be used
14
+ * @Add editable content@ - Easily specify content available within the CMS by registering them
9
15
 
10
16
  h3. I18n
11
17
 
18
+ * @Translate on-site@ - Just specify you want to use Rich-CMS and you are set to translate in the front-end
12
19
  * @Localized pluralization@ - Translations only in singular form are sufficient enough as E9s can pluralize in foreign languages
13
20
  * @Default values@ - Use the translation key (or a portion) as default value: @"continue".t@ returns @"continue"@ and @"text.Welcome_to_our_site".t@ returns @"Welcome to our site"@
14
21
  * @An easy interface@ - Just call the @t@ method on string or symbols to translate and @pl@ to pluralize
15
22
  * @Combine translations@ - Joining keys with spaces combines translations: @"More houses".t@ returns @"Meer huizen"@ in Dutch
16
- * @Preserve i18n meta data@ - E9s preserves the key, the actual used I18n key and the actual translation which you can enquire (this can come in handy when implementing a CMS)
23
+ * @Preserve i18n meta data@ - Rich-i18n preserves the translation @key@, @value@, @locale@ and @derivative key@ (the argument passed for translation). Enquiring this can come in handy when implementing an internationalization CMS (see "Rich-CMS":http://github.com/archan937/rich_cms).
17
24
 
18
25
  h3. Formtastic
19
26
 
@@ -40,16 +47,6 @@ Add e9s in environment.rb as a gem dependency:
40
47
  config.gem "e9s"
41
48
  </pre>
42
49
 
43
- h3. Optional
44
-
45
- When wanting to use @seatholders@, please include @seat_holder.js@ in your template:
46
-
47
- <pre>
48
- <script src="path/to/seat_holder.js" type="text/javascript"></script>
49
- </pre>
50
-
51
- *Note*: please visit "http://github.com/archan937/seat_holder":http://github.com/archan937/seat_holder for more information about SeatHolder.
52
-
53
50
  h3. Testing E9s out-of-the-box
54
51
 
55
52
  Set the default locale to @:nl@ in @environment.rb@:
@@ -183,13 +180,13 @@ You can combine translations by using passed string containing translation keys
183
180
 
184
181
  h3. Translation meta data with EnrichedString
185
182
 
186
- When translating text, you possibly want to know the @used key@, the @actual used I18n key@ and its @actual translation@. E9s preserves just that in an @EnrichedString@ which is a subclass of @String@. Calling @.meta_data@ returns a hash with the meta data:
183
+ When translating text, you possibly want to know the @key@, the @value@, the @locale@ and the @derivative key@ (the argument passed for translation). Rich-i18n preserves just that in an @EnrichedString@ which is a subclass of @String@. Calling @.meta_data@ returns a hash with the meta data:
187
184
 
188
185
  <pre>
189
186
  >> "MORE".t.class
190
187
  => Rich::I18n::Core::EnrichedString
191
188
  >> "MORE".t.meta_data
192
- => {:actual_key=>"word.more", :key=>"MORE", :actual_value=>"MEER"}
189
+ => {:locale=>:nl, :value=>"meer", :derivative_key=>"MORE", :key=>"word.more"}
193
190
  </pre>
194
191
 
195
192
  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:
@@ -198,13 +195,13 @@ Keep in mind that combined translations are possible and fortunately EnrichedStr
198
195
  >> "More users".t
199
196
  => "Meer gebruikers"
200
197
  >> "More users".t.merged_strings
201
- => ["Meer", "gebruikers"]
198
+ => ["Meer", " ", "gebruikers"]
202
199
  >> "More users".t.meta_data
203
200
  => nil
204
201
  >> "More users".t.merged_strings.first.meta_data
205
- => {:actual_key=>"word.more", :key=>"More", :actual_value=>"Meer"}
202
+ => {:locale=>:nl, :value=>"meer", :derivative_key=>"More", :key=>"word.more"}
206
203
  >> "More users".t.merged_strings.last.meta_data
207
- => {:actual_key=>"word.user", :key=>"users", :actual_value=>"gebruiker"}
204
+ => {:locale=>:nl, :value=>"gebruiker", :derivative_key=>"users", :key=>"word.user"}
208
205
  >> "One".t + " " + "question".t
209
206
  => "één vraag"
210
207
  >> ("One".t + " " + "question".t).merged_strings
@@ -216,8 +213,10 @@ h3. String.to_output
216
213
  E9s adds the @to_output@ method to the String class. This returns the an @i18n tag@ with @HTML 5 attributes@ in which the translation meta data is provided:
217
214
 
218
215
  <pre>
216
+ >> E9s::Engine.enable_enriched_output = true
217
+ => true
219
218
  >> "More users".t.to_output
220
- => "<i18n data-actual_key=\"word.more\" data-key=\"More\" data-actual_value=\"Meer\">Meer</i18n><i18n data-actual_key=\"word.user\" data-key=\"users\" data-actual_value=\"gebruiker\">gebruikers</i18n>"
219
+ => "<i18n data-value=\"meer\" data-locale=\"nl\" data-key=\"word.more\" data-derivative_key=\"More\">Meer</i18n> <i18n data-value=\"gebruiker\" data-locale=\"nl\" data-key=\"word.user\" data-derivative_key=\"users\">gebruikers</i18n>"
221
220
  </pre>
222
221
 
223
222
  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).
@@ -290,23 +289,36 @@ For support, remarks and requests please mail me at "paul.engel@holder.nl":mailt
290
289
 
291
290
  h2. Credit
292
291
 
293
- This Rails gem depends on:
292
+ This Rails gem / plugin depends on:
294
293
 
295
- rich_pluralization<br>
296
- "http://github.com/archan937/rich_pluralization":http://github.com/archan937/rich_pluralization
294
+ Rich-CMS<br>
295
+ "http://github.com/archan937/rich_cms":http://github.com/archan937/rich_cms
297
296
 
298
- rich_i18n<br>
297
+ Rich-i18n<br>
299
298
  "http://github.com/archan937/rich_i18n":http://github.com/archan937/rich_i18n
300
299
 
300
+ Rich-pluralization<br>
301
+ "http://github.com/archan937/rich_pluralization":http://github.com/archan937/rich_pluralization
302
+
301
303
  i18n<br>
302
304
  "http://github.com/svenfuchs/i18n":http://github.com/svenfuchs/i18n
303
305
 
304
- Formtastic (optional)<br>
306
+ Formtastic<br>
305
307
  "http://github.com/justinfrench/formtastic":http://github.com/justinfrench/formtastic
306
308
 
307
- SeatHolder (optional)<br>
309
+ SeatHolder<br>
308
310
  "http://github.com/archan937/seat_holder":http://github.com/archan937/seat_holder
309
311
 
312
+ h2. E9s
313
+
314
+ E9s - "http://github.com/archan937/e9s":http://github.com/archan937/e9s
315
+
316
+ h3. E9s modules
317
+
318
+ * Rich-CMS - "http://github.com/archan937/rich_cms":http://github.com/archan937/rich_cms
319
+ * Rich-i18n - "http://github.com/archan937/rich_i18n":http://github.com/archan937/rich_i18n
320
+ * Rich-pluralization - "http://github.com/archan937/rich_pluralization":http://github.com/archan937/rich_pluralization
321
+
310
322
  h2. License
311
323
 
312
324
  Copyright (c) 2010 Paul Engel, released under the MIT license
data/Rakefile CHANGED
@@ -6,14 +6,15 @@ begin
6
6
  require "jeweler"
7
7
  Jeweler::Tasks.new do |gemspec|
8
8
  gemspec.name = "e9s"
9
- gemspec.summary = "Enrichments (e9s) for internationalization (i18n) and localized pluralization"
10
- gemspec.description = "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-i18n (http://github.com/archan937/rich_i18n) and Rich-pluralization (http://github.com/archan937/rich_pluralization)."
9
+ gemspec.summary = "Enrichments (e9s) for a pluggable CMS, internationalization (i18n) and localized pluralization"
10
+ gemspec.description = "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)."
11
11
  gemspec.email = "paul.engel@holder.nl"
12
12
  gemspec.homepage = "http://github.com/archan937/e9s"
13
13
  gemspec.author = "Paul Engel"
14
14
 
15
- gemspec.add_dependency "rich_i18n"
16
- gemspec.add_dependency "rich_pluralization"
15
+ gemspec.add_dependency "rich_cms" , ">= 2.0.4"
16
+ gemspec.add_dependency "rich_i18n" , ">= 1.2.0"
17
+ gemspec.add_dependency "rich_pluralization", ">= 1.0.3"
17
18
  end
18
19
  Jeweler::GemcutterTasks.new
19
20
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.1
1
+ 2.1.1
data/e9s.gemspec CHANGED
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{e9s}
8
- s.version = "2.0.1"
8
+ s.version = "2.1.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-07-22}
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-i18n (http://github.com/archan937/rich_i18n) and Rich-pluralization (http://github.com/archan937/rich_pluralization).}
12
+ s.date = %q{2010-10-01}
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 = [
16
16
  "README.textile"
@@ -26,8 +26,11 @@ Gem::Specification.new do |s|
26
26
  "init.rb",
27
27
  "install.rb",
28
28
  "lib/e9s.rb",
29
+ "lib/e9s/actionpack.rb",
30
+ "lib/e9s/actionpack/action_view/base.rb",
29
31
  "lib/e9s/engine.rb",
30
32
  "rails/init.rb",
33
+ "rails_generators/enrichments/enrichments_generator.rb",
31
34
  "tasks/e9s_tasks.rake",
32
35
  "test/e9s_test.rb",
33
36
  "test/test_helper.rb",
@@ -37,7 +40,7 @@ Gem::Specification.new do |s|
37
40
  s.rdoc_options = ["--charset=UTF-8"]
38
41
  s.require_paths = ["lib"]
39
42
  s.rubygems_version = %q{1.3.7}
40
- s.summary = %q{Enrichments (e9s) for internationalization (i18n) and localized pluralization}
43
+ s.summary = %q{Enrichments (e9s) for a pluggable CMS, internationalization (i18n) and localized pluralization}
41
44
  s.test_files = [
42
45
  "test/e9s_test.rb",
43
46
  "test/test_helper.rb"
@@ -48,15 +51,18 @@ Gem::Specification.new do |s|
48
51
  s.specification_version = 3
49
52
 
50
53
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
- s.add_runtime_dependency(%q<rich_i18n>, [">= 0"])
52
- s.add_runtime_dependency(%q<rich_pluralization>, [">= 0"])
54
+ s.add_runtime_dependency(%q<rich_cms>, [">= 2.0.4"])
55
+ s.add_runtime_dependency(%q<rich_i18n>, [">= 1.2.0"])
56
+ s.add_runtime_dependency(%q<rich_pluralization>, [">= 1.0.3"])
53
57
  else
54
- s.add_dependency(%q<rich_i18n>, [">= 0"])
55
- s.add_dependency(%q<rich_pluralization>, [">= 0"])
58
+ s.add_dependency(%q<rich_cms>, [">= 2.0.4"])
59
+ s.add_dependency(%q<rich_i18n>, [">= 1.2.0"])
60
+ s.add_dependency(%q<rich_pluralization>, [">= 1.0.3"])
56
61
  end
57
62
  else
58
- s.add_dependency(%q<rich_i18n>, [">= 0"])
59
- s.add_dependency(%q<rich_pluralization>, [">= 0"])
63
+ s.add_dependency(%q<rich_cms>, [">= 2.0.4"])
64
+ s.add_dependency(%q<rich_i18n>, [">= 1.2.0"])
65
+ s.add_dependency(%q<rich_pluralization>, [">= 1.0.3"])
60
66
  end
61
67
  end
62
68
 
data/lib/e9s.rb CHANGED
@@ -1,8 +1,10 @@
1
1
 
2
+ require "e9s/actionpack"
3
+
2
4
  module E9s
3
5
  extend self
4
6
 
5
- MODULES = %w(i18n pluralization)
7
+ MODULES = %w(cms i18n pluralization)
6
8
 
7
9
  def require_modules
8
10
  MODULES.each do |mod|
@@ -0,0 +1,2 @@
1
+
2
+ require File.join(File.dirname(__FILE__), "actionpack", "action_view", "base.rb")
@@ -0,0 +1,19 @@
1
+
2
+ module ActionView
3
+ class Base
4
+
5
+ def e9s
6
+ ::E9s::MODULES.collect do |mod|
7
+ if respond_to?(method = "rich_#{mod}")
8
+ send(method)
9
+ end
10
+ end.compact.join("\n")
11
+ end
12
+
13
+ def link(name, options = nil)
14
+ options = {:class => options || name.underscore} unless options.is_a?(Hash)
15
+ link_to name, "#", options
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,62 @@
1
+ class EnrichmentsGenerator < Rails::Generator::Base
2
+ def initialize(runtime_args, runtime_options = {})
3
+ super
4
+ @user = options[:user]
5
+ @content = options[:content]
6
+ @translation = options[:translation]
7
+ end
8
+
9
+ def manifest
10
+ record do |m|
11
+ # do something
12
+ end
13
+ end
14
+
15
+ def after_generate
16
+ system "script/generate rich_authlogic_user #{options[:user] }" unless options[:user] && options[:user] .empty?
17
+ system "script/generate rich_cms_content #{options[:content] }" unless options[:content] && options[:content] .empty?
18
+ system "script/generate rich_i18n_translation #{options[:translation]}" unless options[:translation] && options[:translation].empty?
19
+
20
+ system "rake db:migrate" if options[:migrate]
21
+ end
22
+
23
+ def model_file_name
24
+ @name.underscore
25
+ end
26
+
27
+ def model_class_name
28
+ @name.classify
29
+ end
30
+
31
+ def table_name
32
+ model_file_name.gsub("/", "_").pluralize
33
+ end
34
+
35
+ def migration_file_name
36
+ "create_#{table_name}"
37
+ end
38
+
39
+ def migration_class_name
40
+ migration_file_name.camelize
41
+ end
42
+
43
+ protected
44
+
45
+ def add_options!(opt)
46
+ opt.separator ""
47
+ opt.separator "Options:"
48
+ opt.on("-u", "--user" , "The name of the Authlogic user model which is User at default." ) { |v| options[:user] = v == true ? "" : v }
49
+ opt.on("-c", "--content" , "The name of the CMS content model which is CmsContent at default." ) { |v| options[:content] = v == true ? "" : v }
50
+ opt.on("-t", "--translation", "The name of the I18n translation model which is Translation at default.") { |v| options[:translation] = v == true ? "" : v }
51
+ opt.on("-m", "--migrate" , "Run 'rake db:migrate' after generating model and migration." ) { options[:migrate] = true }
52
+ end
53
+
54
+ def banner
55
+ <<-EOS
56
+ Creates entities used by Enrichments (e9s).
57
+
58
+ USAGE: #{$0} #{spec.name}
59
+ EOS
60
+ end
61
+
62
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: e9s
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 9
4
5
  prerelease: false
5
6
  segments:
6
7
  - 2
7
- - 0
8
8
  - 1
9
- version: 2.0.1
9
+ - 1
10
+ version: 2.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Paul Engel
@@ -14,36 +15,58 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-07-22 00:00:00 +02:00
18
+ date: 2010-10-01 00:00:00 +02:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: rich_i18n
22
+ name: rich_cms
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
24
25
  none: false
25
26
  requirements:
26
27
  - - ">="
27
28
  - !ruby/object:Gem::Version
29
+ hash: 7
28
30
  segments:
31
+ - 2
29
32
  - 0
30
- version: "0"
33
+ - 4
34
+ version: 2.0.4
31
35
  type: :runtime
32
36
  version_requirements: *id001
33
37
  - !ruby/object:Gem::Dependency
34
- name: rich_pluralization
38
+ name: rich_i18n
35
39
  prerelease: false
36
40
  requirement: &id002 !ruby/object:Gem::Requirement
37
41
  none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 31
41
46
  segments:
47
+ - 1
48
+ - 2
42
49
  - 0
43
- version: "0"
50
+ version: 1.2.0
44
51
  type: :runtime
45
52
  version_requirements: *id002
46
- description: "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-i18n (http://github.com/archan937/rich_i18n) and Rich-pluralization (http://github.com/archan937/rich_pluralization)."
53
+ - !ruby/object:Gem::Dependency
54
+ name: rich_pluralization
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 17
62
+ segments:
63
+ - 1
64
+ - 0
65
+ - 3
66
+ version: 1.0.3
67
+ type: :runtime
68
+ version_requirements: *id003
69
+ description: "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)."
47
70
  email: paul.engel@holder.nl
48
71
  executables: []
49
72
 
@@ -62,8 +85,11 @@ files:
62
85
  - init.rb
63
86
  - install.rb
64
87
  - lib/e9s.rb
88
+ - lib/e9s/actionpack.rb
89
+ - lib/e9s/actionpack/action_view/base.rb
65
90
  - lib/e9s/engine.rb
66
91
  - rails/init.rb
92
+ - rails_generators/enrichments/enrichments_generator.rb
67
93
  - tasks/e9s_tasks.rake
68
94
  - test/e9s_test.rb
69
95
  - test/test_helper.rb
@@ -82,6 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
108
  requirements:
83
109
  - - ">="
84
110
  - !ruby/object:Gem::Version
111
+ hash: 3
85
112
  segments:
86
113
  - 0
87
114
  version: "0"
@@ -90,6 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
117
  requirements:
91
118
  - - ">="
92
119
  - !ruby/object:Gem::Version
120
+ hash: 3
93
121
  segments:
94
122
  - 0
95
123
  version: "0"
@@ -99,7 +127,7 @@ rubyforge_project:
99
127
  rubygems_version: 1.3.7
100
128
  signing_key:
101
129
  specification_version: 3
102
- summary: Enrichments (e9s) for internationalization (i18n) and localized pluralization
130
+ summary: Enrichments (e9s) for a pluggable CMS, internationalization (i18n) and localized pluralization
103
131
  test_files:
104
132
  - test/e9s_test.rb
105
133
  - test/test_helper.rb