lazier 2.5.3 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/doc/Lazier.html CHANGED
@@ -838,7 +838,7 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
838
838
  </div>
839
839
 
840
840
  <div id="footer">
841
- Generated on Sun Feb 3 17:17:48 2013 by
841
+ Generated on Sun Feb 3 23:33:14 2013 by
842
842
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
843
843
  0.8.3 (ruby-1.9.3).
844
844
  </div>
@@ -288,7 +288,7 @@
288
288
  </div>
289
289
 
290
290
  <div id="footer">
291
- Generated on Sun Feb 3 17:17:48 2013 by
291
+ Generated on Sun Feb 3 23:33:15 2013 by
292
292
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
293
293
  0.8.3 (ruby-1.9.3).
294
294
  </div>
@@ -724,7 +724,7 @@
724
724
  </div>
725
725
 
726
726
  <div id="footer">
727
- Generated on Sun Feb 3 17:17:48 2013 by
727
+ Generated on Sun Feb 3 23:33:15 2013 by
728
728
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
729
729
  0.8.3 (ruby-1.9.3).
730
730
  </div>
@@ -1565,7 +1565,7 @@
1565
1565
  </div>
1566
1566
 
1567
1567
  <div id="footer">
1568
- Generated on Sun Feb 3 17:17:48 2013 by
1568
+ Generated on Sun Feb 3 23:33:15 2013 by
1569
1569
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1570
1570
  0.8.3 (ruby-1.9.3).
1571
1571
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sun Feb 3 17:17:48 2013 by
119
+ Generated on Sun Feb 3 23:33:15 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.3 (ruby-1.9.3).
122
122
  </div>
@@ -124,7 +124,7 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Sun Feb 3 17:17:49 2013 by
127
+ Generated on Sun Feb 3 23:33:15 2013 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
129
  0.8.3 (ruby-1.9.3).
130
130
  </div>
@@ -0,0 +1,133 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Exception: Lazier::Exceptions::MissingTranslation
8
+
9
+ &mdash; Documentation by YARD 0.8.3
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../../';
20
+ framesUrl = "../../frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../../_index.html">Index (M)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../../Lazier.html" title="Lazier (module)">Lazier</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Exceptions.html" title="Lazier::Exceptions (module)">Exceptions</a></span></span>
36
+ &raquo;
37
+ <span class="title">MissingTranslation</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Exception: Lazier::Exceptions::MissingTranslation
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Exception</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">Exception</li>
82
+
83
+ <li class="next">Lazier::Exceptions::MissingTranslation</li>
84
+
85
+ </ul>
86
+ <a href="#" class="inheritanceTree">show all</a>
87
+
88
+ </dd>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+ <dt class="r2 last">Defined in:</dt>
99
+ <dd class="r2 last">lib/lazier/exceptions.rb</dd>
100
+
101
+ </dl>
102
+ <div class="clear"></div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+ <p>This exception is raised from <span class='object_link'><a href="../I18n.html" title="Lazier::I18n (module)">I18n</a></span> if no valid translation are found in the specified path.</p>
107
+
108
+
109
+ </div>
110
+ </div>
111
+ <div class="tags">
112
+
113
+
114
+ </div>
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ </div>
125
+
126
+ <div id="footer">
127
+ Generated on Sun Feb 3 23:33:15 2013 by
128
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
+ 0.8.3 (ruby-1.9.3).
130
+ </div>
131
+
132
+ </body>
133
+ </html>
data/doc/Lazier/Hash.html CHANGED
@@ -384,7 +384,7 @@
384
384
  </div>
385
385
 
386
386
  <div id="footer">
387
- Generated on Sun Feb 3 17:17:48 2013 by
387
+ Generated on Sun Feb 3 23:33:14 2013 by
388
388
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
389
389
  0.8.3 (ruby-1.9.3).
390
390
  </div>
data/doc/Lazier/I18n.html CHANGED
@@ -405,7 +405,7 @@
405
405
  </div>
406
406
 
407
407
  <div id="footer">
408
- Generated on Sun Feb 3 17:17:48 2013 by
408
+ Generated on Sun Feb 3 23:33:14 2013 by
409
409
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
410
410
  0.8.3 (ruby-1.9.3).
