inochi 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CREDITS +1 -0
- data/bin/inochi +112 -104
- data/doc/api/classes/Array.html +370 -0
- data/doc/api/classes/File.html +110 -0
- data/doc/api/classes/Inochi.html +1493 -0
- data/doc/api/classes/Inochi/Manual.html +157 -0
- data/doc/api/classes/Inochi/Phrases.html +331 -0
- data/doc/api/classes/Inochi/Version.html +190 -0
- data/doc/api/classes/TempDir.html +164 -0
- data/doc/api/created.rid +1 -0
- data/doc/api/css/main.css +263 -0
- data/doc/api/css/panel.css +383 -0
- data/doc/api/css/reset.css +53 -0
- data/doc/api/files/CREDITS.html +61 -0
- data/doc/api/files/LICENSE.html +76 -0
- data/doc/api/files/lib/inochi/book_rb.html +96 -0
- data/doc/api/files/lib/inochi/init_rb.html +78 -0
- data/doc/api/files/lib/inochi/main_rb.html +52 -0
- data/doc/api/files/lib/inochi/rake_rb.html +52 -0
- data/doc/api/files/lib/inochi/test/bacon_rb.html +67 -0
- data/doc/api/files/lib/inochi/test/context_rb.html +69 -0
- data/doc/api/files/lib/inochi/test/dfect_rb.html +67 -0
- data/doc/api/files/lib/inochi/test/matchy_rb.html +69 -0
- data/doc/api/files/lib/inochi/test/minitest_rb.html +71 -0
- data/doc/api/files/lib/inochi/test/mocha_rb.html +67 -0
- data/doc/api/files/lib/inochi/test/rspec_rb.html +67 -0
- data/doc/api/files/lib/inochi/test/shoulda_rb.html +67 -0
- data/doc/api/files/lib/inochi/test/test_spec_rb.html +67 -0
- data/doc/api/files/lib/inochi/test/test_unit_rb.html +67 -0
- data/doc/api/files/lib/inochi/util/combo_rb.html +59 -0
- data/doc/api/files/lib/inochi/util/tempdir_rb.html +68 -0
- data/doc/api/files/lib/inochi/util_rb.html +59 -0
- data/doc/api/files/lib/inochi_rb.html +78 -0
- data/doc/api/i/arrows.png +0 -0
- data/doc/api/i/results_bg.png +0 -0
- data/doc/api/i/tree_bg.png +0 -0
- data/doc/api/index.html +14 -18
- data/doc/api/js/jquery-1.3.2.min.js +19 -0
- data/doc/api/js/jquery-effect.js +593 -0
- data/doc/api/js/main.js +22 -0
- data/doc/api/js/searchdoc.js +605 -0
- data/doc/api/panel/index.html +63 -0
- data/doc/api/panel/search_index.js +1 -0
- data/doc/api/panel/tree.js +1 -0
- data/doc/history.erb +75 -34
- data/doc/index.erb +10 -5
- data/doc/index.xhtml +806 -1145
- data/doc/intro.erb +33 -27
- data/doc/setup.erb +16 -15
- data/doc/usage.erb +86 -137
- data/lib/inochi.rb +25 -13
- data/lib/inochi/book.rb +13 -6
- data/lib/inochi/init.rb +41 -24
- data/lib/inochi/main.rb +17 -7
- data/lib/inochi/rake.rb +200 -59
- data/lib/inochi/test/bacon.rb +3 -0
- data/lib/inochi/test/context.rb +4 -0
- data/lib/inochi/test/dfect.rb +3 -0
- data/lib/inochi/test/matchy.rb +4 -0
- data/lib/inochi/test/minitest.rb +7 -0
- data/lib/inochi/test/mocha.rb +3 -0
- data/lib/inochi/test/rspec.rb +3 -0
- data/lib/inochi/test/shoulda.rb +3 -0
- data/lib/inochi/test/test_spec.rb +3 -0
- data/lib/inochi/test/test_unit.rb +3 -0
- data/lib/inochi/util.rb +23 -1
- data/lib/inochi/util/combo.rb +191 -0
- data/lib/inochi/util/tempdir.rb +29 -0
- data/rakefile +12 -0
- data/test/inochi.rb +5 -0
- metadata +119 -45
- data/Rakefile +0 -6
- data/doc/api/Inochi.html +0 -2574
- data/doc/api/Inochi/Manual.html +0 -230
- data/doc/api/Inochi/Phrases.html +0 -409
- data/doc/api/Inochi/Version.html +0 -222
- data/doc/api/all-methods.html +0 -180
- data/doc/api/all-namespaces.html +0 -28
- data/doc/api/app.js +0 -18
- data/doc/api/jquery.js +0 -11
- data/doc/api/readme.html +0 -38
- data/doc/api/style.css +0 -68
- data/doc/api/syntax_highlight.css +0 -21
- data/doc/theory.erb +0 -3
@@ -0,0 +1,157 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<title>Inochi::Manual</title>
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
8
|
+
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
|
9
|
+
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
|
10
|
+
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
11
|
+
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
12
|
+
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
</head>
|
14
|
+
|
15
|
+
<body>
|
16
|
+
<div class="banner">
|
17
|
+
<h1>
|
18
|
+
<span class="type">Module</span>
|
19
|
+
Inochi::Manual
|
20
|
+
|
21
|
+
</h1>
|
22
|
+
<ul class="files">
|
23
|
+
|
24
|
+
<li><a href="../../files/lib/inochi/book_rb.html">lib/inochi/book.rb</a></li>
|
25
|
+
|
26
|
+
</ul>
|
27
|
+
</div>
|
28
|
+
<div id="bodyContent">
|
29
|
+
<div id="content">
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
<div class="sectiontitle">Methods</div>
|
40
|
+
<dl class="methods">
|
41
|
+
|
42
|
+
<dt>H</dt>
|
43
|
+
<dd>
|
44
|
+
<ul>
|
45
|
+
|
46
|
+
<li><a href="#M000013">history</a></li>
|
47
|
+
|
48
|
+
</ul>
|
49
|
+
</dd>
|
50
|
+
|
51
|
+
<dt>P</dt>
|
52
|
+
<dd>
|
53
|
+
<ul>
|
54
|
+
|
55
|
+
<li><a href="#M000012">project</a></li>
|
56
|
+
|
57
|
+
</ul>
|
58
|
+
</dd>
|
59
|
+
|
60
|
+
</dl>
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
<div class="sectiontitle">Instance Public methods</div>
|
75
|
+
|
76
|
+
<div class="method">
|
77
|
+
<div class="title" id="M000013">
|
78
|
+
|
79
|
+
<a name="M000013"></a><b>history</b>()
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
<div class="description">
|
84
|
+
<p>
|
85
|
+
Contains release notes for all project releases.
|
86
|
+
</p>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<div class="sourcecode">
|
94
|
+
<p class="source-link">
|
95
|
+
Source: <a href="javascript:toggleSource('M000013_source')" id="l_M000013_source">show</a>
|
96
|
+
|
97
|
+
| <a href="http://github.com/sunaku/inochi/blob/5f65225f952717327ab0d21f371307dcd335f34c/lib/inochi/book.rb#L82" target="_blank" class="github_url">on GitHub</a>
|
98
|
+
|
99
|
+
</p>
|
100
|
+
<div id="M000013_source" class="dyn-source">
|
101
|
+
<pre><span class="ruby-comment cmt"># File lib/inochi/book.rb, line 82</span>
|
102
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">history</span>
|
103
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">'block must be given'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block_given?</span>
|
104
|
+
|
105
|
+
<span class="ruby-identifier">node</span> <span class="ruby-keyword kw">do</span>
|
106
|
+
<span class="ruby-identifier">$project_history_node</span> = <span class="ruby-ivar">@nodes</span>.<span class="ruby-identifier">last</span>
|
107
|
+
<span class="ruby-keyword kw">yield</span>
|
108
|
+
<span class="ruby-keyword kw">end</span>
|
109
|
+
<span class="ruby-keyword kw">end</span></pre>
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<div class="method">
|
116
|
+
<div class="title" id="M000012">
|
117
|
+
|
118
|
+
<a name="M000012"></a><b>project</b>()
|
119
|
+
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div class="description">
|
123
|
+
<p>
|
124
|
+
Defines a brief summary of this project.
|
125
|
+
</p>
|
126
|
+
|
127
|
+
</div>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<div class="sourcecode">
|
133
|
+
<p class="source-link">
|
134
|
+
Source: <a href="javascript:toggleSource('M000012_source')" id="l_M000012_source">show</a>
|
135
|
+
|
136
|
+
| <a href="http://github.com/sunaku/inochi/blob/5f65225f952717327ab0d21f371307dcd335f34c/lib/inochi/book.rb#L70" target="_blank" class="github_url">on GitHub</a>
|
137
|
+
|
138
|
+
</p>
|
139
|
+
<div id="M000012_source" class="dyn-source">
|
140
|
+
<pre><span class="ruby-comment cmt"># File lib/inochi/book.rb, line 70</span>
|
141
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">project</span>
|
142
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">'block must be given'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block_given?</span>
|
143
|
+
|
144
|
+
<span class="ruby-identifier">node</span> <span class="ruby-keyword kw">do</span>
|
145
|
+
<span class="ruby-identifier">$project_summary_node</span> = <span class="ruby-ivar">@nodes</span>.<span class="ruby-identifier">last</span>
|
146
|
+
<span class="ruby-keyword kw">yield</span>
|
147
|
+
<span class="ruby-keyword kw">end</span>
|
148
|
+
<span class="ruby-keyword kw">end</span></pre>
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
</div>
|
153
|
+
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
</body>
|
157
|
+
</html>
|
@@ -0,0 +1,331 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<title>Inochi::Phrases</title>
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
8
|
+
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
|
9
|
+
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
|
10
|
+
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
11
|
+
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
12
|
+
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
</head>
|
14
|
+
|
15
|
+
<body>
|
16
|
+
<div class="banner">
|
17
|
+
<h1>
|
18
|
+
<span class="type">Class</span>
|
19
|
+
Inochi::Phrases
|
20
|
+
|
21
|
+
<span class="parent"><
|
22
|
+
|
23
|
+
Object
|
24
|
+
|
25
|
+
</span>
|
26
|
+
|
27
|
+
</h1>
|
28
|
+
<ul class="files">
|
29
|
+
|
30
|
+
<li><a href="../../files/lib/inochi/init_rb.html">lib/inochi/init.rb</a></li>
|
31
|
+
|
32
|
+
</ul>
|
33
|
+
</div>
|
34
|
+
<div id="bodyContent">
|
35
|
+
<div id="content">
|
36
|
+
|
37
|
+
<div class="description">
|
38
|
+
<p>
|
39
|
+
Interface to translations of human text used in a project.
|
40
|
+
</p>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
<div class="sectiontitle">Methods</div>
|
53
|
+
<dl class="methods">
|
54
|
+
|
55
|
+
<dt>#</dt>
|
56
|
+
<dd>
|
57
|
+
<ul>
|
58
|
+
|
59
|
+
<li><a href="#M000029">[]</a></li>
|
60
|
+
|
61
|
+
</ul>
|
62
|
+
</dd>
|
63
|
+
|
64
|
+
<dt>L</dt>
|
65
|
+
<dd>
|
66
|
+
<ul>
|
67
|
+
|
68
|
+
<li><a href="#M000027">locale=</a></li>
|
69
|
+
|
70
|
+
</ul>
|
71
|
+
</dd>
|
72
|
+
|
73
|
+
<dt>M</dt>
|
74
|
+
<dd>
|
75
|
+
<ul>
|
76
|
+
|
77
|
+
<li><a href="#M000030">method_missing</a></li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
</dd>
|
81
|
+
|
82
|
+
<dt>N</dt>
|
83
|
+
<dd>
|
84
|
+
<ul>
|
85
|
+
|
86
|
+
<li><a href="#M000026">new</a></li>
|
87
|
+
|
88
|
+
</ul>
|
89
|
+
</dd>
|
90
|
+
|
91
|
+
<dt>P</dt>
|
92
|
+
<dd>
|
93
|
+
<ul>
|
94
|
+
|
95
|
+
<li><a href="#M000028">phrases</a></li>
|
96
|
+
|
97
|
+
</ul>
|
98
|
+
</dd>
|
99
|
+
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
<div class="sectiontitle">Attributes</div>
|
113
|
+
<table border='0' cellpadding='5'>
|
114
|
+
|
115
|
+
<tr valign='top'>
|
116
|
+
<td class='attr-rw'>
|
117
|
+
[R]
|
118
|
+
</td>
|
119
|
+
<td class='attr-name'>locale</td>
|
120
|
+
<td class='attr-desc'><p>
|
121
|
+
The locale into which the #[] method will translate phrases.
|
122
|
+
</p></td>
|
123
|
+
</tr>
|
124
|
+
|
125
|
+
</table>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<div class="sectiontitle">Class Public methods</div>
|
130
|
+
|
131
|
+
<div class="method">
|
132
|
+
<div class="title" id="M000026">
|
133
|
+
|
134
|
+
<a name="M000026"></a><b>new</b>(project_install_dir)
|
135
|
+
|
136
|
+
</div>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<div class="sourcecode">
|
142
|
+
<p class="source-link">
|
143
|
+
Source: <a href="javascript:toggleSource('M000026_source')" id="l_M000026_source">show</a>
|
144
|
+
|
145
|
+
| <a href="http://github.com/sunaku/inochi/blob/61f28653cea6fab1bfd8cffb07a666c236b243be/lib/inochi/init.rb#L175" target="_blank" class="github_url">on GitHub</a>
|
146
|
+
|
147
|
+
</p>
|
148
|
+
<div id="M000026_source" class="dyn-source">
|
149
|
+
<pre><span class="ruby-comment cmt"># File lib/inochi/init.rb, line 175</span>
|
150
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">project_install_dir</span>
|
151
|
+
<span class="ruby-comment cmt"># load language translations dynamically</span>
|
152
|
+
<span class="ruby-identifier">lang_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">project_install_dir</span>, <span class="ruby-value str">'lang'</span>)
|
153
|
+
|
154
|
+
<span class="ruby-ivar">@phrases_by_language</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cache</span>, <span class="ruby-identifier">language</span><span class="ruby-operator">|</span>
|
155
|
+
<span class="ruby-comment cmt"># store the phrase upon failure so that</span>
|
156
|
+
<span class="ruby-comment cmt"># the phrases() method will know about it</span>
|
157
|
+
<span class="ruby-identifier">phrases</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,<span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-keyword kw">nil</span> }
|
158
|
+
|
159
|
+
<span class="ruby-identifier">lang_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">lang_dir</span>, <span class="ruby-node">"#{language}.yaml"</span>)
|
160
|
+
<span class="ruby-identifier">lang_data</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load_file</span>(<span class="ruby-identifier">lang_file</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
161
|
+
<span class="ruby-identifier">phrases</span>.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">lang_data</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lang_data</span>
|
162
|
+
|
163
|
+
<span class="ruby-identifier">cache</span>[<span class="ruby-identifier">language</span>] = <span class="ruby-identifier">phrases</span>
|
164
|
+
<span class="ruby-keyword kw">end</span>
|
165
|
+
|
166
|
+
<span class="ruby-comment cmt"># detect user's preferred locale</span>
|
167
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">locale</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'LC_ALL'</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'LC_MESSAGES'</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'LANG'</span>]
|
168
|
+
<span class="ruby-keyword kw">end</span></pre>
|
169
|
+
</div>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
</div>
|
173
|
+
|
174
|
+
<div class="sectiontitle">Instance Public methods</div>
|
175
|
+
|
176
|
+
<div class="method">
|
177
|
+
<div class="title" id="M000029">
|
178
|
+
|
179
|
+
<a name="M000029"></a><b>[]</b>(phrase, *words)
|
180
|
+
|
181
|
+
</div>
|
182
|
+
|
183
|
+
<div class="description">
|
184
|
+
<p>
|
185
|
+
Translates the given phrase into the target locale (see <a
|
186
|
+
href="Phrases.html#locale">locale</a> and <a
|
187
|
+
href="Phrases.html#M000027">locale=</a>) and then substitutes the given
|
188
|
+
placeholder arguments into the translation (see Kernel#sprintf).
|
189
|
+
</p>
|
190
|
+
<p>
|
191
|
+
If a translation is not available for the given phrase, then the given
|
192
|
+
phrase will be used as-is, untranslated.
|
193
|
+
</p>
|
194
|
+
|
195
|
+
</div>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
<div class="sourcecode">
|
201
|
+
<p class="source-link">
|
202
|
+
Source: <a href="javascript:toggleSource('M000029_source')" id="l_M000029_source">show</a>
|
203
|
+
|
204
|
+
| <a href="http://github.com/sunaku/inochi/blob/61f28653cea6fab1bfd8cffb07a666c236b243be/lib/inochi/init.rb#L223" target="_blank" class="github_url">on GitHub</a>
|
205
|
+
|
206
|
+
</p>
|
207
|
+
<div id="M000029_source" class="dyn-source">
|
208
|
+
<pre><span class="ruby-comment cmt"># File lib/inochi/init.rb, line 223</span>
|
209
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span> <span class="ruby-identifier">phrase</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">words</span>
|
210
|
+
<span class="ruby-identifier">translate</span> <span class="ruby-ivar">@language</span>, <span class="ruby-identifier">phrase</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">words</span>
|
211
|
+
<span class="ruby-keyword kw">end</span></pre>
|
212
|
+
</div>
|
213
|
+
</div>
|
214
|
+
|
215
|
+
</div>
|
216
|
+
|
217
|
+
<div class="method">
|
218
|
+
<div class="title" id="M000027">
|
219
|
+
|
220
|
+
<a name="M000027"></a><b>locale=</b>(locale)
|
221
|
+
|
222
|
+
</div>
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
<div class="sourcecode">
|
228
|
+
<p class="source-link">
|
229
|
+
Source: <a href="javascript:toggleSource('M000027_source')" id="l_M000027_source">show</a>
|
230
|
+
|
231
|
+
| <a href="http://github.com/sunaku/inochi/blob/61f28653cea6fab1bfd8cffb07a666c236b243be/lib/inochi/init.rb#L198" target="_blank" class="github_url">on GitHub</a>
|
232
|
+
|
233
|
+
</p>
|
234
|
+
<div id="M000027_source" class="dyn-source">
|
235
|
+
<pre><span class="ruby-comment cmt"># File lib/inochi/init.rb, line 198</span>
|
236
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">locale=</span> <span class="ruby-identifier">locale</span>
|
237
|
+
<span class="ruby-ivar">@locale</span> = <span class="ruby-identifier">locale</span>.<span class="ruby-identifier">to_s</span>
|
238
|
+
|
239
|
+
<span class="ruby-comment cmt"># extract the language portion of the locale</span>
|
240
|
+
<span class="ruby-identifier">language</span> = <span class="ruby-ivar">@locale</span>[<span class="ruby-regexp re">/^[[:alpha:]]+/</span>].<span class="ruby-identifier">to_s</span>
|
241
|
+
<span class="ruby-ivar">@language</span> = <span class="ruby-identifier">language</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^(C|POSIX)?$/i</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">:en</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">language</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">to_sym</span>
|
242
|
+
<span class="ruby-keyword kw">end</span></pre>
|
243
|
+
</div>
|
244
|
+
</div>
|
245
|
+
|
246
|
+
</div>
|
247
|
+
|
248
|
+
<div class="method">
|
249
|
+
<div class="title" id="M000030">
|
250
|
+
|
251
|
+
<a name="M000030"></a><b>method_missing</b>(meth, *args)
|
252
|
+
|
253
|
+
</div>
|
254
|
+
|
255
|
+
<div class="description">
|
256
|
+
<p>
|
257
|
+
Provides access to translations in any language, regardless of the target
|
258
|
+
locale (see <a href="Phrases.html#locale">locale</a> and <a
|
259
|
+
href="Phrases.html#M000027">locale=</a>).
|
260
|
+
</p>
|
261
|
+
<p>
|
262
|
+
For example, you can access Japanese translations via the jp method even if
|
263
|
+
the target locale is French.
|
264
|
+
</p>
|
265
|
+
|
266
|
+
</div>
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
<div class="sourcecode">
|
272
|
+
<p class="source-link">
|
273
|
+
Source: <a href="javascript:toggleSource('M000030_source')" id="l_M000030_source">show</a>
|
274
|
+
|
275
|
+
| <a href="http://github.com/sunaku/inochi/blob/61f28653cea6fab1bfd8cffb07a666c236b243be/lib/inochi/init.rb#L234" target="_blank" class="github_url">on GitHub</a>
|
276
|
+
|
277
|
+
</p>
|
278
|
+
<div id="M000030_source" class="dyn-source">
|
279
|
+
<pre><span class="ruby-comment cmt"># File lib/inochi/init.rb, line 234</span>
|
280
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span> <span class="ruby-identifier">meth</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
|
281
|
+
<span class="ruby-comment cmt"># ISO 639 language codes come in alpha-2 and alpha-3 forms</span>
|
282
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">meth</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[a-z]{2,3}$/</span>
|
283
|
+
<span class="ruby-identifier">translate</span> <span class="ruby-identifier">meth</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
|
284
|
+
<span class="ruby-keyword kw">else</span>
|
285
|
+
<span class="ruby-keyword kw">super</span>
|
286
|
+
<span class="ruby-keyword kw">end</span>
|
287
|
+
<span class="ruby-keyword kw">end</span></pre>
|
288
|
+
</div>
|
289
|
+
</div>
|
290
|
+
|
291
|
+
</div>
|
292
|
+
|
293
|
+
<div class="method">
|
294
|
+
<div class="title" id="M000028">
|
295
|
+
|
296
|
+
<a name="M000028"></a><b>phrases</b>()
|
297
|
+
|
298
|
+
</div>
|
299
|
+
|
300
|
+
<div class="description">
|
301
|
+
<p>
|
302
|
+
Returns all phrases that underwent (or attempted) translation via this
|
303
|
+
object.
|
304
|
+
</p>
|
305
|
+
|
306
|
+
</div>
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
<div class="sourcecode">
|
312
|
+
<p class="source-link">
|
313
|
+
Source: <a href="javascript:toggleSource('M000028_source')" id="l_M000028_source">show</a>
|
314
|
+
|
315
|
+
| <a href="http://github.com/sunaku/inochi/blob/61f28653cea6fab1bfd8cffb07a666c236b243be/lib/inochi/init.rb#L210" target="_blank" class="github_url">on GitHub</a>
|
316
|
+
|
317
|
+
</p>
|
318
|
+
<div id="M000028_source" class="dyn-source">
|
319
|
+
<pre><span class="ruby-comment cmt"># File lib/inochi/init.rb, line 210</span>
|
320
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">phrases</span>
|
321
|
+
<span class="ruby-ivar">@phrases_by_language</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">keys</span> }.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">sort</span>
|
322
|
+
<span class="ruby-keyword kw">end</span></pre>
|
323
|
+
</div>
|
324
|
+
</div>
|
325
|
+
|
326
|
+
</div>
|
327
|
+
|
328
|
+
</div>
|
329
|
+
</div>
|
330
|
+
</body>
|
331
|
+
</html>
|