lazier 2.6.4 → 2.6.5

Sign up to get free protection for your applications and to get access to all the features.
data/doc/Lazier.html CHANGED
@@ -80,7 +80,7 @@
80
80
 
81
81
  <dt class="r1 last">Defined in:</dt>
82
82
  <dd class="r1 last">lib/lazier.rb<span class="defines">,<br />
83
- lib/lazier/math.rb,<br /> lib/lazier/i18n.rb,<br /> lib/lazier/hash.rb,<br /> lib/lazier/string.rb,<br /> lib/lazier/object.rb,<br /> lib/lazier/boolean.rb,<br /> lib/lazier/version.rb,<br /> lib/lazier/pathname.rb,<br /> lib/lazier/settings.rb,<br /> lib/lazier/datetime.rb,<br /> lib/lazier/exceptions.rb</span>
83
+ lib/lazier/hash.rb,<br /> lib/lazier/i18n.rb,<br /> lib/lazier/math.rb,<br /> lib/lazier/object.rb,<br /> lib/lazier/string.rb,<br /> lib/lazier/boolean.rb,<br /> lib/lazier/version.rb,<br /> lib/lazier/datetime.rb,<br /> lib/lazier/settings.rb,<br /> lib/lazier/pathname.rb,<br /> lib/lazier/localizer.rb,<br /> lib/lazier/exceptions.rb</span>
84
84
  </dd>
85
85
 
86
86
  </dl>
@@ -105,7 +105,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
105
105
 
106
106
 
107
107
 
108
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="Lazier/Settings.html" title="Lazier::Settings (class)">Settings</a></span>
108
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Lazier/Localizer.html" title="Lazier::Localizer (class)">Localizer</a></span>, <span class='object_link'><a href="Lazier/Settings.html" title="Lazier::Settings (class)">Settings</a></span>
109
109
 
110
110
 
111
111
  </p>
@@ -409,16 +409,16 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
409
409
  <pre class="lines">
410
410
 
411
411
 
412
- 46
413
412
  47
414
413
  48
415
414
  49
416
415
  50
417
416
  51
418
- 52</pre>
417
+ 52
418
+ 53</pre>
419
419
  </td>
420
420
  <td>
421
- <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 46</span>
421
+ <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 47</span>
422
422
 
423
423
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load!'>load!</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_what'>what</span><span class='rparen'>)</span>
424
424
  <span class='id identifier rubyid_what'>what</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>object</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>boolean</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>string</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>hash</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>datetime</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>math</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>pathname</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>==</span> <span class='int'>0</span>
@@ -457,7 +457,6 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
457
457
  <pre class="lines">
458
458
 
459
459
 
460
- 62
461
460
  63
462
461
  64
463
462
  65
@@ -467,10 +466,11 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
467
466
  69
468
467
  70
469
468
  71
470
- 72</pre>
469
+ 72
470
+ 73</pre>
471
471
  </td>
472
472
  <td>
473
- <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 62</span>
473
+ <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 63</span>
474
474
 
475
475
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load_boolean'>load_boolean</span>
476
476
  <span class='op'>::</span><span class='const'>TrueClass</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
@@ -513,7 +513,6 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
513
513
  <pre class="lines">
514
514
 
515
515
 
516
- 89
517
516
  90
518
517
  91
519
518
  92
@@ -525,10 +524,11 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
525
524
  98
526
525
  99
527
526
  100
528
- 101</pre>
527
+ 101
528
+ 102</pre>
529
529
  </td>
530
530
  <td>
531
- <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 89</span>
531
+ <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 90</span>
532
532
 
533
533
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load_datetime'>load_datetime</span>
534
534
  <span class='const'>Lazier</span><span class='period'>.</span><span class='id identifier rubyid_load_object'>load_object</span>
@@ -573,14 +573,14 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
573
573
  <pre class="lines">
574
574
 
575
575
 
576
- 82
577
576
  83
578
577
  84
579
578
  85
580
- 86</pre>
579
+ 86
580
+ 87</pre>
581
581
  </td>
582
582
  <td>
583
- <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 82</span>
583
+ <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 83</span>
584
584
 
585
585
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load_hash'>load_hash</span>
586
586
  <span class='op'>::</span><span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