411
411
  </div>
data/doc/Lazier/Math.html CHANGED
@@ -121,7 +121,7 @@
121
121
  </div>
122
122
 
123
123
  <div id="footer">
124
- Generated on Sun Feb 3 17:17:48 2013 by
124
+ Generated on Sun Feb 3 23:33:14 2013 by
125
125
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
126
  0.8.3 (ruby-1.9.3).
127
127
  </div>
@@ -321,7 +321,7 @@
321
321
  </div>
322
322
 
323
323
  <div id="footer">
324
- Generated on Sun Feb 3 17:17:48 2013 by
324
+ Generated on Sun Feb 3 23:33:14 2013 by
325
325
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
326
326
  0.8.3 (ruby-1.9.3).
327
327
  </div>
@@ -1586,7 +1586,7 @@
1586
1586
  </div>
1587
1587
 
1588
1588
  <div id="footer">
1589
- Generated on Sun Feb 3 17:17:48 2013 by
1589
+ Generated on Sun Feb 3 23:33:15 2013 by
1590
1590
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1591
1591
  0.8.3 (ruby-1.9.3).
1592
1592
  </div>
@@ -216,7 +216,7 @@
216
216
  </div>
217
217
 
218
218
  <div id="footer">
219
- Generated on Sun Feb 3 17:17:48 2013 by
219
+ Generated on Sun Feb 3 23:33:15 2013 by
220
220
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
221
221
  0.8.3 (ruby-1.9.3).
222
222
  </div>
@@ -2496,7 +2496,7 @@
2496
2496
  </div>
2497
2497
 
2498
2498
  <div id="footer">
2499
- Generated on Sun Feb 3 17:17:49 2013 by
2499
+ Generated on Sun Feb 3 23:33:15 2013 by
2500
2500
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2501
2501
  0.8.3 (ruby-1.9.3).
2502
2502
  </div>
@@ -462,7 +462,7 @@
462
462
  </div>
463
463
 
464
464
  <div id="footer">
465
- Generated on Sun Feb 3 17:17:48 2013 by
465
+ Generated on Sun Feb 3 23:33:14 2013 by
466
466
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
467
467
  0.8.3 (ruby-1.9.3).
468
468
  </div>
@@ -1697,7 +1697,7 @@
1697
1697
  </div>
1698
1698
 
1699
1699
  <div id="footer">
1700
- Generated on Sun Feb 3 17:17:48 2013 by
1700
+ Generated on Sun Feb 3 23:33:15 2013 by
1701
1701
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1702
1702
  0.8.3 (ruby-1.9.3).
1703
1703
  </div>
@@ -1022,7 +1022,7 @@
1022
1022
  </div>
1023
1023
 
1024
1024
  <div id="footer">
1025
- Generated on Sun Feb 3 17:17:48 2013 by
1025
+ Generated on Sun Feb 3 23:33:15 2013 by
1026
1026
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1027
1027
  0.8.3 (ruby-1.9.3).
1028
1028
  </div>
@@ -134,7 +134,7 @@
134
134
 
135
135
  </div>
136
136
  </dt>
137
- <dd><pre class="code"><span class='int'>5</span></pre></dd>
137
+ <dd><pre class="code"><span class='int'>6</span></pre></dd>
138
138
 
139
139
  <dt id="PATCH-constant" class="">PATCH =
140
140
  <div class="docstring">
@@ -149,7 +149,7 @@
149
149
 
150
150
  </div>
151
151
  </dt>
152
- <dd><pre class="code"><span class='int'>3</span></pre></dd>
152
+ <dd><pre class="code"><span class='int'>0</span></pre></dd>
153
153
 
154
154
  <dt id="STRING-constant" class="">STRING =
155
155
  <div class="docstring">
@@ -180,7 +180,7 @@
180
180
  </div>
181
181
 
182
182
  <div id="footer">
183
- Generated on Sun Feb 3 17:17:48 2013 by
183
+ Generated on Sun Feb 3 23:33:15 2013 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
185
  0.8.3 (ruby-1.9.3).
186
186
  </div>
data/doc/_index.html CHANGED
@@ -319,7 +319,7 @@
319
319
  </div>
320
320
 
321
321
  <div id="footer">
