e9s 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/CHANGELOG +105 -0
- data/MIT-LICENSE +20 -0
- data/README.textile +320 -0
- data/Rakefile +42 -0
- data/VERSION +1 -0
- data/e9s.gemspec +62 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/e9s.rb +18 -0
- data/lib/e9s/engine.rb +19 -0
- data/rails/init.rb +1 -0
- data/tasks/e9s_tasks.rake +4 -0
- data/test/e9s_test.rb +8 -0
- data/test/test_helper.rb +3 -0
- data/uninstall.rb +1 -0
- metadata +105 -0
data/.gitignore
ADDED
data/CHANGELOG
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
= E9s CHANGELOG
|
2
|
+
|
3
|
+
== Version 2.0.1 (July 22, 2010)
|
4
|
+
|
5
|
+
* Fixed requiring modules on initialization
|
6
|
+
|
7
|
+
== Version 2.0.0 (July 18, 2010)
|
8
|
+
|
9
|
+
* Divided code into modules (Rich-i18n and Rich-pluralization)
|
10
|
+
|
11
|
+
== Version 1.1.1 (July 10, 2010)
|
12
|
+
|
13
|
+
* Completed XSS approach implementation for printing meta data including labels and seatholders (leaving out String interpolation though!)
|
14
|
+
|
15
|
+
== Version 1.1.0 (July 9, 2010)
|
16
|
+
|
17
|
+
* Implemented XSS approach implementation for printing meta data (almost complete)
|
18
|
+
|
19
|
+
== Version 1.0.3 (July 4, 2010)
|
20
|
+
|
21
|
+
* Improved E9s::Inflector::Inflections
|
22
|
+
* Added a lot of extra Dutch inflections
|
23
|
+
* Testing Dutch pluralization with WNT verbs
|
24
|
+
|
25
|
+
== Version 1.0.2 (July 1, 2010)
|
26
|
+
|
27
|
+
* Changed label and seatholder specification for models (class name key) and named forms (key between parentheses)
|
28
|
+
|
29
|
+
== Version 1.0.1 (June 29, 2010)
|
30
|
+
|
31
|
+
* Added the 'pl' method to Symbol
|
32
|
+
|
33
|
+
== Version 1.0.0 (June 25, 2010)
|
34
|
+
|
35
|
+
* Refactored the entire code base (cleaned up the module and file structure and separated functionality)
|
36
|
+
* Corrected E9s behaviour within the Rails console
|
37
|
+
|
38
|
+
== Version 0.2.5 (June 14, 2010)
|
39
|
+
|
40
|
+
* Dupping fetched translation which fixes the alternation of translations
|
41
|
+
|
42
|
+
== Version 0.2.4 (June 10, 2010)
|
43
|
+
|
44
|
+
* Rescueing E9s::Plugin.taggify_restriction call within ActionView when rendering content
|
45
|
+
|
46
|
+
== Version 0.2.3 (June 4, 2010)
|
47
|
+
|
48
|
+
* Corrected the quick fix for interpolating meta-data containing translations
|
49
|
+
* Quick fixed interpolating meta-data containing translations
|
50
|
+
|
51
|
+
== Version 0.2.2 (June 1, 2010)
|
52
|
+
|
53
|
+
* Renamed capturing_template_content to taggify_translations
|
54
|
+
* Added E9s::Plugin.taggify_restriction to overrule translation taggifying when not authorized to translate
|
55
|
+
* Being able to trace the I18n key and options used for translation
|
56
|
+
|
57
|
+
== Version 0.2.1 (May 31, 2010)
|
58
|
+
|
59
|
+
* Removed the body tag within E9s::ActionView.sanitize_html (this fixes sanitizing Ajax content)
|
60
|
+
|
61
|
+
== Version 0.2.0 (May 28, 2010)
|
62
|
+
|
63
|
+
* Implemented meta data rendering within views
|
64
|
+
|
65
|
+
== Version 0.1.7 (May 11, 2010)
|
66
|
+
|
67
|
+
* Not capitalizing the method segment in the translation keys in the formtastic input enrichment
|
68
|
+
* Added the :capitalize option to the String.t method
|
69
|
+
* Cleaned up string.rb
|
70
|
+
* Ensuring capitalized labels and seatholders within Formtastic forms again
|
71
|
+
|
72
|
+
== Version 0.1.6 (April 20, 2010)
|
73
|
+
|
74
|
+
* Fixed bug when calling "".upcase_first and "".upcase_first!
|
75
|
+
* Updated nl.yml
|
76
|
+
* Added test assertions
|
77
|
+
|
78
|
+
== Version 0.1.5 (April 18, 2010)
|
79
|
+
|
80
|
+
* Using ActionController::Dispatcher.to_prepare to enrich Formtastic
|
81
|
+
|
82
|
+
== Version 0.1.4 (April 13, 2010)
|
83
|
+
|
84
|
+
* Corrected I18n backend reloading
|
85
|
+
|
86
|
+
== Version 0.1.3 (April 11, 2010)
|
87
|
+
|
88
|
+
* Being able to derive the correct I18n keys for labels and seatholders of nested attributes with Formtastic
|
89
|
+
|
90
|
+
== Version 0.1.2 (April 8, 2010)
|
91
|
+
|
92
|
+
* Only requiring e9s lib files on initialization
|
93
|
+
* Adding e9s locales to I18n.load_path on initialization
|
94
|
+
* Reduced content of locales/nl.yml
|
95
|
+
|
96
|
+
== Version 0.1.1 (April 6, 2010)
|
97
|
+
|
98
|
+
* Added more test assertions for combined translations (e.g. "Male / Female".t equals "Man / Vrouw")
|
99
|
+
* Added a small correction in the String.cp_case method
|
100
|
+
* Specified several dutch translations (singular)
|
101
|
+
* Testing the E9s::Plugin on singular translations, plural translations, cased translations and combined translations
|
102
|
+
|
103
|
+
== Version 0.1.0 (April 5, 2010)
|
104
|
+
|
105
|
+
* Initial release
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Paul Engel
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.textile
ADDED
@@ -0,0 +1,320 @@
|
|
1
|
+
|
2
|
+
h1. E9s
|
3
|
+
|
4
|
+
Enrichments (e9s) for internationalization (i18n) and localized pluralization
|
5
|
+
|
6
|
+
h2. Introduction
|
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:
|
9
|
+
|
10
|
+
h3. I18n
|
11
|
+
|
12
|
+
* @Localized pluralization@ - Translations only in singular form are sufficient enough as E9s can pluralize in foreign languages
|
13
|
+
* @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
|
+
* @An easy interface@ - Just call the @t@ method on string or symbols to translate and @pl@ to pluralize
|
15
|
+
* @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)
|
17
|
+
|
18
|
+
h3. Formtastic
|
19
|
+
|
20
|
+
* @Labels, seatholders and default values@ - Not only translate labels, but also hint text (so called @seatholders@) and even translate default values
|
21
|
+
* @Unobtrusive implementation@ - Translate labels and seatholders unobtrusively, in other words: leave your @semantic_form_for@ (view) code completely untouched
|
22
|
+
* @Specific translations@ - Not only specify general translations for labels and seatholders, but make them model or even form specific
|
23
|
+
|
24
|
+
h3. Inflections
|
25
|
+
|
26
|
+
* @Preserve character casing@ - E9s preserves the casing in your translations: @"save".t@ returns @"bewaar"@, @"Save".t@ returns @"Bewaar"@ and @"SAVE".t@ returns @"BEWAAR"@ in Dutch
|
27
|
+
* @Preserve pluralization@ - E9s singularizes or pluralizes your translations depending on the key: @"house".t@ returns @"huis"@ and @"Houses".t@ returns @"Huizen"@ in Dutch
|
28
|
+
|
29
|
+
h2. Installation
|
30
|
+
|
31
|
+
Install the E9s gem:
|
32
|
+
|
33
|
+
<pre>
|
34
|
+
sudo gem install e9s
|
35
|
+
</pre>
|
36
|
+
|
37
|
+
Add e9s in environment.rb as a gem dependency:
|
38
|
+
|
39
|
+
<pre>
|
40
|
+
config.gem "e9s"
|
41
|
+
</pre>
|
42
|
+
|
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
|
+
h3. Testing E9s out-of-the-box
|
54
|
+
|
55
|
+
Set the default locale to @:nl@ in @environment.rb@:
|
56
|
+
|
57
|
+
<pre>
|
58
|
+
config.i18n.default_locale = :nl
|
59
|
+
</pre>
|
60
|
+
|
61
|
+
Run the Rails console:
|
62
|
+
|
63
|
+
<pre>
|
64
|
+
./script/console
|
65
|
+
</pre>
|
66
|
+
|
67
|
+
Start translating in Dutch:
|
68
|
+
|
69
|
+
<pre>
|
70
|
+
>> "MORE HOUSES".t
|
71
|
+
=> "MEER HUIZEN"
|
72
|
+
</pre>
|
73
|
+
|
74
|
+
h2. Usage
|
75
|
+
|
76
|
+
h3. Populating config/locales
|
77
|
+
|
78
|
+
At default, I18n uses @I18n::Backend::Simple@ of which translations are stored within YAML files located in @config/locales@. When adding a new language, it is adviced to copy a YAML file from "http://github.com/svenfuchs/rails-i18n/tree/master/rails/locale":http://github.com/svenfuchs/rails-i18n/tree/master/rails/locale in which you can add your translations. Of course, you can also use other I18n backends like @I18n::Backend::ActiveRecord@ for translations stored in the database.
|
79
|
+
|
80
|
+
h3. Words
|
81
|
+
|
82
|
+
As E9s automatically singularizes or pluralizes the translation (depending on the passed key), you only have to specify translations in singular form.
|
83
|
+
|
84
|
+
*Note*: specified in @config/locales/nl.yml@
|
85
|
+
|
86
|
+
<pre>
|
87
|
+
---
|
88
|
+
nl:
|
89
|
+
|
90
|
+
word:
|
91
|
+
"yes": ja
|
92
|
+
"no": nee
|
93
|
+
house: huis
|
94
|
+
letter: brief
|
95
|
+
sign: teken
|
96
|
+
user: gebruiker
|
97
|
+
more: meer
|
98
|
+
</pre>
|
99
|
+
|
100
|
+
h3. Pluralization
|
101
|
+
|
102
|
+
A *very powerful* feature of E9s is pluralization which resembles the inflections of @ActiveSupport::Inflector@. Unfortunately, specifying inflections within @config/initializers/inflections.rb@ also influences your Rails application and thus causes great problems.
|
103
|
+
|
104
|
+
E9s provides you to specify pluralization rules for different locales. You have to use regular expressions in order to specify them.
|
105
|
+
|
106
|
+
*Note*: specified in @config/locales/nl.yml@
|
107
|
+
|
108
|
+
<pre>
|
109
|
+
---
|
110
|
+
nl:
|
111
|
+
|
112
|
+
e9s:
|
113
|
+
singular:
|
114
|
+
- rule: en$
|
115
|
+
replacement: ""
|
116
|
+
|
117
|
+
plural:
|
118
|
+
- rule: ee$
|
119
|
+
replacement: eeën
|
120
|
+
|
121
|
+
- rule: heid$
|
122
|
+
replacement: heden
|
123
|
+
|
124
|
+
- rule: (c|m|n|t)us$
|
125
|
+
replacement: \1i
|
126
|
+
|
127
|
+
- rule: | abc, acme, acne, (a|ë|i|o|u|y)$
|
128
|
+
replacement: \1's
|
129
|
+
exceptions: (ai|eau|ei|li|lieu|ooi|ou|shampoo|spray|vlo)$
|
130
|
+
|
131
|
+
- rule: (blad|kind)$
|
132
|
+
replacement: \1eren
|
133
|
+
exceptions: (aanrecht|advertentie)blad
|
134
|
+
|
135
|
+
- rule: (e|em|el|er|erd|aar|aard|um|eur|foon|oor|ier|en|ie|eau|show|festival|é)$
|
136
|
+
replacement: \1s
|
137
|
+
|
138
|
+
- rule: | (a|e|o|u)\1([^aeiou])$
|
139
|
+
replacement: \1\2en
|
140
|
+
|
141
|
+
- rule: | (aï|alia)(s),
|
142
|
+
([^aeiou][aeiou])([^aeiou])$
|
143
|
+
replacement: \1\2\2en
|
144
|
+
exceptions: dal, pad, slot, vat, weg,
|
145
|
+
(blad|dag|dak|engel|gat|weg)$
|
146
|
+
|
147
|
+
- rule: f$
|
148
|
+
replacement: ven
|
149
|
+
|
150
|
+
- rule: s$
|
151
|
+
replacement: zen
|
152
|
+
|
153
|
+
- rule: $
|
154
|
+
replacement: en
|
155
|
+
|
156
|
+
irregular:
|
157
|
+
gelid: gelederen
|
158
|
+
|
159
|
+
uncountable:
|
160
|
+
- geld
|
161
|
+
- informatie
|
162
|
+
- rijst
|
163
|
+
</pre>
|
164
|
+
|
165
|
+
For a complete example, please open "http://github.com/archan937/rich_pluralization/blob/master/locales/nl.yml":http://github.com/archan937/rich_pluralization/blob/master/locales/nl.yml which contains Dutch inflections.
|
166
|
+
|
167
|
+
h3. String / Symbol methods
|
168
|
+
|
169
|
+
E9s adds the following methods to strings and symbols:
|
170
|
+
|
171
|
+
* @t@ - which translates the string or symbol
|
172
|
+
* @pl@ - which pluralizes the string or symbol with inflections of the current I18n locale
|
173
|
+
|
174
|
+
Further more, E9s has enriched the String class with other inflection methods such as @upcase_first@, @cp_case@, @upcase_first!@ and @pluralize!@. Please visit "http://github.com/archan937/rich_i18n/blob/master/lib/rich/i18n/core/string/inflections.rb":http://github.com/archan937/rich_i18n/blob/master/lib/rich/i18n/core/string/inflections.rb to see all the methods.
|
175
|
+
|
176
|
+
h3. Default values and case preservation
|
177
|
+
|
178
|
+
When not specified, E9s returns a default value based on the passed key: it splits the key on @"."@ and (sort of) humanizes the last part. Sort of, because it actually replaces @"_"@ with @" "@ and it copies the casing of the key with the @cp_case@ method of the @String@ class.
|
179
|
+
|
180
|
+
h3. Combined keys
|
181
|
+
|
182
|
+
You can combine translations by using passed string containing translation keys joined with spaces.
|
183
|
+
|
184
|
+
h3. Translation meta data with EnrichedString
|
185
|
+
|
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:
|
187
|
+
|
188
|
+
<pre>
|
189
|
+
>> "MORE".t.class
|
190
|
+
=> Rich::I18n::Core::EnrichedString
|
191
|
+
>> "MORE".t.meta_data
|
192
|
+
=> {:actual_key=>"word.more", :key=>"MORE", :actual_value=>"MEER"}
|
193
|
+
</pre>
|
194
|
+
|
195
|
+
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:
|
196
|
+
|
197
|
+
<pre>
|
198
|
+
>> "More users".t
|
199
|
+
=> "Meer gebruikers"
|
200
|
+
>> "More users".t.merged_strings
|
201
|
+
=> ["Meer", "gebruikers"]
|
202
|
+
>> "More users".t.meta_data
|
203
|
+
=> nil
|
204
|
+
>> "More users".t.merged_strings.first.meta_data
|
205
|
+
=> {:actual_key=>"word.more", :key=>"More", :actual_value=>"Meer"}
|
206
|
+
>> "More users".t.merged_strings.last.meta_data
|
207
|
+
=> {:actual_key=>"word.user", :key=>"users", :actual_value=>"gebruiker"}
|
208
|
+
>> "One".t + " " + "question".t
|
209
|
+
=> "één vraag"
|
210
|
+
>> ("One".t + " " + "question".t).merged_strings
|
211
|
+
=> ["één", " ", "vraag"]
|
212
|
+
</pre>
|
213
|
+
|
214
|
+
h3. String.to_output
|
215
|
+
|
216
|
+
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
|
+
|
218
|
+
<pre>
|
219
|
+
>> "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>"
|
221
|
+
</pre>
|
222
|
+
|
223
|
+
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).
|
224
|
+
|
225
|
+
h3. I18n examples
|
226
|
+
|
227
|
+
As a result of the YAML file specified above, you will get the following translations in your Rails console:
|
228
|
+
|
229
|
+
<pre>
|
230
|
+
>> "word.house".t
|
231
|
+
=> "huis"
|
232
|
+
>> "word.Event".t
|
233
|
+
=> "Event"
|
234
|
+
>> "LETTERS".t
|
235
|
+
=> "BRIEVEN"
|
236
|
+
>> "application.index.Welcome_to_our_site".t
|
237
|
+
=> "Welcome to our site"
|
238
|
+
>> "word.users".t
|
239
|
+
=> "gebruikers"
|
240
|
+
>> "Signs".t
|
241
|
+
=> "Tekens"
|
242
|
+
>> "MORE USERS".t
|
243
|
+
=> "MEER GEBRUIKERS"
|
244
|
+
>> "More houses".t
|
245
|
+
=> "Meer huizen"
|
246
|
+
</pre>
|
247
|
+
|
248
|
+
h3. Labels and seatholders
|
249
|
+
|
250
|
+
You can translate @labels@ and @seatholders@ (placeholders :D) within Formtastic forms without altering its code.
|
251
|
+
|
252
|
+
*Note*: specified in @config/locales/nl.yml@
|
253
|
+
|
254
|
+
<pre>
|
255
|
+
---
|
256
|
+
nl:
|
257
|
+
|
258
|
+
word:
|
259
|
+
password: wachtwoord
|
260
|
+
|
261
|
+
label:
|
262
|
+
user_name: gebruikersnaam
|
263
|
+
content: bericht
|
264
|
+
|
265
|
+
Question:
|
266
|
+
content: jouw vraag
|
267
|
+
|
268
|
+
Answer:
|
269
|
+
content: jouw antwoord
|
270
|
+
|
271
|
+
(search_form)
|
272
|
+
criteria: uw zoekcriteria
|
273
|
+
|
274
|
+
seatholder:
|
275
|
+
email_address: uw.naam@een.website.nl
|
276
|
+
|
277
|
+
Question:
|
278
|
+
content: Hoeveel uren zitten in een dag?
|
279
|
+
|
280
|
+
Answer:
|
281
|
+
content: 24 uur
|
282
|
+
|
283
|
+
(search_form)
|
284
|
+
criteria: '&Voorbeeld'
|
285
|
+
</pre>
|
286
|
+
|
287
|
+
h2. Contact me
|
288
|
+
|
289
|
+
For support, remarks and requests please mail me at "paul.engel@holder.nl":mailto:paul.engel@holder.nl.
|
290
|
+
|
291
|
+
h2. Credit
|
292
|
+
|
293
|
+
This Rails gem depends on:
|
294
|
+
|
295
|
+
rich_pluralization<br>
|
296
|
+
"http://github.com/archan937/rich_pluralization":http://github.com/archan937/rich_pluralization
|
297
|
+
|
298
|
+
rich_i18n<br>
|
299
|
+
"http://github.com/archan937/rich_i18n":http://github.com/archan937/rich_i18n
|
300
|
+
|
301
|
+
i18n<br>
|
302
|
+
"http://github.com/svenfuchs/i18n":http://github.com/svenfuchs/i18n
|
303
|
+
|
304
|
+
Formtastic (optional)<br>
|
305
|
+
"http://github.com/justinfrench/formtastic":http://github.com/justinfrench/formtastic
|
306
|
+
|
307
|
+
SeatHolder (optional)<br>
|
308
|
+
"http://github.com/archan937/seat_holder":http://github.com/archan937/seat_holder
|
309
|
+
|
310
|
+
h2. License
|
311
|
+
|
312
|
+
Copyright (c) 2010 Paul Engel, released under the MIT license
|
313
|
+
|
314
|
+
"http://holder.nl":http://holder.nl - "http://codehero.es":http://codehero.es - "http://gettopup.com":http://gettopup.com - "http://twitter.com/archan937":http://twitter.com/archan937 - "paul.engel@holder.nl":mailto:paul.engel@holder.nl
|
315
|
+
|
316
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
317
|
+
|
318
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
319
|
+
|
320
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require "rake"
|
2
|
+
require "rake/testtask"
|
3
|
+
require "rake/rdoctask"
|
4
|
+
|
5
|
+
begin
|
6
|
+
require "jeweler"
|
7
|
+
Jeweler::Tasks.new do |gemspec|
|
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)."
|
11
|
+
gemspec.email = "paul.engel@holder.nl"
|
12
|
+
gemspec.homepage = "http://github.com/archan937/e9s"
|
13
|
+
gemspec.author = "Paul Engel"
|
14
|
+
|
15
|
+
gemspec.add_dependency "rich_i18n"
|
16
|
+
gemspec.add_dependency "rich_pluralization"
|
17
|
+
end
|
18
|
+
Jeweler::GemcutterTasks.new
|
19
|
+
rescue LoadError
|
20
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Default: run unit tests."
|
24
|
+
task :default => :test
|
25
|
+
|
26
|
+
desc "Test the e9s plugin."
|
27
|
+
Rake::TestTask.new(:test) do |t|
|
28
|
+
t.libs << "lib"
|
29
|
+
t.libs << "test"
|
30
|
+
t.pattern = "test/**/*_test.rb"
|
31
|
+
t.verbose = true
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Generate documentation for the e9s plugin."
|
35
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
36
|
+
rdoc.rdoc_dir = "rdoc"
|
37
|
+
rdoc.title = "E9s"
|
38
|
+
rdoc.options << "--line-numbers" << "--inline-source"
|
39
|
+
rdoc.rdoc_files.include "README"
|
40
|
+
rdoc.rdoc_files.include "MIT-LICENSE"
|
41
|
+
rdoc.rdoc_files.include "lib/**/*.rb"
|
42
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.1
|
data/e9s.gemspec
ADDED
@@ -0,0 +1,62 @@
|
|
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{e9s}
|
8
|
+
s.version = "2.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
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).}
|
14
|
+
s.email = %q{paul.engel@holder.nl}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.textile"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"CHANGELOG",
|
21
|
+
"MIT-LICENSE",
|
22
|
+
"README.textile",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"e9s.gemspec",
|
26
|
+
"init.rb",
|
27
|
+
"install.rb",
|
28
|
+
"lib/e9s.rb",
|
29
|
+
"lib/e9s/engine.rb",
|
30
|
+
"rails/init.rb",
|
31
|
+
"tasks/e9s_tasks.rake",
|
32
|
+
"test/e9s_test.rb",
|
33
|
+
"test/test_helper.rb",
|
34
|
+
"uninstall.rb"
|
35
|
+
]
|
36
|
+
s.homepage = %q{http://github.com/archan937/e9s}
|
37
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
38
|
+
s.require_paths = ["lib"]
|
39
|
+
s.rubygems_version = %q{1.3.7}
|
40
|
+
s.summary = %q{Enrichments (e9s) for internationalization (i18n) and localized pluralization}
|
41
|
+
s.test_files = [
|
42
|
+
"test/e9s_test.rb",
|
43
|
+
"test/test_helper.rb"
|
44
|
+
]
|
45
|
+
|
46
|
+
if s.respond_to? :specification_version then
|
47
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
48
|
+
s.specification_version = 3
|
49
|
+
|
50
|
+
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"])
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<rich_i18n>, [">= 0"])
|
55
|
+
s.add_dependency(%q<rich_pluralization>, [">= 0"])
|
56
|
+
end
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<rich_i18n>, [">= 0"])
|
59
|
+
s.add_dependency(%q<rich_pluralization>, [">= 0"])
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "rails", "init")
|
data/install.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Install hook code here
|
data/lib/e9s.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
module E9s
|
3
|
+
extend self
|
4
|
+
|
5
|
+
MODULES = %w(i18n pluralization)
|
6
|
+
|
7
|
+
def require_modules
|
8
|
+
MODULES.each do |mod|
|
9
|
+
require "rich_#{mod}"
|
10
|
+
end
|
11
|
+
rescue LoadError => e
|
12
|
+
# Re-raise as RuntimeError because Mongrel would swallow LoadError.
|
13
|
+
raise e.to_s
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
E9s.require_modules
|
data/lib/e9s/engine.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
module E9s
|
3
|
+
module Engine
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def method_missing(method, *args)
|
7
|
+
MODULES.detect do |mod|
|
8
|
+
m = "rich/#{mod}/engine".camelize.constantize
|
9
|
+
|
10
|
+
if m.respond_to?(method)
|
11
|
+
m.send method, *args
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/rails/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "e9s"
|
data/test/e9s_test.rb
ADDED
data/test/test_helper.rb
ADDED
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: e9s
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 2
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 2.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Paul Engel
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-07-22 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rich_i18n
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rich_pluralization
|
35
|
+
prerelease: false
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
version: "0"
|
44
|
+
type: :runtime
|
45
|
+
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)."
|
47
|
+
email: paul.engel@holder.nl
|
48
|
+
executables: []
|
49
|
+
|
50
|
+
extensions: []
|
51
|
+
|
52
|
+
extra_rdoc_files:
|
53
|
+
- README.textile
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- CHANGELOG
|
57
|
+
- MIT-LICENSE
|
58
|
+
- README.textile
|
59
|
+
- Rakefile
|
60
|
+
- VERSION
|
61
|
+
- e9s.gemspec
|
62
|
+
- init.rb
|
63
|
+
- install.rb
|
64
|
+
- lib/e9s.rb
|
65
|
+
- lib/e9s/engine.rb
|
66
|
+
- rails/init.rb
|
67
|
+
- tasks/e9s_tasks.rake
|
68
|
+
- test/e9s_test.rb
|
69
|
+
- test/test_helper.rb
|
70
|
+
- uninstall.rb
|
71
|
+
has_rdoc: true
|
72
|
+
homepage: http://github.com/archan937/e9s
|
73
|
+
licenses: []
|
74
|
+
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options:
|
77
|
+
- --charset=UTF-8
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
version: "0"
|
96
|
+
requirements: []
|
97
|
+
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.3.7
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: Enrichments (e9s) for internationalization (i18n) and localized pluralization
|
103
|
+
test_files:
|
104
|
+
- test/e9s_test.rb
|
105
|
+
- test/test_helper.rb
|