@@ -617,16 +617,16 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
617
617
  <pre class="lines">
618
618
 
619
619
 
620
- 104
621
620
  105
622
621
  106
623
622
  107
624
623
  108
625
624
  109
626
- 110</pre>
625
+ 110
626
+ 111</pre>
627
627
  </td>
628
628
  <td>
629
- <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 104</span>
629
+ <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 105</span>
630
630
 
631
631
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load_math'>load_math</span>
632
632
  <span class='const'>Lazier</span><span class='period'>.</span><span class='id identifier rubyid_load_object'>load_object</span>
@@ -665,14 +665,14 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
665
665
  <pre class="lines">
666
666
 
667
667
 
668
- 55
669
668
  56
670
669
  57
671
670
  58
672
- 59</pre>
671
+ 59
672
+ 60</pre>
673
673
  </td>
674
674
  <td>
675
- <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 55</span>
675
+ <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 56</span>
676
676
 
677
677
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load_object'>load_object</span>
678
678
  <span class='op'>::</span><span class='const'>Object</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
@@ -709,16 +709,16 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
709
709
  <pre class="lines">
710
710
 
711
711
 
712
- 113
713
712
  114
714
713
  115
715
714
  116
716
715
  117
717
716
  118
718
- 119</pre>
717
+ 119
718
+ 120</pre>
719
719
  </td>
720
720
  <td>
721
- <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 113</span>
721
+ <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 114</span>
722
722
 
723
723
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load_pathname'>load_pathname</span>
724
724
  <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>pathname</span><span class='tstring_end'>&quot;</span></span>
@@ -757,14 +757,14 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
757
757
  <pre class="lines">
758
758
 
759
759
 
760
- 75
761
760
  76
762
761
  77
763
762
  78
764
- 79</pre>
763
+ 79
764
+ 80</pre>
765
765
  </td>
766
766
  <td>
767
- <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 75</span>
767
+ <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 76</span>
768
768
 
769
769
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load_string'>load_string</span>
770
770
  <span class='op'>::</span><span class='const'>String</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
@@ -818,12 +818,12 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
818
818
  <pre class="lines">
819
819
 
820
820
 
821
- 30
822
821
  31
823
- 32</pre>
822
+ 32
823
+ 33</pre>
824
824
  </td>
825
825
  <td>
826
- <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 30</span>
826
+ <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 31</span>
827
827
 
828
828
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span>
829
829
  <span class='op'>::</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
@@ -838,7 +838,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
838
838
  </div>
839
839
 
840
840
  <div id="footer">
841
- Generated on Thu Feb 7 23:34:10 2013 by
841
+ Generated on Sat Feb 9 10:45:50 2013 by
842
842
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
843
843
  0.8.4 (ruby-1.9.3).
844
844
  </div>
@@ -288,7 +288,7 @@
288
288
  </div>
289
289
 
290
290
  <div id="footer">
291
- Generated on Thu Feb 7 23:34:11 2013 by
291
+ Generated on Sat Feb 9 10:45:50 2013 by
292
292
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
293
293
  0.8.4 (ruby-1.9.3).
294
294
  </div>
@@ -725,7 +725,7 @@ DateTime.civil(2013, 6, 1).in_months(2011)
725
725
  </div>
726
726
 
727
727
  <div id="footer">
728
- Generated on Thu Feb 7 23:34:11 2013 by
728
+ Generated on Sat Feb 9 10:45:51 2013 by
729
729
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
730
730
  0.8.4 (ruby-1.9.3).
731
731
  </div>
@@ -1568,7 +1568,7 @@ Date.years(1, true, 2010, true)
1568
1568
  </div>
1569
1569
 
1570
1570
  <div id="footer">
1571
- Generated on Thu Feb 7 23:34:11 2013 by
1571
+ Generated on Sat Feb 9 10:45:51 2013 by
1572
1572
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1573
1573
  0.8.4 (ruby-1.9.3).
1574
1574
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Thu Feb 7 23:34:11 2013 by
119
+ Generated on Sat Feb 9 10:45:51 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.4 (ruby-1.9.3).
122
122
  </div>
@@ -124,7 +124,7 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Thu Feb 7 23:34:12 2013 by
127
+ Generated on Sat Feb 9 10:45:52 2013 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
129
  0.8.4 (ruby-1.9.3).