322
- Generated on Sun Feb 3 17:17:48 2013 by
322
+ Generated on Sun Feb 3 23:33:14 2013 by
323
323
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
324
324
  0.8.3 (ruby-1.9.3).
325
325
  </div>
data/doc/file.README.html CHANGED
@@ -102,7 +102,7 @@ See documentation for more informations.</p>
102
102
  </div></div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Sun Feb 3 17:17:48 2013 by
105
+ Generated on Sun Feb 3 23:33:14 2013 by
106
106
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
107
  0.8.3 (ruby-1.9.3).
108
108
  </div>
data/doc/index.html CHANGED
@@ -102,7 +102,7 @@ See documentation for more informations.</p>
102
102
  </div></div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Sun Feb 3 17:17:48 2013 by
105
+ Generated on Sun Feb 3 23:33:14 2013 by
106
106
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
107
  0.8.3 (ruby-1.9.3).
108
108
  </div>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Sun Feb 3 17:17:48 2013 by
106
+ Generated on Sun Feb 3 23:33:14 2013 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.3 (ruby-1.9.3).
109
109
  </div>
data/lib/lazier/i18n.rb CHANGED
@@ -38,7 +38,7 @@ module Lazier
38
38
  # @return [R18n::Translation] The new translation object.
39
39
  def i18n_load_locale(locale)
40
40
  path = (@i18n_locales_path || "").to_s
41
- locales = [locale, ENV["LANG"], R18n::I18n.system_locale].select { |l| File.exists?("#{path}/#{l}.yml") }.uniq.compact
41
+ locales = [locale, ENV["LANG"], R18n::I18n.system_locale].collect { |l| find_locale_in_path(l.to_s, path)}.uniq.compact
42
42
 
43
43
  begin
44
44
  raise Lazier::Exceptions::MissingTranslation if locales.blank?
@@ -49,5 +49,14 @@ module Lazier
49
49
  raise e
50
50
  end
51
51
  end
52
+
53
+ # Find a locale file in a path.
54
+ #
55
+ # @param locale [String] The locale to find.
56
+ # @param path [String] The path where look into.
57
+ # @return [String|nil] The version of the locale found or `nil`, if nothing was found.
58
+ def find_locale_in_path(locale, path)
59
+ [locale, locale[0, 5], locale[0, 2]].select {|l| File.exists?("#{path}/#{l}.yml") }.first
60
+ end
52
61
  end
53
62
  end
@@ -13,10 +13,10 @@ module Lazier
13
13
  MAJOR = 2
14
14
 
15
15
  # The minor version.
16
- MINOR = 5
16
+ MINOR = 6
17
17
 
18
18
  # The patch version.
19
- PATCH = 3
19
+ PATCH = 0
20
20
 
21
21
  # The current version of lazier.
22
22
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -8,6 +8,7 @@ require "spec_helper"
8
8
 
9
9
  describe Lazier::Boolean do
10
10
  before(:all) do
11
+ ENV["LANG"] = "en"
11
12
  ::Lazier.load!
12
13
  end
13
14
 
@@ -13,6 +13,7 @@ describe Lazier::DateTime do
13
13
  let(:zone_without_dst) { ::ActiveSupport::TimeZone["International Date Line West"] }
14
14
 
15
15
  before(:all) do
16
+ ENV["LANG"] = "en"
16
17
  Lazier.load!
17
18
  ::Lazier::Settings.instance.i18n = :en
18
19
  end
@@ -205,6 +206,7 @@ describe Lazier::TimeZone do
205
206
  let(:zone_without_dst) { ::ActiveSupport::TimeZone["International Date Line West"] }
206
207
 
207
208
  before(:all) do
209
+ ENV["LANG"] = "en"
208
210
  ::Lazier::Settings.instance(true)
209
211
  ::Lazier::Settings.instance.i18n = :en
210
212
  ::Lazier.load!
@@ -14,6 +14,7 @@ describe Lazier::Hash do
14
14
  }
15
15
 
16
16
  before(:all) do
17
+ ENV["LANG"] = "en"
17
18
  ::Lazier.load!
18
19
  end
19
20
 
@@ -13,6 +13,7 @@ end
13
13
  describe Lazier::I18n do
14
14
  let(:object) { Container.new }
