dm-is-localizable 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ test_log
2
+ pkg
3
+ pkg/*
4
+ */pkg/*
5
+ bundle
6
+ bundle/*
7
+ doc
8
+ *.log
9
+ log
10
+ !log*.rb
11
+ */log
12
+ log/*
13
+ */log/*
14
+ coverage
15
+ */coverage
16
+ lib/dm-more.rb
17
+ *.db
18
+ nbproject
19
+ .DS_Store
20
+ rspec_report.html
21
+ *.swp
22
+ _Yardoc
23
+ */ri
data/CHANGELOG ADDED
@@ -0,0 +1,423 @@
1
+ [b879a46 | Thu Jun 18 16:13:36 UTC 2009] snusnu <gamsnjaga@gmail.com>
2
+
3
+ * minor README additions
4
+
5
+ [5db8c9f | Thu Jun 18 15:49:49 UTC 2009] snusnu <gamsnjaga@gmail.com>
6
+
7
+ * add #translations_attributes= method via dm-accepts_nested_attributes
8
+
9
+ * this behavior can be turned off by calling
10
+ is :localizable, :accept_nested_attributes => false do ... end
11
+
12
+ [0cb8c6f | Thu Jun 18 15:33:11 UTC 2009] snusnu <gamsnjaga@gmail.com>
13
+
14
+ * temporarily comment rspec bundle logger (needs different fix)
15
+
16
+ * also, don't use transactional fixtures anymore since they
17
+ cause weird behavior when including dm-accepts_nested_attributes
18
+ functionality which will be added in the next commit(s)
19
+
20
+ [b2bfb6c | Wed Jun 17 22:57:37 UTC 2009] snusnu <gamsnjaga@gmail.com>
21
+
22
+ * renamed translation_class method to translation_model
23
+
24
+ [c07e5f7 | Wed Jun 17 22:54:25 UTC 2009] snusnu <gamsnjaga@gmail.com>
25
+
26
+ * renamed :class_name option to :model
27
+
28
+ [7b874ae | Wed Jun 17 19:16:20 UTC 2009] snusnu <gamsnjaga@gmail.com>
29
+
30
+ * explicitly require extlib and dm-core for spec runs
31
+
32
+ * Pathname#/ is provided by extlib
33
+ * dm-validations depends on dm-core
34
+
35
+ [3bc5264 | Thu May 21 22:27:50 UTC 2009] snusnu <gamsnjaga@gmail.com>
36
+
37
+ * perform DataMapper.auto_migrate! before(:all)
38
+
39
+ [9007954 | Thu May 21 22:27:04 UTC 2009] snusnu <gamsnjaga@gmail.com>
40
+
41
+ * use transactional fixtures in sqlite3 specs
42
+
43
+ [c64d1ce | Wed May 20 17:02:45 UTC 2009] snusnu <gamsnjaga@gmail.com>
44
+
45
+ * workaround bug in dm-core-0.10.0
46
+
47
+ * this workaround is necessary to overcome:
48
+
49
+ a sql error that happens when the id array is empty
50
+
51
+ generated (invalid) sql:
52
+
53
+ WHERE "id" IN ()
54
+
55
+ [a50a50b | Wed May 20 17:00:56 UTC 2009] snusnu <gamsnjaga@gmail.com>
56
+
57
+ * fixed bug in shared specs
58
+
59
+ [e05db41 | Wed May 20 17:00:40 UTC 2009] snusnu <gamsnjaga@gmail.com>
60
+
61
+ * updated test db names
62
+
63
+ [fce05dc | Wed May 20 03:40:49 UTC 2009] snusnu <gamsnjaga@gmail.com>
64
+
65
+ * Version bump to 0.10.0
66
+
67
+ [1b92fe5 | Wed May 20 00:56:12 UTC 2009] snusnu <gamsnjaga@gmail.com>
68
+
69
+ * one failing spec but no warnings with datamapper 0.10.0
70
+
71
+ * instance level API: available_languages
72
+ with 3 translations in 2 languages
73
+ should return the right language'
74
+ FAILED
75
+
76
+ expected:
77
+ #<Language @id=1 @code="en-US" @name="English">,
78
+ got:
79
+ #<Language @id=2 @code="de-AT" @name="Deutsch">
80
+ (using ==)
81
+
82
+ [e712a32 | Wed May 20 00:54:23 UTC 2009] snusnu <gamsnjaga@gmail.com>
83
+
84
+ * added :constraint option in case dm-constraints is present
85
+
86
+ [6fab6aa | Wed May 20 00:51:40 UTC 2009] snusnu <gamsnjaga@gmail.com>
87
+
88
+ * disabled transaction fixtures for now
89
+
90
+ * find out how to achieve this with 0.10.0
91
+
92
+ * 0.9.11 code raises the following error:
93
+
94
+ undefined method `transaction_primitive' for
95
+ #<DataMapper::Adapters::Sqlite3Adapter:0x12918b8>
96
+
97
+ [88f4569 | Wed May 20 00:48:33 UTC 2009] snusnu <gamsnjaga@gmail.com>
98
+
99
+ * upgraded datamapper dependencies to 0.10.0
100
+
101
+ [0f33595 | Tue May 19 01:52:35 UTC 2009] snusnu <gamsnjaga@gmail.com>
102
+
103
+ * jeweler doesn't regenerate gemspec on rake version:bump:patch
104
+
105
+ [df67b01 | Tue May 19 01:41:46 UTC 2009] snusnu <gamsnjaga@gmail.com>
106
+
107
+ * Version bump to 0.0.9
108
+
109
+ [3de795f | Tue May 19 01:41:30 UTC 2009] snusnu <gamsnjaga@gmail.com>
110
+
111
+ * exclude removed features directory from gemspec
112
+
113
+ [ca59bf1 | Mon May 18 19:08:00 UTC 2009] snusnu <gamsnjaga@gmail.com>
114
+
115
+ * removed empty cucumber features. it's rspec only for now
116
+
117
+ [4ed37d6 | Mon May 18 18:55:53 UTC 2009] snusnu <gamsnjaga@gmail.com>
118
+
119
+ * updated README to include a hint on how to add language.rb to your app
120
+
121
+ [23b1175 | Mon May 18 18:51:39 UTC 2009] snusnu <gamsnjaga@gmail.com>
122
+
123
+ * print installation instructions for language.rb after rake install
124
+
125
+ This actually happened in an earlier commit, but jeweler's
126
+ rake version:bump:patch committed it because it was already staged
127
+ to be visible for rake gemspec.
128
+
129
+ [f33f1e3 | Mon May 18 18:49:28 UTC 2009] snusnu <gamsnjaga@gmail.com>
130
+
131
+ * Version bump to 0.0.8
132
+
133
+ [5af2511 | Mon May 18 18:09:58 UTC 2009] snusnu <gamsnjaga@gmail.com>
134
+
135
+ * updated README to reflect the actual code
136
+
137
+ [2543d3c | Mon May 18 18:07:32 UTC 2009] snusnu <gamsnjaga@gmail.com>
138
+
139
+ * README cosmetics
140
+
141
+ [f222991 | Mon May 18 17:27:34 UTC 2009] snusnu <gamsnjaga@gmail.com>
142
+
143
+ * updated README to reflect latest changes to Language
144
+
145
+ [4f350db | Mon May 18 17:25:08 UTC 2009] snusnu <gamsnjaga@gmail.com>
146
+
147
+ * updated gemspec and CHANGELOG
148
+
149
+ [59dd665 | Mon May 18 17:23:50 UTC 2009] snusnu <gamsnjaga@gmail.com>
150
+
151
+ * Version bump to 0.0.7
152
+
153
+ [845b6f0 | Mon May 18 16:44:16 UTC 2009] snusnu <gamsnjaga@gmail.com>
154
+
155
+ * more specs for the generated property translation readers
156
+
157
+ [30990da | Mon May 18 16:31:07 UTC 2009] snusnu <gamsnjaga@gmail.com>
158
+
159
+ * fixed README
160
+
161
+ [e8c9981 | Mon May 18 16:25:46 UTC 2009] snusnu <gamsnjaga@gmail.com>
162
+
163
+ * added readers that return the property translated to the target language.
164
+
165
+ If the property :name is declared to be localizable for class Item,
166
+ and there is a ItemTranslation for 'en-US', you're able to call
167
+
168
+ * i.name(:en_US)
169
+
170
+ on an instance of Item named i
171
+
172
+ [0981aa8 | Mon May 18 16:10:25 UTC 2009] snusnu <gamsnjaga@gmail.com>
173
+
174
+ * README cosmetics
175
+
176
+ [f8993ae | Mon May 18 16:07:00 UTC 2009] snusnu <gamsnjaga@gmail.com>
177
+
178
+ * added localizable_properties class level API
179
+
180
+ [9bace64 | Mon May 18 15:52:23 UTC 2009] snusnu <gamsnjaga@gmail.com>
181
+
182
+ * updated README to reflect latest API addition
183
+
184
+ [4a43df6 | Mon May 18 15:43:52 UTC 2009] snusnu <gamsnjaga@gmail.com>
185
+
186
+ * stripped whitespace, updated changelog and regenerated gemspec
187
+
188
+ [82db7fd | Mon May 18 15:42:50 UTC 2009] snusnu <gamsnjaga@gmail.com>
189
+
190
+ * Version bump to 0.0.6
191
+
192
+ [016ddd5 | Mon May 18 15:42:28 UTC 2009] snusnu <gamsnjaga@gmail.com>
193
+
194
+ * added localizable_instance.translate(attribute, language_code)
195
+
196
+ [30e7f81 | Mon May 18 15:39:08 UTC 2009] snusnu <gamsnjaga@gmail.com>
197
+
198
+ * added more specs for the remixed translation class.
199
+
200
+ Although the specs for the generated belongs_to association readers
201
+ pass, it's not possible to use :language as query condition when
202
+ calling translations.first :language => 'en-US'. Need to use
203
+ :language_id here. I've no idea why, but it could be some problem
204
+ with dm-is-remixable's enhance method, and association generation
205
+ inside this block.
206
+
207
+ TODO investigate this!
208
+
209
+ [1b3ff53 | Mon May 18 15:38:17 UTC 2009] snusnu <gamsnjaga@gmail.com>
210
+
211
+ * added Language.[](code) method
212
+
213
+ [6465349 | Mon May 18 13:28:26 UTC 2009] snusnu <gamsnjaga@gmail.com>
214
+
215
+ * removed rubygems usage from dm-is-localizable
216
+
217
+ [ce1d783 | Mon May 18 13:27:58 UTC 2009] snusnu <gamsnjaga@gmail.com>
218
+
219
+ * updated gemspec to reflect latest version
220
+
221
+ [0749a4b | Sat May 16 19:22:33 UTC 2009] snusnu <gamsnjaga@gmail.com>
222
+
223
+ * Version bump to 0.0.5
224
+
225
+ [ab0090a | Sat May 16 19:22:19 UTC 2009] snusnu <gamsnjaga@gmail.com>
226
+
227
+ * strip whitespace
228
+
229
+ [f5de7dd | Sat May 16 19:21:42 UTC 2009] snusnu <gamsnjaga@gmail.com>
230
+
231
+ * added whitespace task to gemspec
232
+
233
+ [e759d98 | Sat May 16 19:20:27 UTC 2009] snusnu <gamsnjaga@gmail.com>
234
+
235
+ * added rake task to strip whitespace (taken from brynary/webrat)
236
+
237
+ [2ad8adc | Sat May 16 19:17:42 UTC 2009] snusnu <gamsnjaga@gmail.com>
238
+
239
+ * added CHANGELOG and task to generate(update) it
240
+
241
+ [e66cccc | Sat May 16 19:02:07 UTC 2009] snusnu <gamsnjaga@gmail.com>
242
+
243
+ * Version bump to 0.0.4
244
+
245
+ [963611b | Sat May 16 19:00:47 UTC 2009] snusnu <gamsnjaga@gmail.com>
246
+
247
+ * README corrections to reflect the recently added uniqueness constraints
248
+
249
+ [47c5e1e | Sat May 16 18:56:09 UTC 2009] snusnu <gamsnjaga@gmail.com>
250
+
251
+ * added passing specs for unique language translations
252
+
253
+ [fd37d64 | Sat May 16 18:55:09 UTC 2009] snusnu <gamsnjaga@gmail.com>
254
+
255
+ * more comprehensive unique constraint violation checks for language
256
+
257
+ [15a9626 | Sat May 16 18:34:13 UTC 2009] snusnu <gamsnjaga@gmail.com>
258
+
259
+ * added passing spec for unique language codes
260
+
261
+ [20242b3 | Sat May 16 18:17:19 UTC 2009] snusnu <gamsnjaga@gmail.com>
262
+
263
+ * split spec files into better manageable chunks
264
+
265
+ [f4b6d30 | Sat May 16 17:32:46 UTC 2009] snusnu <gamsnjaga@gmail.com>
266
+
267
+ * moved rspec_tmbundle_support from specs/shared to specs/lib
268
+
269
+ [12fe27a | Sat May 16 17:26:30 UTC 2009] snusnu <gamsnjaga@gmail.com>
270
+
271
+ * added TODO file
272
+
273
+ [c66d793 | Sat May 16 17:22:51 UTC 2009] snusnu <gamsnjaga@gmail.com>
274
+
275
+ * added more class and instance level API.
276
+
277
+ These API methods mainly target the support for a UI that allows
278
+ clients to enter localized versions of their textual data (and
279
+ find out if they already completed their translations for specific
280
+ resources).
281
+
282
+ added class level API
283
+
284
+ * available_languages
285
+ * nr_of_available_languages
286
+ * translations_complete?
287
+
288
+ instance level API
289
+
290
+ * available_languages
291
+ * nr_of_available_languages
292
+ * translations_complete?
293
+
294
+ [cb462f4 | Sat May 16 17:13:57 UTC 2009] snusnu <gamsnjaga@gmail.com>
295
+
296
+ * added support for nice html output in rspec tmbundle.
297
+
298
+ [f713c84 | Sat May 16 05:33:54 UTC 2009] snusnu <gamsnjaga@gmail.com>
299
+
300
+ * Version bump to 0.0.3
301
+
302
+ [aa6188c | Sat May 16 05:33:44 UTC 2009] snusnu <gamsnjaga@gmail.com>
303
+
304
+ * added available_languages instance level API
305
+
306
+ [d5f13e1 | Sat May 16 05:12:03 UTC 2009] snusnu <gamsnjaga@gmail.com>
307
+
308
+ * README correction (available_languages is a class method)
309
+
310
+ [92bf341 | Sat May 16 05:06:05 UTC 2009] snusnu <gamsnjaga@gmail.com>
311
+
312
+ * Version bump to 0.0.2
313
+
314
+ [8de6a08 | Sat May 16 05:00:33 UTC 2009] snusnu <gamsnjaga@gmail.com>
315
+
316
+ * added specs for the translations and languages association.
317
+
318
+ I wonder if available_languages should be implemeted on top of
319
+ has n, :languages, :through => :translations
320
+
321
+ [dd4830f | Sat May 16 04:51:23 UTC 2009] snusnu <gamsnjaga@gmail.com>
322
+
323
+ * added available_languages class method API
324
+
325
+ [3596021 | Sat May 16 04:37:45 UTC 2009] snusnu <gamsnjaga@gmail.com>
326
+
327
+ * use transactional fixtures and have the loggers handy
328
+
329
+ [fa00b88 | Sat May 16 04:07:10 UTC 2009] snusnu <gamsnjaga@gmail.com>
330
+
331
+ * enforce unique language codes (locale strings)
332
+
333
+ [b7b8221 | Sat May 16 04:01:59 UTC 2009] snusnu <gamsnjaga@gmail.com>
334
+
335
+ * added missing spec for translation_class reader
336
+
337
+ [b0cd326 | Sat May 16 03:43:33 UTC 2009] snusnu <gamsnjaga@gmail.com>
338
+
339
+ * translation_class reader instead of translation_class_name
340
+
341
+ [d34352b | Sat May 16 03:31:54 UTC 2009] snusnu <gamsnjaga@gmail.com>
342
+
343
+ * jeweler generated gemspec
344
+
345
+ [0ddc194 | Sat May 16 03:28:33 UTC 2009] snusnu <gamsnjaga@gmail.com>
346
+
347
+ * Version bump to 0.0.1
348
+
349
+ [5abddb9 | Sat May 16 03:28:06 UTC 2009] snusnu <gamsnjaga@gmail.com>
350
+
351
+ * Version bump to 0.0.0
352
+
353
+ [25ace0a | Sat May 16 03:26:39 UTC 2009] snusnu <gamsnjaga@gmail.com>
354
+
355
+ * updated README to reflect validations for Language
356
+
357
+ [8f78083 | Sat May 16 03:24:00 UTC 2009] snusnu <gamsnjaga@gmail.com>
358
+
359
+ * validations and specs for Language.
360
+
361
+ * Think about locale string validation.
362
+ * Currently this is only a regex
363
+ * Should THIS be checked against a full list of possible locales?
364
+
365
+ [d1c0a25 | Sat May 16 03:23:01 UTC 2009] snusnu <gamsnjaga@gmail.com>
366
+
367
+ * proper namespace for module Translation
368
+
369
+ [982e081 | Sat May 16 03:21:29 UTC 2009] snusnu <gamsnjaga@gmail.com>
370
+
371
+ * added gem dependencies to gem specification and spec_helper
372
+
373
+ [8cf2113 | Sat May 16 00:57:17 UTC 2009] snusnu <gamsnjaga@gmail.com>
374
+
375
+ * README cosmetics
376
+
377
+ [8507bab | Sat May 16 00:27:42 UTC 2009] snusnu <gamsnjaga@gmail.com>
378
+
379
+ * updated README with usage examples.
380
+
381
+ [d277892 | Fri May 15 23:49:27 UTC 2009] snusnu <gamsnjaga@gmail.com>
382
+
383
+ * updated LICENSE information
384
+
385
+ [f6655c8 | Fri May 15 21:42:44 UTC 2009] snusnu <gamsnjaga@gmail.com>
386
+
387
+ * basic storage layout functional and tested. now add useful API.
388
+
389
+ * one xxx_translations table for every translatable resource
390
+ * belongs_to the resource to translate
391
+ * belongs_to a language
392
+ * properties to be translated are defined in xxx_translations
393
+
394
+ Example
395
+
396
+ class Item
397
+ include DataMapper::Resource
398
+ property :id, Serial
399
+ is :localizable do
400
+ property :name, String, :nullable => false
401
+ property :desc, String, :nullable => false
402
+ end
403
+ end
404
+
405
+ Advantages
406
+
407
+ * Proper normalization and referential integrity
408
+ * Ease in adding a new language (add row to xxx_translations)
409
+ * Easy to query
410
+ * Columns keep there names
411
+
412
+ Disadvantages (not really if you think about it)
413
+
414
+ * one table for every tables resource that needs translations
415
+
416
+ Inspired by
417
+
418
+ option 4) at http://is.gd/Af0d
419
+
420
+ [bebfb8d | Fri May 15 13:57:49 UTC 2009] snusnu <gamsnjaga@gmail.com>
421
+
422
+ * Initial commit to dm-is-localizable.
423
+
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Martin Gamsjaeger (snusnu)
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.