130
130
  </div>
@@ -238,7 +238,7 @@
238
238
  </div>
239
239
 
240
240
  <div id="footer">
241
- Generated on Thu Feb 7 23:34:12 2013 by
241
+ Generated on Sat Feb 9 10:45:52 2013 by
242
242
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
243
243
  0.8.4 (ruby-1.9.3).
244
244
  </div>
data/doc/Lazier/Hash.html CHANGED
@@ -384,7 +384,7 @@
384
384
  </div>
385
385
 
386
386
  <div id="footer">
387
- Generated on Thu Feb 7 23:34:10 2013 by
387
+ Generated on Sat Feb 9 10:45:50 2013 by
388
388
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
389
389
  0.8.4 (ruby-1.9.3).
390
390
  </div>
data/doc/Lazier/I18n.html CHANGED
@@ -78,7 +78,7 @@
78
78
 
79
79
 
80
80
  <dt class="r1">Included in:</dt>
81
- <dd class="r1"><span class='object_link'><a href="Settings.html" title="Lazier::Settings (class)">Settings</a></span></dd>
81
+ <dd class="r1"><span class='object_link'><a href="Localizer.html" title="Lazier::Localizer (class)">Localizer</a></span>, <span class='object_link'><a href="Settings.html" title="Lazier::Settings (class)">Settings</a></span></dd>
82
82
 
83
83
 
84
84
 
@@ -102,6 +102,123 @@
102
102
 
103
103
 
104
104
 
105
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
106
+ <ul class="summary">
107
+
108
+ <li class="public ">
109
+ <span class="summary_signature">
110
+
111
+ <a href="#i18_root-instance_method" title="#i18_root (instance method)">- (Object) <strong>i18_root</strong> </a>
112
+
113
+
114
+
115
+ </span>
116
+
117
+
118
+
119
+
120
+ <span class="note title readonly">readonly</span>
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute i18_root.</p>
131
+ </div></span>
132
+
133
+ </li>
134
+
135
+
136
+ <li class="public ">
137
+ <span class="summary_signature">
138
+
139
+ <a href="#i18n_locale-instance_method" title="#i18n_locale (instance method)">- (String|Symbol|nil) <strong>i18n_locale</strong> </a>
140
+
141
+
142
+
143
+ </span>
144
+
145
+
146
+
147
+
148
+ <span class="note title readonly">readonly</span>
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+ <span class="summary_desc"><div class='inline'><p>The current locale.</p>
159
+ </div></span>
160
+
161
+ </li>
162
+
163
+
164
+ <li class="public ">
165
+ <span class="summary_signature">
166
+
167
+ <a href="#i18n_locales_path-instance_method" title="#i18n_locales_path (instance method)">- (String) <strong>i18n_locales_path</strong> </a>
168
+
169
+
170
+
171
+ </span>
172
+
173
+
174
+
175
+
176
+ <span class="note title readonly">readonly</span>
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+ <span class="summary_desc"><div class='inline'><p>The path where the translations are stored.</p>
187
+ </div></span>
188
+
189
+ </li>
190
+
191
+
192
+ <li class="public ">
193
+ <span class="summary_signature">
194
+
195
+ <a href="#i18n_root-instance_method" title="#i18n_root (instance method)">- (Symbol) <strong>i18n_root</strong> </a>
196
+
197
+
198
+
199
+ </span>
200
+
201
+
202
+
203
+
204
+ <span class="note title readonly">readonly</span>
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+ <span class="summary_desc"><div class='inline'><p>The root level of the translation.</p>
215
+ </div></span>
216
+
217
+ </li>
218
+
219
+
220
+ </ul>
221
+
105
222
 
106
223
 
107
224
 
@@ -186,6 +303,566 @@
186
303
 
187
304
 
188
305
 