15
15
  let(:root_path) { ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/") }
16
+
16
17
  before(:each) do
17
18
  ENV["LANG"] = "en"
18
19
  end
@@ -45,13 +46,13 @@ describe Lazier::I18n do
45
46
  describe "#i18n_load_locale" do
46
47
  it "should set using system locale if called without arguments" do
47
48
  object.i18n_setup("ROOT", root_path)
48
- R18n::I18n.should_receive(:new).with([ENV["LANG"], R18n::I18n.system_locale].compact, root_path).and_call_original
49
+ R18n::I18n.should_receive(:new).with([ENV["LANG"], R18n::I18n.system_locale].compact.uniq, root_path).and_call_original
49
50
  object.i18n = nil
50
51
  end
51
52
 
52
53
  it "should set the requested locale" do
53
54
  object.i18n_setup("ROOT", root_path)
54
- R18n::I18n.should_receive(:new).with([:it, ENV["LANG"], R18n::I18n.system_locale].compact, root_path).and_call_original
55
+ R18n::I18n.should_receive(:new).with(["it", ENV["LANG"], R18n::I18n.system_locale].compact.uniq, root_path).and_call_original
55
56
  object.i18n = :it
56
57
  end
57
58
 
@@ -66,7 +67,7 @@ describe Lazier::I18n do
66
67
 
67
68
  it "should only pass valid translations" do
68
69
  object.i18n_setup("ROOT", root_path)
69
- R18n::I18n.should_receive(:new).with([ENV["LANG"], R18n::I18n.system_locale].compact, root_path).and_call_original
70
+ R18n::I18n.should_receive(:new).with([ENV["LANG"], R18n::I18n.system_locale].compact.uniq, root_path).and_call_original
70
71
  object.i18n = "INVALID"
71
72
  end
72
73
 
@@ -12,6 +12,7 @@ describe Lazier::Math do
12
12
  let(:third) { 0 }
13
13
 
14
14
  before(:all) do
15
+ ENV["LANG"] = "en"
15
16
  ::Lazier.load!
16
17
  end
17
18
 
@@ -8,6 +8,7 @@ require "spec_helper"
8
8
 
9
9
  describe Lazier::Object do
10
10
  before(:all) do
11
+ ENV["LANG"] = "en"
11
12
  ::Lazier.load!
12
13
  end
13
14
 
@@ -10,6 +10,7 @@ describe Lazier::Pathname do
10
10
  let(:reference) { ::Pathname.new($0) }
11
11
 
12
12
  before(:all) do
13
+ ENV["LANG"] = "en"
13
14
  ::Lazier.load!
14
15
  end
15
16
 
@@ -12,6 +12,7 @@ describe Lazier::Settings do
12
12
  let(:date_reference) { DateTime.civil(2005, 6, 7, 8, 9, 10, DateTime.rationalize_offset(25200)) }
13
13
 
14
14
  before(:all) do
15
+ ENV["LANG"] = "en"
15
16
  Lazier.load!
16
17
  ::Lazier::Settings.instance.i18n = :en
17
18
  end
@@ -13,6 +13,7 @@ describe Lazier::String do
13
13
  let(:amp_reference) { "abc òùà èé &gt;" }
14
14
 
15
15
  before(:all) do
16
+ ENV["LANG"] = "en"
16
17
  ::Lazier.load!
17
18
  end
18
19
 
data/spec/lazier_spec.rb CHANGED
@@ -9,6 +9,7 @@ require "spec_helper"
9
9
  describe Lazier do
10
10
  describe ".load!" do
11
11
  describe "should load all extensions by default" do
12
+ ENV["LANG"] = "en"
12
13
  ::Lazier.load!
13
14
 
14
15
  it "for Boolean" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazier
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.3
4
+ version: 2.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -207,6 +207,7 @@ files:
207
207
  - doc/Lazier/DateTime/ClassMethods.html
208
208
  - doc/Lazier/Exceptions.html
209
209
  - doc/Lazier/Exceptions/Dump.html
210
+ - doc/Lazier/Exceptions/MissingTranslation.html
210
211
  - doc/Lazier/Hash.html
211
212
  - doc/Lazier/I18n.html
212
213
  - doc/Lazier/Math.html