File: TextDomain.html

package info (click to toggle)
libgettext-ruby 1.7.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,892 kB
  • ctags: 1,198
  • sloc: ruby: 6,738; ansic: 67; makefile: 38; sql: 14; sh: 6
file content (345 lines) | stat: -rw-r--r-- 8,454 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>Class: GetText::TextDomain</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />

    <script language="JavaScript" type="text/javascript">
    // <![CDATA[

        function toggleSource( id )
        {
          var elem
          var link

          if( document.getElementById )
          {
            elem = document.getElementById( id )
            link = document.getElementById( "l_" + id )
          }
          else if ( document.all )
          {
            elem = eval( "document.all." + id )
            link = eval( "document.all.l_" + id )
          }
          else
            return false;

          if( elem.style.display == "block" )
          {
            elem.style.display = "none"
            link.innerHTML = "show source"
          }
          else
          {
            elem.style.display = "block"
            link.innerHTML = "hide source"
          }
        }

        function openCode( url )
        {
          window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
        }
      // ]]>
    </script>
  </head>

  <body>
  <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
  <td class="file-title"><span class="file-title-prefix">Class</span><br />GetText::TextDomain</td>
  <td align="right">
    <table cellspacing=0 cellpadding=2>
      <tr valign="top">
        <td>In:</td>
        <td>
<a href="../../files/lib/gettext/textdomain_rb.html">lib/gettext/textdomain.rb</a>
        </td>
      </tr>
    <tr>
      <td>Parent:</td>
      <td>
Object
     </td>
   </tr>
         </table>
        </td>
        </tr>
      </table>
 <!-- banner header -->

  <div id="bodyContent">
      <div id="content">

  <div class="description"><p>
<a href="TextDomain.html">GetText::TextDomain</a> class manages mo-files of
a textdomain.
</p>
<p>
Usually, you don&#8217;t need to use this class directly.
</p>
<p>
Notice: This class is unstable. APIs will be changed.
</p>
</div>



  <div class="sectiontitle">Methods</div>
  <ul>
  <li><a href="#M000054">add_default_locale_path</a></li>
  <li><a href="#M000053">check_mo=</a></li>
  <li><a href="#M000052">check_mo?</a></li>
  <li><a href="#M000057">gettext</a></li>
  <li><a href="#M000055">new</a></li>
  <li><a href="#M000058">ngettext</a></li>
  <li><a href="#M000059">same_property?</a></li>
  <li><a href="#M000056">set_locale</a></li>
  </ul>




  <div class="sectiontitle">Constants</div>
  <table border='0' cellpadding='5'>
  <tr valign='top'>
    <td class="attr-name">CONFIG_PREFIX</td>
    <td>=</td>
    <td class="attr-value">Config::CONFIG['prefix'].gsub(/\/local/, &quot;&quot;)</td>
  </tr>
  <tr valign='top'>
    <td>&nbsp;</td>
    <td colspan="2" class="attr-desc">
The default locale paths.