306
+ <div id="instance_attr_details" class="attr_details">
307
+ <h2>Instance Attribute Details</h2>
308
+
309
+
310
+ <span id=""></span>
311
+ <div class="method_details first">
312
+ <h3 class="signature first" id="i18_root-instance_method">
313
+
314
+ - (<tt><span class='object_link'><a href="Object.html" title="Lazier::Object (module)">Object</a></span></tt>) <strong>i18_root</strong> <span class="extras">(readonly)</span>
315
+
316
+
317
+
318
+
319
+
320
+ </h3><div class="docstring">
321
+ <div class="discussion">
322
+ <p>Returns the value of attribute i18_root</p>
323
+
324
+
325
+ </div>
326
+ </div>
327
+ <div class="tags">
328
+
329
+
330
+ </div><table class="source_code">
331
+ <tr>
332
+ <td>
333
+ <pre class="lines">
334
+
335
+
336
+ 18
337
+ 19
338
+ 20</pre>
339
+ </td>
340
+ <td>
341
+ <pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 18</span>
342
+
343
+ <span class='kw'>def</span> <span class='id identifier rubyid_i18_root'>i18_root</span>
344
+ <span class='ivar'>@i18_root</span>
345
+ <span class='kw'>end</span></pre>
346
+ </td>
347
+ </tr>
348
+ </table>
349
+ </div>
350
+
351
+
352
+ <span id=""></span>
353
+ <div class="method_details ">
354
+ <h3 class="signature " id="i18n_locale-instance_method">
355
+
356
+ - (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span>|Symbol|nil</tt>) <strong>i18n_locale</strong> <span class="extras">(readonly)</span>
357
+
358
+
359
+
360
+
361
+
362
+ </h3><div class="docstring">
363
+ <div class="discussion">
364
+ <p>The current locale.</p>
365
+
366
+
367
+ </div>
368
+ </div>
369
+ <div class="tags">
370
+
371
+ <p class="tag_title">Returns:</p>
372
+ <ul class="return">
373
+
374
+ <li>
375
+
376
+
377
+ <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span>|Symbol|nil</tt>)</span>
378
+
379
+
380
+
381
+ &mdash;
382
+ <div class='inline'><p>The current locale.</p>
383
+ </div>
384
+
385
+ </li>
386
+
387
+ </ul>
388
+
389
+ </div><table class="source_code">
390
+ <tr>
391
+ <td>
392
+ <pre class="lines">
393
+
394
+
395
+ 16
396
+ 17
397
+ 18
398
+ 19
399
+ 20
400
+ 21
401
+ 22
402
+ 23
403
+ 24
404
+ 25
405
+ 26
406
+ 27
407
+ 28
408
+ 29
409
+ 30
410
+ 31
411
+ 32
412
+ 33
413
+ 34
414
+ 35
415
+ 36
416
+ 37
417
+ 38
418
+ 39
419
+ 40
420
+ 41
421
+ 42
422
+ 43
423
+ 44
424
+ 45
425
+ 46
426
+ 47
427
+ 48
428
+ 49
429
+ 50
430
+ 51
431
+ 52
432
+ 53
433
+ 54
434
+ 55
435
+ 56
436
+ 57
437
+ 58
438
+ 59
439
+ 60
440
+ 61
441
+ 62
442
+ 63
443
+ 64
444
+ 65
445
+ 66
446
+ 67
447
+ 68
448
+ 69
449
+ 70
450
+ 71
451
+ 72
452
+ 73
453
+ 74</pre>
454
+ </td>
455
+ <td>
456
+ <pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 16</span>
457
+
458
+ <span class='kw'>module</span> <span class='const'>I18n</span>
459
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n_locale</span>
460
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18_root</span>
461
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n_locales_path</span>
462
+
463
+ <span class='comment'># Setup all I18n translations.
464
+ </span> <span class='comment'>#
465
+ </span> <span class='comment'># @param root [Symbol] The root level of the translation.
466
+ </span> <span class='comment'># @param path [String] The path where the translations are stored.
467
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='id identifier rubyid_root'>root</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
468
+ <span class='ivar'>@i18n_root</span> <span class='op'>=</span> <span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
469
+ <span class='ivar'>@i18n_locales_path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
470
+ <span class='kw'>end</span>
471
+
472
+ <span class='comment'># Get the list of available translation for the current locale.
473
+ </span> <span class='comment'>#
474
+ </span> <span class='comment'># @return [R18N::Translation] The translation object.
475
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n'>i18n</span>
476
+ <span class='ivar'>@i18n</span> <span class='op'>||=</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='rparen'>)</span>
477
+ <span class='kw'>end</span>
478
+
479
+ <span class='comment'># Set the current locale for messages.
480
+ </span> <span class='comment'>#
481
+ </span> <span class='comment'># @param locale [String|Symbol|nil] The new locale. Default is the current system locale.
482
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
483
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n='>i18n=</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
484
+ <span class='ivar'>@i18n_locale</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
485
+ <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
486
+ <span class='kw'>end</span>
487
+
488
+ <span class='id identifier rubyid_private'>private</span>
489
+ <span class='comment'># Loads a locale for messages.
490
+ </span> <span class='comment'>#
491
+ </span> <span class='comment'># @param locale [Symbol] The new locale. Default is the current system locale.
492
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
493
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
494
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='ivar'>@i18n_locales_path</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
495
+ <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>LANG</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_system_locale'>system_locale</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_l'>l</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rbrace'>}</span>
496
+ <span class='id identifier rubyid_locales'>locales</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>en</span><span class='tstring_end'>&quot;</span></span> <span class='comment'># Add English as a fallback
497
+ </span> <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='id identifier rubyid_locales'>locales</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
498
+
499
+ <span class='kw'>begin</span>
500
+ <span class='id identifier rubyid_translation'>translation</span> <span class='op'>=</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='ivar'>@i18n_root</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
501
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span> <span class='kw'>if</span> <span class='id identifier rubyid_translation'>translation</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>Untranslated</span><span class='rparen'>)</span>
502
+ <span class='id identifier rubyid_translation'>translation</span>
503
+ <span class='kw'>rescue</span>
504
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>MissingTranslation</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
505
+ <span class='kw'>end</span>
506
+ <span class='kw'>end</span>
507
+
508
+ <span class='comment'># Find a locale file in a path.
509
+ </span> <span class='comment'>#
510
+ </span> <span class='comment'># @param locale [String] The locale to find.
511
+ </span> <span class='comment'># @param path [String] The path where look into.
512
+ </span> <span class='comment'># @return [String|nil] The version of the locale found or `nil`, if nothing was found.
513
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
514
+ <span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='rbrace'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_l'>l</span><span class='rbrace'>}</span><span class='tstring_content'>.yml</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
515
+ <span class='kw'>end</span>
516
+ <span class='kw'>end</span></pre>
517
+ </td>
518
+ </tr>
519
+ </table>
520
+ </div>
521
+
522
+
523
+ <span id=""></span>
524
+ <div class="method_details ">
525
+ <h3 class="signature " id="i18n_locales_path-instance_method">
526
+
527
+ - (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>i18n_locales_path</strong> <span class="extras">(readonly)</span>
528
+
529
+
530
+
531
+
532
+
533
+ </h3><div class="docstring">
534
+ <div class="discussion">
535
+ <p>The path where the translations are stored.</p>
536
+
537
+
538
+ </div>
539
+ </div>
540
+ <div class="tags">
541
+
542
+ <p class="tag_title">Returns:</p>
543
+ <ul class="return">
544
+
545
+ <li>
546
+
547
+
548
+ <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
549
+
550
+
551
+
552
+ &mdash;
553
+ <div class='inline'><p>The path where the translations are stored.</p>
554
+ </div>
555
+
556
+ </li>
557
+
558
+ </ul>
559
+
560
+ </div><table class="source_code">
561
+ <tr>
562
+ <td>
563
+ <pre class="lines">
564
+
565
+
566
+ 16
567
+ 17
568
+ 18
569
+ 19
570
+ 20
571
+ 21
572
+ 22
573
+ 23
574
+ 24
575
+ 25
576
+ 26
577
+ 27
578
+ 28
579
+ 29
580
+ 30
581
+ 31
582
+ 32
583
+ 33
584
+ 34
585
+ 35
586
+ 36
587
+ 37
588
+ 38
589
+ 39
590
+ 40
591
+ 41
592
+ 42
593
+ 43
594
+ 44
595
+ 45
596
+ 46
597
+ 47
598
+ 48
599
+ 49
600
+ 50
601
+ 51
602
+ 52
603
+ 53
604
+ 54
605
+ 55
606
+ 56
607
+ 57
608
+ 58
609
+ 59
610
+ 60
611
+ 61
612
+ 62
613
+ 63
614
+ 64
615
+ 65
616
+ 66
617
+ 67
618
+ 68
619
+ 69
620
+ 70
621
+ 71
622
+ 72
623
+ 73
624
+ 74</pre>
625
+ </td>
626
+ <td>
627
+ <pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 16</span>
628
+
629
+ <span class='kw'>module</span> <span class='const'>I18n</span>
630
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n_locale</span>
631
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18_root</span>
632
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n_locales_path</span>
633
+
634
+ <span class='comment'># Setup all I18n translations.
635
+ </span> <span class='comment'>#
636
+ </span> <span class='comment'># @param root [Symbol] The root level of the translation.
637
+ </span> <span class='comment'># @param path [String] The path where the translations are stored.
638
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='id identifier rubyid_root'>root</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
639
+ <span class='ivar'>@i18n_root</span> <span class='op'>=</span> <span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
640
+ <span class='ivar'>@i18n_locales_path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
641
+ <span class='kw'>end</span>
642
+
643
+ <span class='comment'># Get the list of available translation for the current locale.
644
+ </span> <span class='comment'>#
645
+ </span> <span class='comment'># @return [R18N::Translation] The translation object.
646
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n'>i18n</span>
647
+ <span class='ivar'>@i18n</span> <span class='op'>||=</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='rparen'>)</span>
648
+ <span class='kw'>end</span>
649
+
650
+ <span class='comment'># Set the current locale for messages.
651
+ </span> <span class='comment'>#
652
+ </span> <span class='comment'># @param locale [String|Symbol|nil] The new locale. Default is the current system locale.
653
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
654
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n='>i18n=</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
655
+ <span class='ivar'>@i18n_locale</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
656
+ <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
657
+ <span class='kw'>end</span>
658
+
659
+ <span class='id identifier rubyid_private'>private</span>
660
+ <span class='comment'># Loads a locale for messages.
661
+ </span> <span class='comment'>#
662
+ </span> <span class='comment'># @param locale [Symbol] The new locale. Default is the current system locale.
663
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
664
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
665
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='ivar'>@i18n_locales_path</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
666
+ <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>LANG</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_system_locale'>system_locale</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_l'>l</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rbrace'>}</span>
667
+ <span class='id identifier rubyid_locales'>locales</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>en</span><span class='tstring_end'>&quot;</span></span> <span class='comment'># Add English as a fallback
668
+ </span> <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='id identifier rubyid_locales'>locales</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
669
+
670
+ <span class='kw'>begin</span>
671
+ <span class='id identifier rubyid_translation'>translation</span> <span class='op'>=</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='ivar'>@i18n_root</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
672
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span> <span class='kw'>if</span> <span class='id identifier rubyid_translation'>translation</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>Untranslated</span><span class='rparen'>)</span>
673
+ <span class='id identifier rubyid_translation'>translation</span>
674
+ <span class='kw'>rescue</span>
675
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>MissingTranslation</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
676
+ <span class='kw'>end</span>
677
+ <span class='kw'>end</span>
678
+
679
+ <span class='comment'># Find a locale file in a path.
680
+ </span> <span class='comment'>#
681
+ </span> <span class='comment'># @param locale [String] The locale to find.
682
+ </span> <span class='comment'># @param path [String] The path where look into.
683
+ </span> <span class='comment'># @return [String|nil] The version of the locale found or `nil`, if nothing was found.
684
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
685
+ <span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='rbrace'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_l'>l</span><span class='rbrace'>}</span><span class='tstring_content'>.yml</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
686
+ <span class='kw'>end</span>
687
+ <span class='kw'>end</span></pre>
688
+ </td>
689
+ </tr>
690
+ </table>
691
+ </div>
692
+
693
+
694
+ <span id=""></span>
695
+ <div class="method_details ">
696
+ <h3 class="signature " id="i18n_root-instance_method">
697
+
698
+ - (<tt>Symbol</tt>) <strong>i18n_root</strong> <span class="extras">(readonly)</span>
699
+
700
+
701
+
702
+
703
+
704
+ </h3><div class="docstring">
705
+ <div class="discussion">
706
+ <p>The root level of the translation.</p>
707
+
708
+
709
+ </div>
710
+ </div>
711
+ <div class="tags">
712
+
713
+ <p class="tag_title">Returns:</p>
714
+ <ul class="return">
715
+
716
+ <li>
717
+
718
+
719
+ <span class='type'>(<tt>Symbol</tt>)</span>
720
+
721
+
722
+
723
+ &mdash;
724
+ <div class='inline'><p>The root level of the translation.</p>
725
+ </div>
726
+
727
+ </li>
728
+
729
+ </ul>
730
+
731
+ </div><table class="source_code">
732
+ <tr>
733
+ <td>
734
+ <pre class="lines">
735
+
736
+
737
+ 16
738
+ 17
739
+ 18
740
+ 19
741
+ 20
742
+ 21
743
+ 22
744
+ 23
745
+ 24
746
+ 25
747
+ 26
748
+ 27
749
+ 28
750
+ 29
751
+ 30
752
+ 31
753
+ 32
754
+ 33
755
+ 34
756
+ 35
757
+ 36
758
+ 37
759
+ 38
760
+ 39
761
+ 40
762
+ 41
763
+ 42
764
+ 43
765
+ 44
766
+ 45
767
+ 46
768
+ 47
769
+ 48
770
+ 49
771
+ 50
772
+ 51
773
+ 52
774
+ 53
775
+ 54
776
+ 55
777
+ 56
778
+ 57
779
+ 58
780
+ 59
781
+ 60
782
+ 61
783
+ 62
784
+ 63
785
+ 64
786
+ 65
787
+ 66
788
+ 67
789
+ 68
790
+ 69
791
+ 70
792
+ 71
793
+ 72
794
+ 73
795
+ 74</pre>
796
+ </td>
797
+ <td>
798
+ <pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 16</span>
799
+
800
+ <span class='kw'>module</span> <span class='const'>I18n</span>
801
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n_locale</span>
802
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18_root</span>
803
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:i18n_locales_path</span>
804
+
805
+ <span class='comment'># Setup all I18n translations.
806
+ </span> <span class='comment'>#
807
+ </span> <span class='comment'># @param root [Symbol] The root level of the translation.
808
+ </span> <span class='comment'># @param path [String] The path where the translations are stored.
809
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='id identifier rubyid_root'>root</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
810
+ <span class='ivar'>@i18n_root</span> <span class='op'>=</span> <span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
811
+ <span class='ivar'>@i18n_locales_path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
812
+ <span class='kw'>end</span>
813
+
814
+ <span class='comment'># Get the list of available translation for the current locale.
815
+ </span> <span class='comment'>#
816
+ </span> <span class='comment'># @return [R18N::Translation] The translation object.
817
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n'>i18n</span>
818
+ <span class='ivar'>@i18n</span> <span class='op'>||=</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='rparen'>)</span>
819
+ <span class='kw'>end</span>
820
+
821
+ <span class='comment'># Set the current locale for messages.
822
+ </span> <span class='comment'>#
823
+ </span> <span class='comment'># @param locale [String|Symbol|nil] The new locale. Default is the current system locale.
824
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
825
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n='>i18n=</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
826
+ <span class='ivar'>@i18n_locale</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
827
+ <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
828
+ <span class='kw'>end</span>
829
+
830
+ <span class='id identifier rubyid_private'>private</span>
831
+ <span class='comment'># Loads a locale for messages.
832
+ </span> <span class='comment'>#
833
+ </span> <span class='comment'># @param locale [Symbol] The new locale. Default is the current system locale.
834
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
835
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
836
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='ivar'>@i18n_locales_path</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
837
+ <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>LANG</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_system_locale'>system_locale</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_l'>l</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='rbrace'>}</span>
838
+ <span class='id identifier rubyid_locales'>locales</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>en</span><span class='tstring_end'>&quot;</span></span> <span class='comment'># Add English as a fallback
839
+ </span> <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='id identifier rubyid_locales'>locales</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
840
+
841
+ <span class='kw'>begin</span>
842
+ <span class='id identifier rubyid_translation'>translation</span> <span class='op'>=</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='ivar'>@i18n_root</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
843
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span> <span class='kw'>if</span> <span class='id identifier rubyid_translation'>translation</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>R18n</span><span class='op'>::</span><span class='const'>Untranslated</span><span class='rparen'>)</span>
844
+ <span class='id identifier rubyid_translation'>translation</span>
845
+ <span class='kw'>rescue</span>
846
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>MissingTranslation</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
847
+ <span class='kw'>end</span>
848
+ <span class='kw'>end</span>
849
+
850
+ <span class='comment'># Find a locale file in a path.
851
+ </span> <span class='comment'>#
852
+ </span> <span class='comment'># @param locale [String] The locale to find.
853
+ </span> <span class='comment'># @param path [String] The path where look into.
854
+ </span> <span class='comment'># @return [String|nil] The version of the locale found or `nil`, if nothing was found.
855
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_find_locale_in_path'>find_locale_in_path</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
856
+ <span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='rbrace'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_l'>l</span><span class='rbrace'>}</span><span class='tstring_content'>.yml</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
857
+ <span class='kw'>end</span>
858
+ <span class='kw'>end</span></pre>
859
+ </td>
860
+ </tr>
861
+ </table>
862
+ </div>
863
+
864
+ </div>
865
+
189
866
 
