locale 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +3 -0
- data/benchmark/benchmark.rb +34 -0
- data/benchmark/benchmark_2.0.1.txt +7 -0
- data/doc/classes/Locale.html +1244 -0
- data/doc/classes/Locale/Driver.html +374 -0
- data/doc/classes/Locale/Driver/CGI.html +536 -0
- data/doc/classes/Locale/Driver/Env.html +439 -0
- data/doc/classes/Locale/Driver/JRuby.html +389 -0
- data/doc/classes/Locale/Driver/Posix.html +430 -0
- data/doc/classes/Locale/Driver/Win32.html +398 -0
- data/doc/classes/Locale/Driver/Win32Table.html +355 -0
- data/doc/classes/Locale/Info.html +585 -0
- data/doc/classes/Locale/Info/Language.html +763 -0
- data/doc/classes/Locale/Info/Region.html +470 -0
- data/doc/classes/Locale/Tag.html +433 -0
- data/doc/classes/Locale/Tag/Cldr.html +523 -0
- data/doc/classes/Locale/Tag/Common.html +624 -0
- data/doc/classes/Locale/Tag/Irregular.html +423 -0
- data/doc/classes/Locale/Tag/Posix.html +612 -0
- data/doc/classes/Locale/Tag/Rfc.html +581 -0
- data/doc/classes/Locale/Tag/Simple.html +721 -0
- data/doc/classes/Locale/TagList.html +826 -0
- data/doc/classes/Locale/Util.html +506 -0
- data/doc/classes/Locale/Util/Memoizable.html +355 -0
- data/doc/created.rid +1 -0
- data/doc/files/ChangeLog.html +537 -0
- data/doc/files/README_rdoc.html +565 -0
- data/doc/files/lib/locale/driver/cgi_rb.html +341 -0
- data/doc/files/lib/locale/driver/env_rb.html +353 -0
- data/doc/files/lib/locale/driver/jruby_rb.html +353 -0
- data/doc/files/lib/locale/driver/posix_rb.html +341 -0
- data/doc/files/lib/locale/driver/win32_rb.html +348 -0
- data/doc/files/lib/locale/driver/win32_table_rb.html +341 -0
- data/doc/files/lib/locale/info/language_rb.html +352 -0
- data/doc/files/lib/locale/info/region_rb.html +352 -0
- data/doc/files/lib/locale/info_rb.html +353 -0
- data/doc/files/lib/locale/tag/cldr_rb.html +348 -0
- data/doc/files/lib/locale/tag/common_rb.html +348 -0
- data/doc/files/lib/locale/tag/irregular_rb.html +348 -0
- data/doc/files/lib/locale/tag/posix_rb.html +341 -0
- data/doc/files/lib/locale/tag/rfc_rb.html +348 -0
- data/doc/files/lib/locale/tag/simple_rb.html +348 -0
- data/doc/files/lib/locale/tag_rb.html +378 -0
- data/doc/files/lib/locale/taglist_rb.html +348 -0
- data/doc/files/lib/locale/util/memoizable_rb.html +359 -0
- data/doc/files/lib/locale/version_rb.html +341 -0
- data/doc/files/lib/locale_rb.html +363 -0
- data/doc/fr_class_index.html +22 -0
- data/doc/fr_file_index.html +23 -0
- data/doc/fr_method_index.html +99 -0
- data/doc/index.html +1 -0
- data/doc/rdoc-style.css +320 -0
- data/lib/locale/util/memoizable.rb.20090328 +96 -0
- data/lib/locale/util/memoizable.rb.old +91 -0
- data/lib/locale/version.rb +1 -1
- data/replace.rb +21 -0
- data/test.rb +28 -0
- data/test/test.rb +7 -0
- data/test/tmp.txt +20 -0
- data/test2.rb +14 -0
- data/test3.rb +12 -0
- metadata +75 -1
@@ -0,0 +1,721 @@
|
|
1
|
+
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><title>Class: Locale::Tag::Simple</title><link type="text/css" href="../../.././rdoc-style.css" media="screen" rel="stylesheet"/><script type="text/javascript">
|
2
|
+
// Allison template
|
3
|
+
// Copyright 2007, 2008 Cloudburst, LLC. Licensed under the AFL 3. See the included LICENSE file.
|
4
|
+
|
5
|
+
var href_base = '../../.././rdoc-style.css'.replace(/(.*\/).*/, '$1'); // inline js is good for something
|
6
|
+
|
7
|
+
function $(id) {
|
8
|
+
if (document.getElementById)
|
9
|
+
elem = document.getElementById(id);
|
10
|
+
else if ( document.all )
|
11
|
+
elem = eval("document.all." + id);
|
12
|
+
else
|
13
|
+
return false;
|
14
|
+
return elem;
|
15
|
+
}
|
16
|
+
|
17
|
+
function toggle(id) {
|
18
|
+
elem = $(id);
|
19
|
+
elemStyle = elem.style;
|
20
|
+
if (elemStyle.display == "block") {
|
21
|
+
elemStyle.display = "none"
|
22
|
+
} else {
|
23
|
+
elemStyle.display = "block"
|
24
|
+
}
|
25
|
+
return true;
|
26
|
+
}
|
27
|
+
|
28
|
+
function toggleText(id) {
|
29
|
+
elem = $(id)
|
30
|
+
if (m = elem.innerHTML.match(/(Hide)(.*)/)) {
|
31
|
+
elem.innerHTML = "Show" + m[2];
|
32
|
+
} else if (m = elem.innerHTML.match(/(Show)(.*)/)) {
|
33
|
+
elem.innerHTML = "Hide" + m[2];
|
34
|
+
}
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
function span(s, klass) {
|
39
|
+
return '<span class="' + klass + '">' + s + '</span>';
|
40
|
+
}
|
41
|
+
|
42
|
+
function highlightSymbols() {
|
43
|
+
pres = document.getElementsByTagName('pre');
|
44
|
+
for(var i = 0; i < pres.length; i++) {
|
45
|
+
pre = pres[i];
|
46
|
+
spans = pre.getElementsByTagName('span');
|
47
|
+
for(var k = 0; k < spans.length; k++) {
|
48
|
+
span = spans[k];
|
49
|
+
if (span.className.match(/ruby-identifier/)) {
|
50
|
+
if (span.innerHTML.match(/^:/)) {
|
51
|
+
span.className += " ruby-symbol";
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
function hasClass(obj) {
|
59
|
+
var result = false;
|
60
|
+
if (obj.getAttributeNode("class") != null) {
|
61
|
+
result = obj.getAttributeNode("class").value;
|
62
|
+
}
|
63
|
+
return result;
|
64
|
+
}
|
65
|
+
|
66
|
+
function stripe() {
|
67
|
+
var even = true;
|
68
|
+
var color = "#e4ebed";
|
69
|
+
var tables = document.getElementsByTagName('table');
|
70
|
+
if (tables.length == 0) { return; }
|
71
|
+
for (var h = 0; h < tables.length; h++) {
|
72
|
+
var trs = tables[h].getElementsByTagName("tr");
|
73
|
+
for (var i = 0; i < trs.length; i++) {
|
74
|
+
var tds = trs[i].getElementsByTagName("td");
|
75
|
+
for (var j = 0; j < tds.length; j++) {
|
76
|
+
if (hasClass(tds[j]) != "first") {
|
77
|
+
var mytd = tds[j];
|
78
|
+
if (even) {
|
79
|
+
mytd.style.backgroundColor = color;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
even = ! even;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
function ajaxGet(url) {
|
89
|
+
url = (href_base + url).replace('/./', '/')
|
90
|
+
var req = false;
|
91
|
+
|
92
|
+
if (window.ActiveXObject) {
|
93
|
+
try {
|
94
|
+
// stupid hack because IE7 disables local Ajax with the native xmlhttprequest object
|
95
|
+
// for security purposes. Yet ActiveX still works. Thanks, Microsoft. I hate you. Die.
|
96
|
+
req = new ActiveXObject("MSXML2.XMLHTTP.3.0");
|
97
|
+
} catch (e) {
|
98
|
+
try {
|
99
|
+
/* IE 6 and maybe 5, don't know, don't care */
|
100
|
+
req = new ActiveXObject("Msxml2.XMLHTTP");
|
101
|
+
} catch (e) {
|
102
|
+
try {
|
103
|
+
req = new ActiveXObject("Microsoft.XMLHTTP");
|
104
|
+
} catch (e) {
|
105
|
+
req = false;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
/* real browsers */
|
112
|
+
if (!req && window.XMLHttpRequest) {
|
113
|
+
try {
|
114
|
+
req = new XMLHttpRequest();
|
115
|
+
} catch (e) {
|
116
|
+
req = false;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
if (req) {
|
121
|
+
req.open('GET', url, false);
|
122
|
+
req.send(null);
|
123
|
+
return req.responseText;
|
124
|
+
} else {
|
125
|
+
return "Ajax error";
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
|
130
|
+
function addEvent(elm, evType, fn, useCapture) {
|
131
|
+
if (elm.addEventListener) {
|
132
|
+
elm.addEventListener(evType, fn, useCapture);
|
133
|
+
return true;
|
134
|
+
} else if (elm.attachEvent) {
|
135
|
+
var r = elm.attachEvent('on' + evType, fn);
|
136
|
+
return r;
|
137
|
+
} else {
|
138
|
+
elm['on' + evType] = fn;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
function insertIndices() {
|
143
|
+
pages = ["class", "file", "method"]
|
144
|
+
for (x in pages) {
|
145
|
+
$(pages[x]).innerHTML += ajaxGet('fr_' + pages[x] + '_index.html').replace(/(href=")/g, '$1' + href_base);
|
146
|
+
}
|
147
|
+
/* mouseoverify method links */
|
148
|
+
links = $('method').getElementsByTagName('a');
|
149
|
+
for (var x = 0; x < links.length; x++) {
|
150
|
+
if (m = links[x].innerHTML.match(/(.*)\s\((.*)\)/)) {
|
151
|
+
links[x].innerHTML = m[1] + '<br>';
|
152
|
+
links[x].title = m[2];
|
153
|
+
}
|
154
|
+
}
|
155
|
+
/* this is stupid */
|
156
|
+
$('class').style.display = "block";
|
157
|
+
$('file').style.display = "block";
|
158
|
+
|
159
|
+
/* has to be here because IE7 does not guarantee the onLoad callback order */
|
160
|
+
abbreviateIndicesInner(["class", "file"], 25, "a");
|
161
|
+
/* same, linkTitle() depends on the class link list */
|
162
|
+
linkTitle();
|
163
|
+
}
|
164
|
+
|
165
|
+
function abbreviateIndices() {
|
166
|
+
var ids = ["defined_in", "child_of", "includes", "requires", "method", "methods"];
|
167
|
+
abbreviateIndicesInner(ids, 25, 'a');
|
168
|
+
abbreviateIndicesInner(ids, 25, 'span');
|
169
|
+
}
|
170
|
+
|
171
|
+
function abbreviateIndicesInner(indices, amount, tag) {
|
172
|
+
for (var x = 0; x < indices.length; x++) {
|
173
|
+
var the_index = $(indices[x]);
|
174
|
+
if (the_index) {
|
175
|
+
links = the_index.getElementsByTagName(tag);
|
176
|
+
for (var y = 0; y < links.length; y++) {
|
177
|
+
var link = links[y];
|
178
|
+
if (link.getElementsByTagName('span').length == 0 && link.getElementsByTagName('a').length == 0) {
|
179
|
+
// avoid nesting
|
180
|
+
link.innerHTML = link.innerHTML.replace(/<br>|\n/gi, '');
|
181
|
+
link.title = link.innerHTML;
|
182
|
+
link.innerHTML = abbreviate(link.innerHTML, amount) + '<br>';
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
function linkTitle() {
|
190
|
+
|
191
|
+
/* grab the correct title element from the index */
|
192
|
+
var index_page = ajaxGet('index.html');
|
193
|
+
title_text = index_page.match(/<title>(.*)<\/title>/m)[1];
|
194
|
+
document.title = title_text + " - " + document.title;
|
195
|
+
var p = $('header').getElementsByTagName('p')[0]
|
196
|
+
if (p.innerHTML.match(/^\s*$/)) {
|
197
|
+
p.innerHTML = title_text;
|
198
|
+
} else {
|
199
|
+
p.innerHTML = title_text + ": " + p.innerHTML;
|
200
|
+
}
|
201
|
+
|
202
|
+
/* set the link properly */
|
203
|
+
title_link = index_page.match(/<a\s+href="(.*?)"/)[1];
|
204
|
+
var element = $('title');
|
205
|
+
var item_type = "";
|
206
|
+
var item_name = "";
|
207
|
+
if (m = element.innerHTML.match(/(Class:|Module:|File:)\s*(.*)/)) {
|
208
|
+
item_type = m[1];
|
209
|
+
item_name = m[2];
|
210
|
+
} else {
|
211
|
+
item_name = element.innerHTML;
|
212
|
+
}
|
213
|
+
element.innerHTML = '<a href="' + href_base + title_link + '">' + item_type + " " + abbreviate(item_name, 45) + '</a>';
|
214
|
+
element.getElementsByTagName('a')[0].title = item_name
|
215
|
+
|
216
|
+
/* breadcrumb navigation */
|
217
|
+
items = item_name.split("::");
|
218
|
+
items_new = item_name.split("::");
|
219
|
+
file_links = $('class').getElementsByTagName('a');
|
220
|
+
for (var x = 0; x < items.length - 1; x++ ){
|
221
|
+
var item = items[x];
|
222
|
+
link = ("/classes/" + items.slice(0,x).join("/") + "/" + item + ".html").replace('//', '/');
|
223
|
+
regex = new RegExp(RegExp.escape(link) + '$');
|
224
|
+
for (var y = 0; y < file_links.length; y++) {
|
225
|
+
if (file_links[y].href.match(regex)) {
|
226
|
+
items_new[x] = '<a href="' + href_base + link + '">' + item + '</a>';
|
227
|
+
break;
|
228
|
+
}
|
229
|
+
}
|
230
|
+
}
|
231
|
+
$('item_name').innerHTML = item_type + ' ' + items_new.join(" :: ");
|
232
|
+
}
|
233
|
+
|
234
|
+
function abbreviate(s, size) {
|
235
|
+
while (s.length > size) {
|
236
|
+
var old_s = s;
|
237
|
+
s = s.replace(/\s|\n/mg, '');
|
238
|
+
s = s.replace(/([A-Z])[a-z]+/m, '$1');
|
239
|
+
if (!s || old_s == s) {
|
240
|
+
return "..." + s.substring(s.length - size, s.length);
|
241
|
+
}
|
242
|
+
}
|
243
|
+
return s;
|
244
|
+
}
|
245
|
+
|
246
|
+
function disableSubmit(event) {
|
247
|
+
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
|
248
|
+
if (keyCode == 13) {
|
249
|
+
return false;
|
250
|
+
} else {
|
251
|
+
return true;
|
252
|
+
}
|
253
|
+
}
|
254
|
+
|
255
|
+
function filterList(id, s, event) {
|
256
|
+
|
257
|
+
/* some weak escaping */
|
258
|
+
s = s.replace(/[^\w\d\.\_\-\/\:\=\[\]\?\!]/g, '');
|
259
|
+
s = RegExp.escape(s);
|
260
|
+
|
261
|
+
var show_all = false;
|
262
|
+
if (s.match(/^\s*$/)) {
|
263
|
+
show_all = true;
|
264
|
+
}
|
265
|
+
|
266
|
+
links = $(id).getElementsByTagName('a')
|
267
|
+
regex = new RegExp(s, 'i');
|
268
|
+
|
269
|
+
for (var x = 0; x < links.length; x++) {
|
270
|
+
var link = links[x];
|
271
|
+
if (show_all) {
|
272
|
+
link.style.display = 'inline';
|
273
|
+
} else {
|
274
|
+
if (link.innerHTML.match(regex)) {
|
275
|
+
link.style.display = 'inline';
|
276
|
+
} else {
|
277
|
+
link.style.display = 'none';
|
278
|
+
}
|
279
|
+
}
|
280
|
+
}
|
281
|
+
return true;
|
282
|
+
}
|
283
|
+
|
284
|
+
RegExp.escape = function(text) {
|
285
|
+
if (!arguments.callee.sRE) {
|
286
|
+
var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'];
|
287
|
+
arguments.callee.sRE = new RegExp(
|
288
|
+
'(\\' + specials.join('|\\') + ')', 'g'
|
289
|
+
);
|
290
|
+
}
|
291
|
+
return text.replace(arguments.callee.sRE, '\\$1');
|
292
|
+
}
|
293
|
+
|
294
|
+
function hacks() {
|
295
|
+
// show the spacer if necessary,
|
296
|
+
divs = document.getElementsByTagName('div');
|
297
|
+
for(var x = 0; x < divs.length; x++) {
|
298
|
+
if (divs[x].className && divs[x].className.match(/top/)) {
|
299
|
+
document.getElementById('spacer').style.display = 'block';
|
300
|
+
}
|
301
|
+
}
|
302
|
+
// remove extra colons from tables
|
303
|
+
tds = document.getElementsByTagName('td');
|
304
|
+
for(var x = 0; x < tds.length; x++) {
|
305
|
+
str = tds[x].innerHTML
|
306
|
+
if (str.charAt(str.length - 1) == ":") {
|
307
|
+
tds[x].innerHTML = str.slice(0, str.length - 1)
|
308
|
+
}
|
309
|
+
}
|
310
|
+
}
|
311
|
+
|
312
|
+
addEvent(window, 'load', insertIndices, false);
|
313
|
+
addEvent(window, 'load', abbreviateIndices, false);
|
314
|
+
addEvent(window, 'load', stripe, false);
|
315
|
+
addEvent(window, 'load', highlightSymbols, false);
|
316
|
+
addEvent(window, 'load', hacks, false);
|
317
|
+
</script></head><body><div id="container"><div class="curve" id="preheader_curve_0"></div><div class="curve" id="preheader_curve_1"></div><div class="curve" id="preheader_curve_2"></div><div class="curve" id="preheader_curve_3"></div><div class="curve" id="preheader_curve_4"></div><div class="curve" id="preheader_curve_5"></div><div id="header"><p>
|
318
|
+
</p><span><h1 id="title">
|
319
|
+
Class: Locale::Tag::Simple
|
320
|
+
</h1></span></div><div class="clear"></div><div id="left">
|
321
|
+
<div class="navigation darker top" id="child_of"><h3>Child of</h3><span>
|
322
|
+
|
323
|
+
Object
|
324
|
+
</span></div>
|
325
|
+
|
326
|
+
<div class="navigation darker top" id="defined_in"><h3>Defined in</h3>
|
327
|
+
|
328
|
+
<a href="../../../files/lib/locale/tag/simple_rb.html">lib/locale/tag/simple.rb</a>
|
329
|
+
|
330
|
+
</div>
|
331
|
+
|
332
|
+
<div class="navigation top" id="includes"><h3>Includes</h3>
|
333
|
+
|
334
|
+
|
335
|
+
<a href='../Util/Memoizable.html'>
|
336
|
+
Util::Memoizable<br/>
|
337
|
+
</a>
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
<a href='../Util/Memoizable.html'>
|
343
|
+
Util::Memoizable<br/>
|
344
|
+
</a>
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
<a href='../Util/Memoizable.html'>
|
350
|
+
Util::Memoizable<br/>
|
351
|
+
</a>
|
352
|
+
|
353
|
+
|
354
|
+
</div>
|
355
|
+
|
356
|
+
|
357
|
+
<div class="navigation top" id="methods"><h3>Methods</h3>
|
358
|
+
|
359
|
+
|
360
|
+
<a href='#M000044'>
|
361
|
+
<=><br/>
|
362
|
+
</a>
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
<a href='#M000048'>
|
368
|
+
candidates<br/>
|
369
|
+
</a>
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
<a href='#M000045'>
|
375
|
+
country<br/>
|
376
|
+
</a>
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
<a href='#M000046'>
|
382
|
+
language=<br/>
|
383
|
+
</a>
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
<a href='#M000042'>
|
389
|
+
new<br/>
|
390
|
+
</a>
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
<a href='#M000041'>
|
396
|
+
parse<br/>
|
397
|
+
</a>
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
<a href='#M000047'>
|
403
|
+
region=<br/>
|
404
|
+
</a>
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
<a href='#M000043'>
|
410
|
+
to_s<br/>
|
411
|
+
</a>
|
412
|
+
|
413
|
+
|
414
|
+
</div>
|
415
|
+
<div id="spacer"></div><div class="navigation darker index" id="class_wrapper"><div class="list_header"><h3>All classes</h3></div><div class="list_header_link"><a href="#" onclick="toggle('class'); toggleText('class_link'); return false;" id="class_link">Hide...</a></div><div class="clear"></div><div id="class"><form><label for="filter_class">Filter: </label><input type="text" onKeyUp="return filterList('class', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_class"></input></form></div></div><div class="navigation darker index" id="file_wrapper"><div class="list_header"><h3>All files</h3></div><div class="list_header_link"><a href="#" onclick="toggle('file'); toggleText('file_link'); return false;" id="file_link">Hide...</a></div><div class="clear"></div><div id="file"><form><label for="filter_file">Filter: </label><input type="text" onKeyUp="return filterList('file', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_file"></input></form></div></div><div class="navigation darker index" id="method_wrapper"><div class="list_header"><h3>All methods</h3></div><div class="list_header_link"><a href="#" onclick="toggle('method'); toggleText('method_link'); return false;" id="method_link">Show...</a></div><div class="clear"></div><div id="method"><form><label for="filter_method">Filter: </label><input type="text" onKeyUp="return filterList('method', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_method"></input></form></div></div></div><div id="content">
|
416
|
+
<h1 id="item_name">Class: Locale::Tag::Simple</h1>
|
417
|
+
|
418
|
+
<div id="description"><p>
|
419
|
+
Abstract language tag class. This class has <language>,
|
420
|
+
<region> which all of language tag specifications have.
|
421
|
+
</p>
|
422
|
+
<ul>
|
423
|
+
<li>ja (language: ISO 639 (2 or 3 alpha))
|
424
|
+
|
425
|
+
</li>
|
426
|
+
<li>ja_JP (<a href="Simple.html#M000045">country</a>: RFC4646 (ISO3166/UN M.49)
|
427
|
+
(2 alpha or 3 digit)
|
428
|
+
|
429
|
+
</li>
|
430
|
+
<li>ja-JP
|
431
|
+
|
432
|
+
</li>
|
433
|
+
<li>ja-392
|
434
|
+
|
435
|
+
</li>
|
436
|
+
</ul>
|
437
|
+
</div>
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
<p></p>
|
443
|
+
|
444
|
+
|
445
|
+
<h1>Constants</h1><p><table><tr><th>Name</th><th>Value</th></tr>
|
446
|
+
<tr>
|
447
|
+
<td class="highlight">ALPHA</td>
|
448
|
+
|
449
|
+
<td class="normal">'[a-z]'</td>
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
</tr>
|
454
|
+
<tr>
|
455
|
+
<td class="highlight">DIGIT</td>
|
456
|
+
|
457
|
+
<td class="normal">'[0-9]'</td>
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
</tr>
|
462
|
+
<tr>
|
463
|
+
<td class="highlight">ALPHANUM</td>
|
464
|
+
|
465
|
+
<td class="normal">"[a-zA-Z0-9]"</td>
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
</tr>
|
470
|
+
<tr>
|
471
|
+
<td class="highlight">LANGUAGE</td>
|
472
|
+
|
473
|
+
<td class="normal">"(#{ALPHA}{2,3})"</td>
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
</tr>
|
478
|
+
<tr>
|
479
|
+
<td class="highlight">REGION</td>
|
480
|
+
|
481
|
+
<td class="normal">"(#{ALPHA}{2}|#{DIGIT}{3})"</td>
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
</tr>
|
486
|
+
<tr>
|
487
|
+
<td class="highlight">TAG_RE</td>
|
488
|
+
|
489
|
+
<td class="normal">/\A#{LANGUAGE}(?:[_-]#{REGION})?\Z/i</td>
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
</tr>
|
494
|
+
</table></p>
|
495
|
+
|
496
|
+
|
497
|
+
<h1>Attributes</h1><p><table><tr><th>Name</th><th>Read/write?</th></tr>
|
498
|
+
<tr>
|
499
|
+
<td class="highlight">language</td>
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
<td class="normal">R</td>
|
505
|
+
</tr>
|
506
|
+
<tr>
|
507
|
+
<td class="highlight">region</td>
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
<td class="normal">R</td>
|
513
|
+
</tr>
|
514
|
+
<tr>
|
515
|
+
<td class="highlight">tag</td>
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
<td class="normal">RW</td>
|
521
|
+
</tr>
|
522
|
+
</table></p>
|
523
|
+
|
524
|
+
|
525
|
+
<h1>Public Class Methods</h1>
|
526
|
+
|
527
|
+
|
528
|
+
<a class="small" name="M000042"><br/></a>
|
529
|
+
<div class="method_block"><h3>
|
530
|
+
<a href='#M000042'>
|
531
|
+
|
532
|
+
|
533
|
+
new
|
534
|
+
|
535
|
+
(language, region = nil)
|
536
|
+
|
537
|
+
</a>
|
538
|
+
</h3>
|
539
|
+
<p>
|
540
|
+
Create a <a href="Simple.html">Locale::Tag::Simple</a>
|
541
|
+
</p>
|
542
|
+
|
543
|
+
<p class="source_link" id="M000042-show-link"><a href="#" onclick="toggle('M000042-source'); toggleText('M000042-link'); return false;" id="M000042-link">Show source...</a></p><div class="source" id="M000042-source"><pre> <span class="ruby-comment cmt"># File lib/locale/tag/simple.rb, line 76</span>
|
544
|
+
76: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">language</span>, <span class="ruby-identifier">region</span> = <span class="ruby-keyword kw">nil</span>)
|
545
|
+
77: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"language can't be nil."</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">language</span>
|
546
|
+
78: <span class="ruby-ivar">@language</span>, <span class="ruby-ivar">@region</span> = <span class="ruby-identifier">language</span>, <span class="ruby-identifier">region</span>
|
547
|
+
79: <span class="ruby-ivar">@language</span> = <span class="ruby-ivar">@language</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@language</span>
|
548
|
+
80: <span class="ruby-ivar">@region</span> = <span class="ruby-ivar">@region</span>.<span class="ruby-identifier">upcase</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@region</span>
|
549
|
+
81: <span class="ruby-keyword kw">end</span></pre></div>
|
550
|
+
</div>
|
551
|
+
|
552
|
+
<a class="small" name="M000041"><br/></a>
|
553
|
+
<div class="method_block"><h3>
|
554
|
+
<a href='#M000041'>
|
555
|
+
|
556
|
+
|
557
|
+
parse
|
558
|
+
|
559
|
+
(tag)
|
560
|
+
|
561
|
+
</a>
|
562
|
+
</h3>
|
563
|
+
<p>
|
564
|
+
Parse the language tag and return the <a href="Simple.html#M000042">new</a>
|
565
|
+
<a href="Simple.html">Locale::Tag::Simple</a>.
|
566
|
+
</p>
|
567
|
+
|
568
|
+
<p class="source_link" id="M000041-show-link"><a href="#" onclick="toggle('M000041-source'); toggleText('M000041-link'); return false;" id="M000041-link">Show source...</a></p><div class="source" id="M000041-source"><pre> <span class="ruby-comment cmt"># File lib/locale/tag/simple.rb, line 63</span>
|
569
|
+
63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">tag</span>)
|
570
|
+
64: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tag</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">TAG_RE</span>
|
571
|
+
65: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">$1</span>, <span class="ruby-identifier">$2</span>)
|
572
|
+
66: <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">tag</span> = <span class="ruby-identifier">tag</span>
|
573
|
+
67: <span class="ruby-identifier">ret</span>
|
574
|
+
68: <span class="ruby-keyword kw">else</span>
|
575
|
+
69: <span class="ruby-keyword kw">nil</span>
|
576
|
+
70: <span class="ruby-keyword kw">end</span>
|
577
|
+
71: <span class="ruby-keyword kw">end</span></pre></div>
|
578
|
+
</div>
|
579
|
+
|
580
|
+
|
581
|
+
<h1>Public Instance Methods</h1>
|
582
|
+
|
583
|
+
|
584
|
+
<a class="small" name="M000044"><br/></a>
|
585
|
+
<div class="method_block"><h3>
|
586
|
+
<a href='#M000044'>
|
587
|
+
|
588
|
+
|
589
|
+
<=>
|
590
|
+
|
591
|
+
(other)
|
592
|
+
|
593
|
+
</a>
|
594
|
+
</h3>
|
595
|
+
|
596
|
+
<p class="source_link" id="M000044-show-link"><a href="#" onclick="toggle('M000044-source'); toggleText('M000044-link'); return false;" id="M000044-link">Show source...</a></p><div class="source" id="M000044-source"><pre> <span class="ruby-comment cmt"># File lib/locale/tag/simple.rb, line 95</span>
|
597
|
+
95: <span class="ruby-keyword kw">def</span> <span class="ruby-operator"><=></span>(<span class="ruby-identifier">other</span>)
|
598
|
+
96: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">to_s</span>
|
599
|
+
97: <span class="ruby-keyword kw">end</span></pre></div>
|
600
|
+
</div>
|
601
|
+
|
602
|
+
<a class="small" name="M000048"><br/></a>
|
603
|
+
<div class="method_block"><h3>
|
604
|
+
<a href='#M000048'>
|
605
|
+
|
606
|
+
|
607
|
+
candidates
|
608
|
+
|
609
|
+
()
|
610
|
+
|
611
|
+
</a>
|
612
|
+
</h3>
|
613
|
+
<p>
|
614
|
+
Returns an Array of tag-<a href="Simple.html#M000048">candidates</a> order
|
615
|
+
by priority. Use <a href="../../Locale.html#M000012">Locale.candidates</a>
|
616
|
+
instead of this method.
|
617
|
+
</p>
|
618
|
+
|
619
|
+
<p class="source_link" id="M000048-show-link"><a href="#" onclick="toggle('M000048-source'); toggleText('M000048-link'); return false;" id="M000048-link">Show source...</a></p><div class="source" id="M000048-source"><pre> <span class="ruby-comment cmt"># File lib/locale/tag/simple.rb, line 139</span>
|
620
|
+
139: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">candidates</span>
|
621
|
+
140: [<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">language</span>, <span class="ruby-identifier">region</span>), <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">language</span>)]
|
622
|
+
141: <span class="ruby-keyword kw">end</span></pre></div>
|
623
|
+
</div>
|
624
|
+
|
625
|
+
<a class="small" name="M000045"><br/></a>
|
626
|
+
<div class="method_block"><h3>
|
627
|
+
<a href='#M000045'>
|
628
|
+
|
629
|
+
|
630
|
+
country
|
631
|
+
|
632
|
+
()
|
633
|
+
|
634
|
+
</a>
|
635
|
+
</h3>
|
636
|
+
<p>
|
637
|
+
For backward compatibility.
|
638
|
+
</p>
|
639
|
+
|
640
|
+
<p class="source_link" id="M000045-show-link"><a href="#" onclick="toggle('M000045-source'); toggleText('M000045-link'); return false;" id="M000045-link">Show source...</a></p><div class="source" id="M000045-source"><pre> <span class="ruby-comment cmt"># File lib/locale/tag/simple.rb, line 119</span>
|
641
|
+
119: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">country</span>; <span class="ruby-identifier">region</span> <span class="ruby-keyword kw">end</span></pre></div>
|
642
|
+
</div>
|
643
|
+
|
644
|
+
<a class="small" name="M000046"><br/></a>
|
645
|
+
<div class="method_block"><h3>
|
646
|
+
<a href='#M000046'>
|
647
|
+
|
648
|
+
|
649
|
+
language=
|
650
|
+
|
651
|
+
(val)
|
652
|
+
|
653
|
+
</a>
|
654
|
+
</h3>
|
655
|
+
<p>
|
656
|
+
Set the language (with downcase)
|
657
|
+
</p>
|
658
|
+
|
659
|
+
<p class="source_link" id="M000046-show-link"><a href="#" onclick="toggle('M000046-source'); toggleText('M000046-link'); return false;" id="M000046-link">Show source...</a></p><div class="source" id="M000046-source"><pre> <span class="ruby-comment cmt"># File lib/locale/tag/simple.rb, line 122</span>
|
660
|
+
122: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">language=</span>(<span class="ruby-identifier">val</span>)
|
661
|
+
123: <span class="ruby-identifier">clear</span>
|
662
|
+
124: <span class="ruby-ivar">@language</span> = <span class="ruby-identifier">val</span>
|
663
|
+
125: <span class="ruby-ivar">@language</span> = <span class="ruby-ivar">@language</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@language</span>
|
664
|
+
126: <span class="ruby-ivar">@language</span>
|
665
|
+
127: <span class="ruby-keyword kw">end</span></pre></div>
|
666
|
+
</div>
|
667
|
+
|
668
|
+
<a class="small" name="M000047"><br/></a>
|
669
|
+
<div class="method_block"><h3>
|
670
|
+
<a href='#M000047'>
|
671
|
+
|
672
|
+
|
673
|
+
region=
|
674
|
+
|
675
|
+
(val)
|
676
|
+
|
677
|
+
</a>
|
678
|
+
</h3>
|
679
|
+
<p>
|
680
|
+
Set the region (with upcase)
|
681
|
+
</p>
|
682
|
+
|
683
|
+
<p class="source_link" id="M000047-show-link"><a href="#" onclick="toggle('M000047-source'); toggleText('M000047-link'); return false;" id="M000047-link">Show source...</a></p><div class="source" id="M000047-source"><pre> <span class="ruby-comment cmt"># File lib/locale/tag/simple.rb, line 130</span>
|
684
|
+
130: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">region=</span>(<span class="ruby-identifier">val</span>)
|
685
|
+
131: <span class="ruby-identifier">clear</span>
|
686
|
+
132: <span class="ruby-ivar">@region</span> = <span class="ruby-identifier">val</span>
|
687
|
+
133: <span class="ruby-ivar">@region</span> = <span class="ruby-ivar">@region</span>.<span class="ruby-identifier">upcase</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@region</span>
|
688
|
+
134: <span class="ruby-ivar">@region</span>
|
689
|
+
135: <span class="ruby-keyword kw">end</span></pre></div>
|
690
|
+
</div>
|
691
|
+
|
692
|
+
<a class="small" name="M000043"><br/></a>
|
693
|
+
<div class="method_block"><h3>
|
694
|
+
<a href='#M000043'>
|
695
|
+
|
696
|
+
|
697
|
+
to_s
|
698
|
+
|
699
|
+
()
|
700
|
+
|
701
|
+
</a>
|
702
|
+
</h3>
|
703
|
+
<p>
|
704
|
+
Returns the language tag as the String.
|
705
|
+
</p>
|
706
|
+
<pre>
|
707
|
+
<language>_<REGION>
|
708
|
+
(e.g.) "ja_JP"
|
709
|
+
</pre>
|
710
|
+
|
711
|
+
<p class="source_link" id="M000043-show-link"><a href="#" onclick="toggle('M000043-source'); toggleText('M000043-link'); return false;" id="M000043-link">Show source...</a></p><div class="source" id="M000043-source"><pre> <span class="ruby-comment cmt"># File lib/locale/tag/simple.rb, line 86</span>
|
712
|
+
86: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
713
|
+
87: <span class="ruby-identifier">to_string</span>
|
714
|
+
88: <span class="ruby-keyword kw">end</span></pre></div>
|
715
|
+
</div>
|
716
|
+
|
717
|
+
|
718
|
+
|
719
|
+
|
720
|
+
|
721
|
+
</div><div class="clear" id="footer">Generated on May 9, 2009 / Allison 2 © 2007 <a href="http://cloudbur.st">Cloudburst, LLC</a></div></div></body></html>
|