</td>
  </tr>
  <tr valign='top'>
    <td class="attr-name">DEFAULT_LOCALE_PATHS</td>
    <td>=</td>
    <td class="attr-value">[       &quot;#{Config::CONFIG['datadir']}/locale/%{locale}/LC_MESSAGES/%{name}.mo&quot;,       &quot;#{Config::CONFIG['datadir'].gsub(/\/local/, &quot;&quot;)}/locale/%{locale}/LC_MESSAGES/%{name}.mo&quot;,       &quot;#{CONFIG_PREFIX}/share/locale/%{locale}/LC_MESSAGES/%{name}.mo&quot;,       &quot;#{CONFIG_PREFIX}/local/share/locale/%{locale}/LC_MESSAGES/%{name}.mo&quot;</td>
  </tr>
  </table>

  <div class="sectiontitle">Attributes</div>
  <table border='0' cellpadding='5'>
  <tr valign='top'>
    <td class='attr-rw'>
[R]
    </td>
    <td class='attr-name'>current_locale</td>
    <td class='attr-desc'></td>
  </tr>
  <tr valign='top'>
    <td class='attr-rw'>
[R]
    </td>
    <td class='attr-name'>current_mo</td>
    <td class='attr-desc'></td>
  </tr>
  <tr valign='top'>
    <td class='attr-rw'>
[R]
    </td>
    <td class='attr-name'>locale_paths</td>
    <td class='attr-desc'></td>
  </tr>
  <tr valign='top'>
    <td class='attr-rw'>
[R]
    </td>
    <td class='attr-name'>name</td>
    <td class='attr-desc'></td>
  </tr>
  </table>

<div class="sectiontitle">Public Class methods</div>
<div class="method">
  <div class="title">
    <a name="M000054"></a><b>add_default_locale_path</b>(path)
[ <a href="javascript:openCode('TextDomain.src/M000054.html')">source</a> ]
  </div>
  <div class="description">
  <p>
Add default locale path. Usually you should use <a
href="../GetText.html#M000040">GetText.add_default_locale_path</a> instead.
</p>
<ul>
<li>path: a new locale path. (e.g.)
&quot;/usr/share/locale/%{locale}/LC_MESSAGES/%{name}.mo&quot;
(&#8216;locale&#8217; =&gt; &quot;ja_JP&quot;, &#8216;name&#8217; =&gt;
&quot;textdomain&quot;)

</li>
<li>Returns: the new DEFAULT_LOCALE_PATHS

</li>
</ul>
  </div>
</div>
<div class="method">
  <div class="title">
    <a name="M000053"></a><b>check_mo=</b>(val)
[ <a href="javascript:openCode('TextDomain.src/M000053.html')">source</a> ]
  </div>
  <div class="description">
  <p>
Sets to check mo-file or not. See GetText::TextDoman.check_mo? for more
details.
</p>
<ul>
<li>val: true if &quot;check mo&quot; mode.

</li>
<li>Returns: val

</li>
</ul>
  </div>
</div>
<div class="method">
  <div class="title">
    <a name="M000052"></a><b>check_mo?</b>()
[ <a href="javascript:openCode('TextDomain.src/M000052.html')">source</a> ]
  </div>
  <div class="description">
  <p>
Check mo-file is modified or not, and if mo-file is modified, reload
mo-file again. This is effective in debug mode. Default is false. If $DEBUG
is true, mo-file is checked even if this value is false.
</p>
<ul>
<li>Returns: true if &quot;check mo&quot; mode.

</li>
</ul>
  </div>
</div>
<div class="method">
  <div class="title">
    <a name="M000055"></a><b>new</b>(name, topdir = nil, locale = nil)
[ <a href="javascript:openCode('TextDomain.src/M000055.html')">source</a> ]
  </div>
  <div class="description">
  <p>
Creates a new <a href="TextDomain.html">GetText::TextDomain</a>.
</p>
<ul>
<li>name: the textdomain name.

</li>
<li>topdir: the top directory of mo files or nil.

</li>
<li>locale: the <a href="../Locale/Object.html">Locale::Object</a> or nil.

</li>
<li>Returns: a newly created <a href="TextDomain.html">GetText::TextDomain</a>
object.

</li>
</ul>
  </div>
</div>
<div class="sectiontitle">Public Instance methods</div>
<div class="method">
  <div class="title">
    <a name="M000057"></a><b>gettext</b>(msgid)
[ <a href="javascript:openCode('TextDomain.src/M000057.html')">source</a> ]
  </div>
  <div class="description">
  <p>
Gets the translated string.
</p>
<ul>
<li>msgid: the original message.

</li>
<li>Returns: the translated string or nil if not found.

</li>
</ul>
  </div>
</div>
<div class="method">
  <div class="title">
    <a name="M000058"></a><b>ngettext</b>(msgid, msgid_plural, n)
[ <a href="javascript:openCode('TextDomain.src/M000058.html')">source</a> ]
  </div>
  <div class="description">
  <p>
Gets the translated string.
</p>
<ul>
<li>msgid: the original message(single).

</li>
<li>msgid: the original message(plural).

</li>
<li>n: the number

</li>
<li>Returns: the translated string or nil if not found.

</li>
</ul>
  </div>
</div>
<div class="method">
  <div class="title">
    <a name="M000059"></a><b>same_property?</b>(name, topdir, locale)
[ <a href="javascript:openCode('TextDomain.src/M000059.html')">source</a> ]
  </div>
  <div class="description">
  <p>
Compare this object has the same name, topdir and locale.
</p>
<ul>
<li>name: the textdomain name

</li>
<li>topdir: the top directory of mo files or nil.

</li>
<li>locale: the <a href="../Locale/Object.html">Locale::Object</a> or nil.

</li>
<li>Returns: true if this object has all of the same name, topdir and locale.

</li>
</ul>
  </div>
</div>
<div class="method">
  <div class="title">
    <a name="M000056"></a><b>set_locale</b>(locale, reload = false)
[ <a href="javascript:openCode('TextDomain.src/M000056.html')">source</a> ]
  </div>
  <div class="description">
  <p>
Sets a new <a href="../Locale/Object.html">Locale::Object</a>.
</p>
<ul>
<li>locale: a <a href="../Locale/Object.html">Locale::Object</a>

</li>
<li>reload: true if the mo-file is reloaded forcely

</li>
<li>Returns: self

</li>
</ul>
  </div>
</div>
</div>

  </div>

    </body>
</html>