190
867
  <div id="instance_method_details" class="method_details_list">
191
868
  <h2>Instance Method Details</h2>
@@ -233,12 +910,12 @@
233
910
  <pre class="lines">
234
911
 
235
912
 
236
- 22
237
- 23
238
- 24</pre>
913
+ 33
914
+ 34
915
+ 35</pre>
239
916
  </td>
240
917
  <td>
241
- <pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 22</span>
918
+ <pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 33</span>
242
919
 
243
920
  <span class='kw'>def</span> <span class='id identifier rubyid_i18n'>i18n</span>
244
921
  <span class='ivar'>@i18n</span> <span class='op'>||=</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='rparen'>)</span>
@@ -273,7 +950,7 @@
273
950
  <span class='name'>locale</span>
274
951
 
275
952
 
276
- <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
953
+ <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span>|Symbol|nil</tt>)</span>
277
954
 
278
955
 
279
956
 
@@ -309,14 +986,16 @@
309
986
  <pre class="lines">
310
987
 
311
988
 
312
- 30
313
- 31
314
- 32</pre>
989
+ 41
990
+ 42
991
+ 43
992
+ 44</pre>
315
993
  </td>
316
994
  <td>
317
- <pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 30</span>
995
+ <pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 41</span>
318
996
 
319
997
  <span class='kw'>def</span> <span class='id identifier rubyid_i18n='>i18n=</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
998
+ <span class='ivar'>@i18n_locale</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
320
999
  <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
321
1000
  <span class='kw'>end</span></pre>
322
1001
  </td>
@@ -354,7 +1033,7 @@
354
1033
 
355
1034
 
356
1035
  &mdash;
357
- <div class='inline'><p>The root level of translation.</p>
1036
+ <div class='inline'><p>The root level of the translation.</p>
358
1037
  </div>
359
1038
 
360
1039
  </li>
@@ -369,7 +1048,7 @@
369
1048
 
370
1049
 
371
1050
  &mdash;
372
- <div class='inline'><p>The path where the translation are stored.</p>
1051
+ <div class='inline'><p>The path where the translations are stored.</p>
373
1052
  </div>
374
1053
 
375
1054
  </li>
@@ -383,13 +1062,13 @@
383
1062
  <pre class="lines">
384
1063
 
385
1064
 
386
- 14
387
- 15
388
- 16
389
- 17</pre>
1065
+ 25
1066
+ 26
1067
+ 27
1068
+ 28</pre>
390
1069
  </td>
391
1070
  <td>
392
- <pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 14</span>
1071
+ <pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 25</span>
393
1072
 
394
1073
  <span class='kw'>def</span> <span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='id identifier rubyid_root'>root</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
395
1074
  <span class='ivar'>@i18n_root</span> <span class='op'>=</span> <span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
@@ -405,7 +1084,7 @@
405
1084
  </div>
406
1085
 
407
1086
  <div id="footer">
408
- Generated on Thu Feb 7 23:34:10 2013 by
1087
+ Generated on Sat Feb 9 10:45:50 2013 by
409
1088
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
410
1089
  0.8.4 (ruby-1.9.3).
411
1090
  </div>