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
data/ChangeLog
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
#$LOAD_PATH.unshift "../lib"
|
2
|
+
|
3
|
+
require 'benchmark'
|
4
|
+
require 'locale'
|
5
|
+
def memory
|
6
|
+
GC.start
|
7
|
+
pid = Process.pid
|
8
|
+
map = `pmap -d #{pid}`
|
9
|
+
map.split("\n").last.strip.squeeze(' ').split(' ')[3].to_i
|
10
|
+
end
|
11
|
+
|
12
|
+
size = memory
|
13
|
+
|
14
|
+
Benchmark.bm(18){|x|
|
15
|
+
x.report("Locale.default="){ 50000.times{|i|
|
16
|
+
Locale.default = "ja-JP"
|
17
|
+
} }
|
18
|
+
x.report("Locale.default=(parse)"){ 50000.times{|i|
|
19
|
+
Locale.default = Locale::Tag::Posix.parse("ja-JP.eucJP")
|
20
|
+
} }
|
21
|
+
x.report("Locale.default=(new)"){ 50000.times{|i|
|
22
|
+
Locale.default = Locale::Tag::Posix.new("ja", "JP", "eucJP")
|
23
|
+
} }
|
24
|
+
Locale.default = nil
|
25
|
+
x.report("Locale.candidates"){ 50000.times{|i|
|
26
|
+
Locale.candidates
|
27
|
+
} }
|
28
|
+
Locale.default = nil
|
29
|
+
x.report("Locale.current"){ 50000.times{|i|
|
30
|
+
Locale.current
|
31
|
+
} }
|
32
|
+
}
|
33
|
+
|
34
|
+
p "memory: #{memory - size}"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
user system total real
|
2
|
+
Locale.default= 0.960000 0.010000 0.970000 ( 0.975299)
|
3
|
+
Locale.default=(parse) 0.620000 0.000000 0.620000 ( 0.632838)
|
4
|
+
Locale.default=(new) 0.840000 0.000000 0.840000 ( 0.839074)
|
5
|
+
Locale.candidates 0.650000 0.000000 0.650000 ( 0.659982)
|
6
|
+
Locale.current 0.120000 0.000000 0.120000 ( 0.112794)
|
7
|
+
"memory: 5856"
|
@@ -0,0 +1,1244 @@
|
|
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>Module: Locale</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
|
+
Module: Locale
|
320
|
+
</h1></span></div><div class="clear"></div><div id="left">
|
321
|
+
|
322
|
+
<div class="navigation darker top" id="defined_in"><h3>Defined in</h3>
|
323
|
+
|
324
|
+
<a href="../files/lib/locale/driver/env_rb.html">lib/locale/driver/env.rb</a>
|
325
|
+
|
326
|
+
|
327
|
+
<a href="../files/lib/locale/driver/jruby_rb.html">lib/locale/driver/jruby.rb</a>
|
328
|
+
|
329
|
+
|
330
|
+
<a href="../files/lib/locale/driver/posix_rb.html">lib/locale/driver/posix.rb</a>
|
331
|
+
|
332
|
+
|
333
|
+
<a href="../files/lib/locale/driver/win32_table_rb.html">lib/locale/driver/win32_table.rb</a>
|
334
|
+
|
335
|
+
|
336
|
+
<a href="../files/lib/locale/driver/win32_rb.html">lib/locale/driver/win32.rb</a>
|
337
|
+
|
338
|
+
|
339
|
+
<a href="../files/lib/locale/driver/cgi_rb.html">lib/locale/driver/cgi.rb</a>
|
340
|
+
|
341
|
+
|
342
|
+
<a href="../files/lib/locale/version_rb.html">lib/locale/version.rb</a>
|
343
|
+
|
344
|
+
|
345
|
+
<a href="../files/lib/locale/tag_rb.html">lib/locale/tag.rb</a>
|
346
|
+
|
347
|
+
|
348
|
+
<a href="../files/lib/locale/tag/cldr_rb.html">lib/locale/tag/cldr.rb</a>
|
349
|
+
|
350
|
+
|
351
|
+
<a href="../files/lib/locale/tag/common_rb.html">lib/locale/tag/common.rb</a>
|
352
|
+
|
353
|
+
|
354
|
+
<a href="../files/lib/locale/tag/rfc_rb.html">lib/locale/tag/rfc.rb</a>
|
355
|
+
|
356
|
+
|
357
|
+
<a href="../files/lib/locale/tag/irregular_rb.html">lib/locale/tag/irregular.rb</a>
|
358
|
+
|
359
|
+
|
360
|
+
<a href="../files/lib/locale/tag/posix_rb.html">lib/locale/tag/posix.rb</a>
|
361
|
+
|
362
|
+
|
363
|
+
<a href="../files/lib/locale/tag/simple_rb.html">lib/locale/tag/simple.rb</a>
|
364
|
+
|
365
|
+
|
366
|
+
<a href="../files/lib/locale/info/language_rb.html">lib/locale/info/language.rb</a>
|
367
|
+
|
368
|
+
|
369
|
+
<a href="../files/lib/locale/info/region_rb.html">lib/locale/info/region.rb</a>
|
370
|
+
|
371
|
+
|
372
|
+
<a href="../files/lib/locale/taglist_rb.html">lib/locale/taglist.rb</a>
|
373
|
+
|
374
|
+
|
375
|
+
<a href="../files/lib/locale/util/memoizable_rb.html">lib/locale/util/memoizable.rb</a>
|
376
|
+
|
377
|
+
|
378
|
+
<a href="../files/lib/locale_rb.html">lib/locale.rb</a>
|
379
|
+
|
380
|
+
</div>
|
381
|
+
|
382
|
+
<div class="navigation top" id="includes"><h3>Includes</h3>
|
383
|
+
|
384
|
+
|
385
|
+
<a href='Locale/Util/Memoizable.html'>
|
386
|
+
Locale::Util::Memoizable<br/>
|
387
|
+
</a>
|
388
|
+
|
389
|
+
|
390
|
+
</div>
|
391
|
+
|
392
|
+
|
393
|
+
<div class="navigation top" id="methods"><h3>Methods</h3>
|
394
|
+
|
395
|
+
|
396
|
+
<a href='#M000017'>
|
397
|
+
app_language_tags<br/>
|
398
|
+
</a>
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
<a href='#M000012'>
|
404
|
+
candidates<br/>
|
405
|
+
</a>
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
<a href='#M000003'>
|
411
|
+
cgi=<br/>
|
412
|
+
</a>
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
<a href='#M000013'>
|
418
|
+
charset<br/>
|
419
|
+
</a>
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
<a href='#M000014'>
|
425
|
+
clear<br/>
|
426
|
+
</a>
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
<a href='#M000015'>
|
432
|
+
clear_all<br/>
|
433
|
+
</a>
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
<a href='#M000011'>
|
439
|
+
current<br/>
|
440
|
+
</a>
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
<a href='#M000010'>
|
446
|
+
current=<br/>
|
447
|
+
</a>
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
<a href='#M000008'>
|
453
|
+
default<br/>
|
454
|
+
</a>
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
<a href='#M000007'>
|
460
|
+
default=<br/>
|
461
|
+
</a>
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
<a href='#M000005'>
|
467
|
+
driver_module<br/>
|
468
|
+
</a>
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
<a href='#M000004'>
|
474
|
+
init<br/>
|
475
|
+
</a>
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
<a href='#M000016'>
|
481
|
+
set_app_language_tags<br/>
|
482
|
+
</a>
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
<a href='#M000002'>
|
488
|
+
set_cgi<br/>
|
489
|
+
</a>
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
<a href='#M000009'>
|
495
|
+
set_current<br/>
|
496
|
+
</a>
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
<a href='#M000006'>
|
502
|
+
set_default<br/>
|
503
|
+
</a>
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
<a href='#M000001'>
|
509
|
+
set_request<br/>
|
510
|
+
</a>
|
511
|
+
|
512
|
+
|
513
|
+
</div>
|
514
|
+
<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">
|
515
|
+
<h1 id="item_name">Module: Locale</h1>
|
516
|
+
|
517
|
+
<div id="description"><p>
|
518
|
+
<a href="Locale.html">Locale</a> module manages the locale informations of
|
519
|
+
the application. These functions are the most important APIs in this
|
520
|
+
library. Almost of all i18n/l10n programs use this APIs only.
|
521
|
+
</p>
|
522
|
+
</div>
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
<p></p>
|
528
|
+
|
529
|
+
<h1>Child modules and classes</h1><p>Module <a href="Locale/Driver.html" class="link">Locale::Driver</a><br />
|
530
|
+
Module <a href="Locale/Info.html" class="link">Locale::Info</a><br />
|
531
|
+
Module <a href="Locale/Tag.html" class="link">Locale::Tag</a><br />
|
532
|
+
Module <a href="Locale/Util.html" class="link">Locale::Util</a><br />
|
533
|
+
Class <a href="Locale/TagList.html" class="link">Locale::TagList</a><br />
|
534
|
+
</p>
|
535
|
+
|
536
|
+
<h1>Constants</h1><p><table><tr><th>Name</th><th>Value</th></tr>
|
537
|
+
<tr>
|
538
|
+
<td class="highlight">VERSION</td>
|
539
|
+
|
540
|
+
<td class="normal">"2.0.3"</td>
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
</tr>
|
545
|
+
<tr>
|
546
|
+
<td class="highlight">ROOT</td>
|
547
|
+
|
548
|
+
<td class="normal">File.dirname(__FILE__)</td>
|
549
|
+
|
550
|
+
|
551
|
+
|
552
|
+
</tr>
|
553
|
+
</table></p>
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
<h1>Public Instance Methods</h1>
|
559
|
+
|
560
|
+
|
561
|
+
<a class="small" name="M000017"><br/></a>
|
562
|
+
<div class="method_block"><h3>
|
563
|
+
<a href='#M000017'>
|
564
|
+
|
565
|
+
|
566
|
+
app_language_tags
|
567
|
+
|
568
|
+
()
|
569
|
+
|
570
|
+
</a>
|
571
|
+
</h3>
|
572
|
+
<p>
|
573
|
+
Returns the <a href="Locale.html#M000017">app_language_tags</a>. Default is
|
574
|
+
nil. See <a href="Locale.html#M000016">set_app_language_tags</a> for more
|
575
|
+
details.
|
576
|
+
</p>
|
577
|
+
|
578
|
+
<p class="source_link" id="M000017-show-link"><a href="#" onclick="toggle('M000017-source'); toggleText('M000017-link'); return false;" id="M000017-link">Show source...</a></p><div class="source" id="M000017-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 325</span>
|
579
|
+
325: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">app_language_tags</span>
|
580
|
+
326: <span class="ruby-ivar">@@app_language_tags</span>
|
581
|
+
327: <span class="ruby-keyword kw">end</span></pre></div>
|
582
|
+
</div>
|
583
|
+
|
584
|
+
<a class="small" name="M000012"><br/></a>
|
585
|
+
<div class="method_block"><h3>
|
586
|
+
<a href='#M000012'>
|
587
|
+
|
588
|
+
|
589
|
+
candidates
|
590
|
+
|
591
|
+
(options = {})
|
592
|
+
|
593
|
+
</a>
|
594
|
+
</h3>
|
595
|
+
<p>
|
596
|
+
Returns the language tags which are variations of the <a
|
597
|
+
href="Locale.html#M000011">current</a> locales order by priority.
|
598
|
+
</p>
|
599
|
+
<p>
|
600
|
+
For example, if the <a href="Locale.html#M000011">current</a> locales are
|
601
|
+
["fr", "ja_JP", "en_US",
|
602
|
+
"en-Latn-GB-VARIANT"], then returns ["fr",
|
603
|
+
"ja_JP", "en_US", "en-Latn-GB-VARIANT",
|
604
|
+
"en_Latn_GB", "en_GB", "ja", "en"].
|
605
|
+
"en" is the <a href="Locale.html#M000008">default</a> locale(You
|
606
|
+
can change it using <a href="Locale.html#M000006">set_default</a>). The <a
|
607
|
+
href="Locale.html#M000008">default</a> locale is added at the end of the
|
608
|
+
list even if it isn‘t exist.
|
609
|
+
</p>
|
610
|
+
<p>
|
611
|
+
Usually, this method is used to find the locale data as the path(or a kind
|
612
|
+
of IDs).
|
613
|
+
</p>
|
614
|
+
<ul>
|
615
|
+
<li>options: options as a Hash or nil.
|
616
|
+
|
617
|
+
<ul>
|
618
|
+
<li>:supported_language_tags - An Array of the language tags order by the
|
619
|
+
priority. This option restricts the locales which are supported by the
|
620
|
+
library/application. Default is nil if you don‘t need to restrict the
|
621
|
+
locales.
|
622
|
+
|
623
|
+
<pre>
|
624
|
+
(e.g.1) ["fr_FR", "en_GB", "en_US", ...]
|
625
|
+
</pre>
|
626
|
+
</li>
|
627
|
+
<li>:type - The type of language tag. :common, :rfc, :cldr, :posix and :simple
|
628
|
+
are available. Default value is :common
|
629
|
+
|
630
|
+
</li>
|
631
|
+
</ul>
|
632
|
+
</li>
|
633
|
+
</ul>
|
634
|
+
|
635
|
+
<p class="source_link" id="M000012-show-link"><a href="#" onclick="toggle('M000012-source'); toggleText('M000012-link'); return false;" id="M000012-link">Show source...</a></p><div class="source" id="M000012-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 211</span>
|
636
|
+
211: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">candidates</span>(<span class="ruby-identifier">options</span> = {})
|
637
|
+
212: <span class="ruby-identifier">opts</span> = {<span class="ruby-identifier">:supported_language_tags</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:current</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">current</span>,
|
638
|
+
213: <span class="ruby-identifier">:type</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:common</span>}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
|
639
|
+
214:
|
640
|
+
215: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:candidates_caches</span>]
|
641
|
+
216: <span class="ruby-identifier">cache</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:candidates_caches</span>][<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">hash</span>]
|
642
|
+
217: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">cache</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cache</span>
|
643
|
+
218: <span class="ruby-keyword kw">else</span>
|
644
|
+
219: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:candidates_caches</span>] = {}
|
645
|
+
220: <span class="ruby-keyword kw">end</span>
|
646
|
+
221: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:candidates_caches</span>][<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">hash</span>] =
|
647
|
+
222: <span class="ruby-identifier">collect_candidates</span>(<span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:type</span>], <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:current</span>],
|
648
|
+
223: <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:supported_language_tags</span>])
|
649
|
+
224: <span class="ruby-keyword kw">end</span></pre></div>
|
650
|
+
</div>
|
651
|
+
|
652
|
+
<a class="small" name="M000003"><br/></a>
|
653
|
+
<div class="method_block"><h3>
|
654
|
+
<a href='#M000003'>
|
655
|
+
|
656
|
+
|
657
|
+
cgi=
|
658
|
+
|
659
|
+
(cgi)
|
660
|
+
|
661
|
+
</a>
|
662
|
+
</h3>
|
663
|
+
<p>
|
664
|
+
Sets a CGI object.This is the convenient function of <a
|
665
|
+
href="Locale.html#M000001">set_request</a>().
|
666
|
+
</p>
|
667
|
+
<p>
|
668
|
+
This method is appeared when <a
|
669
|
+
href="Locale.html#M000004">Locale.init</a>(:driver => :cgi) is called.
|
670
|
+
</p>
|
671
|
+
<ul>
|
672
|
+
<li>cgi: CGI object
|
673
|
+
|
674
|
+
</li>
|
675
|
+
<li>Returns: cgi
|
676
|
+
|
677
|
+
</li>
|
678
|
+
</ul>
|
679
|
+
|
680
|
+
<p class="source_link" id="M000003-show-link"><a href="#" onclick="toggle('M000003-source'); toggleText('M000003-link'); return false;" id="M000003-link">Show source...</a></p><div class="source" id="M000003-source"><pre> <span class="ruby-comment cmt"># File lib/locale/driver/cgi.rb, line 132</span>
|
681
|
+
132: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cgi=</span>(<span class="ruby-identifier">cgi</span>)
|
682
|
+
133: <span class="ruby-identifier">set_cgi</span>(<span class="ruby-identifier">cgi</span>)
|
683
|
+
134: <span class="ruby-identifier">cgi</span>
|
684
|
+
135: <span class="ruby-keyword kw">end</span></pre></div>
|
685
|
+
</div>
|
686
|
+
|
687
|
+
<a class="small" name="M000013"><br/></a>
|
688
|
+
<div class="method_block"><h3>
|
689
|
+
<a href='#M000013'>
|
690
|
+
|
691
|
+
|
692
|
+
charset
|
693
|
+
|
694
|
+
()
|
695
|
+
|
696
|
+
</a>
|
697
|
+
</h3>
|
698
|
+
<p>
|
699
|
+
Gets the <a href="Locale.html#M000011">current</a> <a
|
700
|
+
href="Locale.html#M000013">charset</a>.
|
701
|
+
</p>
|
702
|
+
<p>
|
703
|
+
This returns the <a href="Locale.html#M000011">current</a> user/system <a
|
704
|
+
href="Locale.html#M000013">charset</a>. This value is read only, so you
|
705
|
+
can‘t set it by yourself.
|
706
|
+
</p>
|
707
|
+
<ul>
|
708
|
+
<li>Returns: the <a href="Locale.html#M000011">current</a> <a
|
709
|
+
href="Locale.html#M000013">charset</a>.
|
710
|
+
|
711
|
+
</li>
|
712
|
+
</ul>
|
713
|
+
|
714
|
+
<p class="source_link" id="M000013-show-link"><a href="#" onclick="toggle('M000013-source'); toggleText('M000013-link'); return false;" id="M000013-link">Show source...</a></p><div class="source" id="M000013-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 270</span>
|
715
|
+
270: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">charset</span>
|
716
|
+
271: <span class="ruby-identifier">driver_module</span>.<span class="ruby-identifier">charset</span> <span class="ruby-operator">||</span> <span class="ruby-value str">"UTF-8"</span>
|
717
|
+
272: <span class="ruby-keyword kw">end</span></pre></div>
|
718
|
+
</div>
|
719
|
+
|
720
|
+
<a class="small" name="M000014"><br/></a>
|
721
|
+
<div class="method_block"><h3>
|
722
|
+
<a href='#M000014'>
|
723
|
+
|
724
|
+
|
725
|
+
clear
|
726
|
+
|
727
|
+
()
|
728
|
+
|
729
|
+
</a>
|
730
|
+
</h3>
|
731
|
+
<p>
|
732
|
+
Clear <a href="Locale.html#M000011">current</a> locale.
|
733
|
+
</p>
|
734
|
+
<ul>
|
735
|
+
<li>Returns: self
|
736
|
+
|
737
|
+
</li>
|
738
|
+
</ul>
|
739
|
+
|
740
|
+
<p class="source_link" id="M000014-show-link"><a href="#" onclick="toggle('M000014-source'); toggleText('M000014-link'); return false;" id="M000014-link">Show source...</a></p><div class="source" id="M000014-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 277</span>
|
741
|
+
277: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear</span>
|
742
|
+
278: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:current_languages</span>] = <span class="ruby-keyword kw">nil</span>
|
743
|
+
279: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:candidates_caches</span>] = <span class="ruby-keyword kw">nil</span>
|
744
|
+
280: <span class="ruby-keyword kw">self</span>
|
745
|
+
281: <span class="ruby-keyword kw">end</span></pre></div>
|
746
|
+
</div>
|
747
|
+
|
748
|
+
<a class="small" name="M000015"><br/></a>
|
749
|
+
<div class="method_block"><h3>
|
750
|
+
<a href='#M000015'>
|
751
|
+
|
752
|
+
|
753
|
+
clear_all
|
754
|
+
|
755
|
+
()
|
756
|
+
|
757
|
+
</a>
|
758
|
+
</h3>
|
759
|
+
<p>
|
760
|
+
Clear all locales and charsets of all threads. This doesn‘t <a
|
761
|
+
href="Locale.html#M000014">clear</a> the <a
|
762
|
+
href="Locale.html#M000008">default</a> and <a
|
763
|
+
href="Locale.html#M000017">app_language_tags</a>. Use <a
|
764
|
+
href="Locale.html#M000008">Locale.default</a> = nil to unset the <a
|
765
|
+
href="Locale.html#M000008">default</a> locale.
|
766
|
+
</p>
|
767
|
+
<ul>
|
768
|
+
<li>Returns: self
|
769
|
+
|
770
|
+
</li>
|
771
|
+
</ul>
|
772
|
+
|
773
|
+
<p class="source_link" id="M000015-show-link"><a href="#" onclick="toggle('M000015-source'); toggleText('M000015-link'); return false;" id="M000015-link">Show source...</a></p><div class="source" id="M000015-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 287</span>
|
774
|
+
287: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear_all</span>
|
775
|
+
288: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">thread</span><span class="ruby-operator">|</span>
|
776
|
+
289: <span class="ruby-identifier">thread</span>[<span class="ruby-identifier">:current_languages</span>] = <span class="ruby-keyword kw">nil</span>
|
777
|
+
290: <span class="ruby-identifier">thread</span>[<span class="ruby-identifier">:candidates_caches</span>] = <span class="ruby-keyword kw">nil</span>
|
778
|
+
291: <span class="ruby-keyword kw">end</span>
|
779
|
+
292: <span class="ruby-identifier">memoize_clear</span>
|
780
|
+
293: <span class="ruby-keyword kw">self</span>
|
781
|
+
294: <span class="ruby-keyword kw">end</span></pre></div>
|
782
|
+
</div>
|
783
|
+
|
784
|
+
<a class="small" name="M000011"><br/></a>
|
785
|
+
<div class="method_block"><h3>
|
786
|
+
<a href='#M000011'>
|
787
|
+
|
788
|
+
|
789
|
+
current
|
790
|
+
|
791
|
+
()
|
792
|
+
|
793
|
+
</a>
|
794
|
+
</h3>
|
795
|
+
<p>
|
796
|
+
Gets the <a href="Locale.html#M000011">current</a> locales (<a
|
797
|
+
href="Locale/Tag.html">Locale::Tag</a>‘s class). If the <a
|
798
|
+
href="Locale.html#M000011">current</a> locale is not set, this returns
|
799
|
+
system/default locale.
|
800
|
+
</p>
|
801
|
+
<p>
|
802
|
+
This method returns the <a href="Locale.html#M000011">current</a> language
|
803
|
+
tags even if it isn‘t included in <a
|
804
|
+
href="Locale.html#M000017">app_language_tags</a>.
|
805
|
+
</p>
|
806
|
+
<p>
|
807
|
+
Usually, the programs should use <a
|
808
|
+
href="Locale.html#M000012">Locale.candidates</a> to find the correct
|
809
|
+
locale, not this method.
|
810
|
+
</p>
|
811
|
+
<ul>
|
812
|
+
<li>Returns: an Array of the <a href="Locale.html#M000011">current</a> locales
|
813
|
+
(<a href="Locale/Tag.html">Locale::Tag</a>‘s class).
|
814
|
+
|
815
|
+
</li>
|
816
|
+
</ul>
|
817
|
+
|
818
|
+
<p class="source_link" id="M000011-show-link"><a href="#" onclick="toggle('M000011-source'); toggleText('M000011-link'); return false;" id="M000011-link">Show source...</a></p><div class="source" id="M000011-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 176</span>
|
819
|
+
176: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current</span>
|
820
|
+
177: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:current_languages</span>]
|
821
|
+
178: <span class="ruby-identifier">loc</span> = <span class="ruby-identifier">driver_module</span>.<span class="ruby-identifier">locales</span>
|
822
|
+
179: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:current_languages</span>] = <span class="ruby-identifier">loc</span> <span class="ruby-value">? </span><span class="ruby-identifier">loc</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Locale</span><span class="ruby-operator">::</span><span class="ruby-constant">TagList</span>.<span class="ruby-identifier">new</span>([<span class="ruby-identifier">default</span>])
|
823
|
+
180: <span class="ruby-keyword kw">end</span>
|
824
|
+
181: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:current_languages</span>]
|
825
|
+
182: <span class="ruby-keyword kw">end</span></pre></div>
|
826
|
+
</div>
|
827
|
+
|
828
|
+
<a class="small" name="M000010"><br/></a>
|
829
|
+
<div class="method_block"><h3>
|
830
|
+
<a href='#M000010'>
|
831
|
+
|
832
|
+
|
833
|
+
current=
|
834
|
+
|
835
|
+
(tag)
|
836
|
+
|
837
|
+
</a>
|
838
|
+
</h3>
|
839
|
+
<p>
|
840
|
+
Sets a <a href="Locale.html#M000011">current</a> locale. This is a single
|
841
|
+
argument version of <a href="Locale.html#M000009">Locale.set_current</a>.
|
842
|
+
</p>
|
843
|
+
<ul>
|
844
|
+
<li>tag: the language tag such as "ja-JP"
|
845
|
+
|
846
|
+
</li>
|
847
|
+
<li>Returns: an Array of the <a href="Locale.html#M000011">current</a> locale
|
848
|
+
(<a href="Locale/Tag.html">Locale::Tag</a>‘s class).
|
849
|
+
|
850
|
+
<pre>
|
851
|
+
Locale.current = "ja-JP"
|
852
|
+
Locale.current = "ja_JP.eucJP"
|
853
|
+
</pre>
|
854
|
+
</li>
|
855
|
+
</ul>
|
856
|
+
|
857
|
+
<p class="source_link" id="M000010-show-link"><a href="#" onclick="toggle('M000010-source'); toggleText('M000010-link'); return false;" id="M000010-link">Show source...</a></p><div class="source" id="M000010-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 163</span>
|
858
|
+
163: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current=</span>(<span class="ruby-identifier">tag</span>)
|
859
|
+
164: <span class="ruby-identifier">set_current</span>(<span class="ruby-identifier">tag</span>)
|
860
|
+
165: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:current_languages</span>]
|
861
|
+
166: <span class="ruby-keyword kw">end</span></pre></div>
|
862
|
+
</div>
|
863
|
+
|
864
|
+
<a class="small" name="M000008"><br/></a>
|
865
|
+
<div class="method_block"><h3>
|
866
|
+
<a href='#M000008'>
|
867
|
+
|
868
|
+
|
869
|
+
default
|
870
|
+
|
871
|
+
()
|
872
|
+
|
873
|
+
</a>
|
874
|
+
</h3>
|
875
|
+
<p>
|
876
|
+
Gets the <a href="Locale.html#M000008">default</a> locale(language tag).
|
877
|
+
</p>
|
878
|
+
<p>
|
879
|
+
If the <a href="Locale.html#M000008">default</a> language tag is not set,
|
880
|
+
this returns nil.
|
881
|
+
</p>
|
882
|
+
<ul>
|
883
|
+
<li>Returns: the <a href="Locale.html#M000008">default</a> locale (<a
|
884
|
+
href="Locale/Tag.html">Locale::Tag</a>‘s class).
|
885
|
+
|
886
|
+
</li>
|
887
|
+
</ul>
|
888
|
+
|
889
|
+
<p class="source_link" id="M000008-show-link"><a href="#" onclick="toggle('M000008-source'); toggleText('M000008-link'); return false;" id="M000008-link">Show source...</a></p><div class="source" id="M000008-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 125</span>
|
890
|
+
125: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default</span>
|
891
|
+
126: <span class="ruby-ivar">@@default_tag</span> <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LANGUAGE_TAG</span>
|
892
|
+
127: <span class="ruby-keyword kw">end</span></pre></div>
|
893
|
+
</div>
|
894
|
+
|
895
|
+
<a class="small" name="M000007"><br/></a>
|
896
|
+
<div class="method_block"><h3>
|
897
|
+
<a href='#M000007'>
|
898
|
+
|
899
|
+
|
900
|
+
default=
|
901
|
+
|
902
|
+
(tag)
|
903
|
+
|
904
|
+
</a>
|
905
|
+
</h3>
|
906
|
+
<p>
|
907
|
+
Same as <a href="Locale.html#M000006">Locale.set_default</a>.
|
908
|
+
</p>
|
909
|
+
<ul>
|
910
|
+
<li>locale: the <a href="Locale.html#M000008">default</a> locale (<a
|
911
|
+
href="Locale/Tag.html">Locale::Tag</a>‘s class) or a String such as
|
912
|
+
"ja-JP".
|
913
|
+
|
914
|
+
</li>
|
915
|
+
<li>Returns: locale.
|
916
|
+
|
917
|
+
</li>
|
918
|
+
</ul>
|
919
|
+
|
920
|
+
<p class="source_link" id="M000007-show-link"><a href="#" onclick="toggle('M000007-source'); toggleText('M000007-link'); return false;" id="M000007-link">Show source...</a></p><div class="source" id="M000007-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 115</span>
|
921
|
+
115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default=</span>(<span class="ruby-identifier">tag</span>)
|
922
|
+
116: <span class="ruby-identifier">set_default</span>(<span class="ruby-identifier">tag</span>)
|
923
|
+
117: <span class="ruby-ivar">@@default_tag</span>
|
924
|
+
118: <span class="ruby-keyword kw">end</span></pre></div>
|
925
|
+
</div>
|
926
|
+
|
927
|
+
<a class="small" name="M000005"><br/></a>
|
928
|
+
<div class="method_block"><h3>
|
929
|
+
<a href='#M000005'>
|
930
|
+
|
931
|
+
|
932
|
+
driver_module
|
933
|
+
|
934
|
+
()
|
935
|
+
|
936
|
+
</a>
|
937
|
+
</h3>
|
938
|
+
<p>
|
939
|
+
Gets the driver module.
|
940
|
+
</p>
|
941
|
+
<p>
|
942
|
+
Usually you don‘t need to call this method.
|
943
|
+
</p>
|
944
|
+
<ul>
|
945
|
+
<li>Returns: the driver module.
|
946
|
+
|
947
|
+
</li>
|
948
|
+
</ul>
|
949
|
+
|
950
|
+
<p class="source_link" id="M000005-show-link"><a href="#" onclick="toggle('M000005-source'); toggleText('M000005-link'); return false;" id="M000005-link">Show source...</a></p><div class="source" id="M000005-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 88</span>
|
951
|
+
88: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">driver_module</span>
|
952
|
+
89: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@@locale_driver_module</span>
|
953
|
+
90: <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">init</span>
|
954
|
+
91: <span class="ruby-keyword kw">end</span>
|
955
|
+
92: <span class="ruby-ivar">@@locale_driver_module</span>
|
956
|
+
93: <span class="ruby-keyword kw">end</span></pre></div>
|
957
|
+
</div>
|
958
|
+
|
959
|
+
<a class="small" name="M000004"><br/></a>
|
960
|
+
<div class="method_block"><h3>
|
961
|
+
<a href='#M000004'>
|
962
|
+
|
963
|
+
|
964
|
+
init
|
965
|
+
|
966
|
+
(opts = {})
|
967
|
+
|
968
|
+
</a>
|
969
|
+
</h3>
|
970
|
+
<p>
|
971
|
+
Initialize <a href="Locale.html">Locale</a> library. Usually, you
|
972
|
+
don‘t need to call this directly, because this is called when <a
|
973
|
+
href="Locale.html">Locale</a>‘s methods are called.
|
974
|
+
</p>
|
975
|
+
<p>
|
976
|
+
If you use this library with CGI or the kind of CGI. You need to call <a
|
977
|
+
href="Locale.html#M000004">Locale.init</a>(:driver => :cgi).
|
978
|
+
</p>
|
979
|
+
<h4>For Framework designers/programers:</h4>
|
980
|
+
<p>
|
981
|
+
If your framework is for WWW, call this once like: <a
|
982
|
+
href="Locale.html#M000004">Locale.init</a>(:driver => :cgi).
|
983
|
+
</p>
|
984
|
+
<h4>To Application programers:</h4>
|
985
|
+
<p>
|
986
|
+
If your framework doesn‘t use ruby-locale and the application is for
|
987
|
+
WWW, call this once like: <a
|
988
|
+
href="Locale.html#M000004">Locale.init</a>(:driver => :cgi).
|
989
|
+
</p>
|
990
|
+
<h4>To Library authors:</h4>
|
991
|
+
<p>
|
992
|
+
Don‘t call this, even if your application is only for WWW.
|
993
|
+
</p>
|
994
|
+
<ul>
|
995
|
+
<li>opts: Options as a Hash.
|
996
|
+
|
997
|
+
<ul>
|
998
|
+
<li>:driver - The driver. :cgi if you use <a href="Locale.html">Locale</a>
|
999
|
+
module with CGI, nil if you use system locale.
|
1000
|
+
|
1001
|
+
<pre>
|
1002
|
+
(ex) Locale.init(:driver => :cgi)
|
1003
|
+
</pre>
|
1004
|
+
</li>
|
1005
|
+
</ul>
|
1006
|
+
</li>
|
1007
|
+
</ul>
|
1008
|
+
|
1009
|
+
<p class="source_link" id="M000004-show-link"><a href="#" onclick="toggle('M000004-source'); toggleText('M000004-link'); return false;" id="M000004-link">Show source...</a></p><div class="source" id="M000004-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 69</span>
|
1010
|
+
69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init</span>(<span class="ruby-identifier">opts</span> = {})
|
1011
|
+
70: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:driver</span>]
|
1012
|
+
71: <span class="ruby-identifier">require_driver</span> <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:driver</span>]
|
1013
|
+
72: <span class="ruby-keyword kw">else</span>
|
1014
|
+
73: <span class="ruby-keyword kw">if</span> <span class="ruby-regexp re">/cygwin|mingw|win32/</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">RUBY_PLATFORM</span>
|
1015
|
+
74: <span class="ruby-identifier">require_driver</span> <span class="ruby-value str">'win32'</span>
|
1016
|
+
75: <span class="ruby-keyword kw">elsif</span> <span class="ruby-regexp re">/java/</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">RUBY_PLATFORM</span>
|
1017
|
+
76: <span class="ruby-identifier">require_driver</span> <span class="ruby-value str">'jruby'</span>
|
1018
|
+
77: <span class="ruby-keyword kw">else</span>
|
1019
|
+
78: <span class="ruby-identifier">require_driver</span> <span class="ruby-value str">'posix'</span>
|
1020
|
+
79: <span class="ruby-keyword kw">end</span>
|
1021
|
+
80: <span class="ruby-keyword kw">end</span>
|
1022
|
+
81: <span class="ruby-keyword kw">end</span></pre></div>
|
1023
|
+
</div>
|
1024
|
+
|
1025
|
+
<a class="small" name="M000016"><br/></a>
|
1026
|
+
<div class="method_block"><h3>
|
1027
|
+
<a href='#M000016'>
|
1028
|
+
|
1029
|
+
|
1030
|
+
set_app_language_tags
|
1031
|
+
|
1032
|
+
(*tags)
|
1033
|
+
|
1034
|
+
</a>
|
1035
|
+
</h3>
|
1036
|
+
<p>
|
1037
|
+
Set the language tags which is supported by the Application. This value is
|
1038
|
+
same with supported_language_tags in <a
|
1039
|
+
href="Locale.html#M000012">Locale.candidates</a> to restrict the result but
|
1040
|
+
is the global setting. If you set a language tag, the application works as
|
1041
|
+
the single locale application.
|
1042
|
+
</p>
|
1043
|
+
<p>
|
1044
|
+
If the <a href="Locale.html#M000011">current</a> locale is not included in
|
1045
|
+
<a href="Locale.html#M000017">app_language_tags</a>, <a
|
1046
|
+
href="Locale.html#M000008">Locale.default</a> value is used. Use <a
|
1047
|
+
href="Locale.html#M000006">Locale.set_default</a>() to set correct language
|
1048
|
+
if "en" is not included in the language tags.
|
1049
|
+
</p>
|
1050
|
+
<p>
|
1051
|
+
Set nil if <a href="Locale.html#M000014">clear</a> the value.
|
1052
|
+
</p>
|
1053
|
+
<p>
|
1054
|
+
Note that the libraries/plugins shouldn‘t set this value.
|
1055
|
+
</p>
|
1056
|
+
<pre>
|
1057
|
+
(e.g.) Locale.set_app_language_tags("fr_FR", "en-GB", "en_US", ...)
|
1058
|
+
</pre>
|
1059
|
+
|
1060
|
+
<p class="source_link" id="M000016-show-link"><a href="#" onclick="toggle('M000016-source'); toggleText('M000016-link'); return false;" id="M000016-link">Show source...</a></p><div class="source" id="M000016-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 313</span>
|
1061
|
+
313: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_app_language_tags</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">tags</span>)
|
1062
|
+
314: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tags</span>[<span class="ruby-value">0</span>]
|
1063
|
+
315: <span class="ruby-ivar">@@app_language_tags</span> = <span class="ruby-identifier">tags</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-constant">Locale</span><span class="ruby-operator">::</span><span class="ruby-constant">Tag</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">v</span>)}
|
1064
|
+
316: <span class="ruby-keyword kw">else</span>
|
1065
|
+
317: <span class="ruby-ivar">@@app_language_tags</span> = <span class="ruby-keyword kw">nil</span>
|
1066
|
+
318: <span class="ruby-keyword kw">end</span>
|
1067
|
+
319:
|
1068
|
+
320: <span class="ruby-identifier">clear_all</span>
|
1069
|
+
321: <span class="ruby-keyword kw">self</span>
|
1070
|
+
322: <span class="ruby-keyword kw">end</span></pre></div>
|
1071
|
+
</div>
|
1072
|
+
|
1073
|
+
<a class="small" name="M000002"><br/></a>
|
1074
|
+
<div class="method_block"><h3>
|
1075
|
+
<a href='#M000002'>
|
1076
|
+
|
1077
|
+
|
1078
|
+
set_cgi
|
1079
|
+
|
1080
|
+
(cgi)
|
1081
|
+
|
1082
|
+
</a>
|
1083
|
+
</h3>
|
1084
|
+
<p>
|
1085
|
+
Sets a CGI object. This is the convenient function of <a
|
1086
|
+
href="Locale.html#M000001">set_request</a>().
|
1087
|
+
</p>
|
1088
|
+
<p>
|
1089
|
+
This method is appeared when <a
|
1090
|
+
href="Locale.html#M000004">Locale.init</a>(:driver => :cgi) is called.
|
1091
|
+
</p>
|
1092
|
+
<ul>
|
1093
|
+
<li>cgi: CGI object
|
1094
|
+
|
1095
|
+
</li>
|
1096
|
+
<li>Returns: self
|
1097
|
+
|
1098
|
+
</li>
|
1099
|
+
</ul>
|
1100
|
+
|
1101
|
+
<p class="source_link" id="M000002-show-link"><a href="#" onclick="toggle('M000002-source'); toggleText('M000002-link'); return false;" id="M000002-link">Show source...</a></p><div class="source" id="M000002-source"><pre> <span class="ruby-comment cmt"># File lib/locale/driver/cgi.rb, line 120</span>
|
1102
|
+
120: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_cgi</span>(<span class="ruby-identifier">cgi</span>)
|
1103
|
+
121: <span class="ruby-identifier">set_request</span>(<span class="ruby-identifier">cgi</span>.<span class="ruby-identifier">params</span>[<span class="ruby-value str">"lang"</span>], <span class="ruby-identifier">cgi</span>.<span class="ruby-identifier">cookies</span>[<span class="ruby-value str">"lang"</span>],
|
1104
|
+
122: <span class="ruby-identifier">cgi</span>.<span class="ruby-identifier">accept_language</span>, <span class="ruby-identifier">cgi</span>.<span class="ruby-identifier">accept_charset</span>)
|
1105
|
+
123: <span class="ruby-keyword kw">self</span>
|
1106
|
+
124: <span class="ruby-keyword kw">end</span></pre></div>
|
1107
|
+
</div>
|
1108
|
+
|
1109
|
+
<a class="small" name="M000009"><br/></a>
|
1110
|
+
<div class="method_block"><h3>
|
1111
|
+
<a href='#M000009'>
|
1112
|
+
|
1113
|
+
|
1114
|
+
set_current
|
1115
|
+
|
1116
|
+
(*tags)
|
1117
|
+
|
1118
|
+
</a>
|
1119
|
+
</h3>
|
1120
|
+
<p>
|
1121
|
+
Sets the locales of the <a href="Locale.html#M000011">current</a> thread
|
1122
|
+
order by the priority. Each thread has a <a
|
1123
|
+
href="Locale.html#M000011">current</a> locales. The system locale/default
|
1124
|
+
locale is used if the thread doesn‘t have <a
|
1125
|
+
href="Locale.html#M000011">current</a> locales.
|
1126
|
+
</p>
|
1127
|
+
<ul>
|
1128
|
+
<li>tag: Locale::Language::Tag‘s class or the language tag as a String.
|
1129
|
+
nil if you need to <a href="Locale.html#M000014">clear</a> <a
|
1130
|
+
href="Locale.html#M000011">current</a> locales.
|
1131
|
+
|
1132
|
+
</li>
|
1133
|
+
<li><a href="Locale.html#M000013">charset</a>: the <a
|
1134
|
+
href="Locale.html#M000013">charset</a> (override the <a
|
1135
|
+
href="Locale.html#M000013">charset</a> even if the locale name has <a
|
1136
|
+
href="Locale.html#M000013">charset</a>) or nil.
|
1137
|
+
|
1138
|
+
</li>
|
1139
|
+
<li>Returns: self
|
1140
|
+
|
1141
|
+
</li>
|
1142
|
+
</ul>
|
1143
|
+
<p>
|
1144
|
+
(e.g.)
|
1145
|
+
</p>
|
1146
|
+
<pre>
|
1147
|
+
Locale.set_current("ja_JP.eucJP")
|
1148
|
+
Locale.set_current("ja-JP")
|
1149
|
+
Locale.set_current("en_AU", "en_US", ...)
|
1150
|
+
Locale.set_current(Locale::Tag::Simple.new("ja", "JP"), ...)
|
1151
|
+
</pre>
|
1152
|
+
|
1153
|
+
<p class="source_link" id="M000009-show-link"><a href="#" onclick="toggle('M000009-source'); toggleText('M000009-link'); return false;" id="M000009-link">Show source...</a></p><div class="source" id="M000009-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 143</span>
|
1154
|
+
143: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_current</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">tags</span>)
|
1155
|
+
144: <span class="ruby-identifier">languages</span> = <span class="ruby-keyword kw">nil</span>
|
1156
|
+
145: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tags</span>[<span class="ruby-value">0</span>]
|
1157
|
+
146: <span class="ruby-identifier">languages</span> = <span class="ruby-constant">Locale</span><span class="ruby-operator">::</span><span class="ruby-constant">TagList</span>.<span class="ruby-identifier">new</span>
|
1158
|
+
147: <span class="ruby-identifier">tags</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tag</span><span class="ruby-operator">|</span>
|
1159
|
+
148: <span class="ruby-identifier">languages</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">create_language_tag</span>(<span class="ruby-identifier">tag</span>)
|
1160
|
+
149: <span class="ruby-keyword kw">end</span>
|
1161
|
+
150: <span class="ruby-keyword kw">end</span>
|
1162
|
+
151: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:current_languages</span>] = <span class="ruby-identifier">languages</span>
|
1163
|
+
152: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:candidates_caches</span>] = <span class="ruby-keyword kw">nil</span>
|
1164
|
+
153: <span class="ruby-keyword kw">self</span>
|
1165
|
+
154: <span class="ruby-keyword kw">end</span></pre></div>
|
1166
|
+
</div>
|
1167
|
+
|
1168
|
+
<a class="small" name="M000006"><br/></a>
|
1169
|
+
<div class="method_block"><h3>
|
1170
|
+
<a href='#M000006'>
|
1171
|
+
|
1172
|
+
|
1173
|
+
set_default
|
1174
|
+
|
1175
|
+
(tag)
|
1176
|
+
|
1177
|
+
</a>
|
1178
|
+
</h3>
|
1179
|
+
<p>
|
1180
|
+
Sets the <a href="Locale.html#M000008">default</a> locale as the language
|
1181
|
+
tag (<a href="Locale/Tag.html">Locale::Tag</a>‘s class or String(such
|
1182
|
+
as "ja_JP")).
|
1183
|
+
</p>
|
1184
|
+
<ul>
|
1185
|
+
<li>tag: the <a href="Locale.html#M000008">default</a> language_tag
|
1186
|
+
|
1187
|
+
</li>
|
1188
|
+
<li>Returns: self.
|
1189
|
+
|
1190
|
+
</li>
|
1191
|
+
</ul>
|
1192
|
+
|
1193
|
+
<p class="source_link" id="M000006-show-link"><a href="#" onclick="toggle('M000006-source'); toggleText('M000006-link'); return false;" id="M000006-link">Show source...</a></p><div class="source" id="M000006-source"><pre> <span class="ruby-comment cmt"># File lib/locale.rb, line 102</span>
|
1194
|
+
102: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_default</span>(<span class="ruby-identifier">tag</span>)
|
1195
|
+
103: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">thread</span><span class="ruby-operator">|</span>
|
1196
|
+
104: <span class="ruby-identifier">thread</span>[<span class="ruby-identifier">:current_languages</span>] = <span class="ruby-keyword kw">nil</span>
|
1197
|
+
105: <span class="ruby-identifier">thread</span>[<span class="ruby-identifier">:candidates_caches</span>] = <span class="ruby-keyword kw">nil</span>
|
1198
|
+
106: <span class="ruby-keyword kw">end</span>
|
1199
|
+
107: <span class="ruby-ivar">@@default_tag</span> = <span class="ruby-identifier">create_language_tag</span>(<span class="ruby-identifier">tag</span>)
|
1200
|
+
108: <span class="ruby-keyword kw">self</span>
|
1201
|
+
109: <span class="ruby-keyword kw">end</span></pre></div>
|
1202
|
+
</div>
|
1203
|
+
|
1204
|
+
<a class="small" name="M000001"><br/></a>
|
1205
|
+
<div class="method_block"><h3>
|
1206
|
+
<a href='#M000001'>
|
1207
|
+
|
1208
|
+
|
1209
|
+
set_request
|
1210
|
+
|
1211
|
+
(query_langs, cookie_langs, accept_language, accept_charset)
|
1212
|
+
|
1213
|
+
</a>
|
1214
|
+
</h3>
|
1215
|
+
<p>
|
1216
|
+
Sets a request values for lang/charset.
|
1217
|
+
</p>
|
1218
|
+
<ul>
|
1219
|
+
<li>query_langs: An Array of QUERY_STRING value "lang".
|
1220
|
+
|
1221
|
+
</li>
|
1222
|
+
<li>cookie_langs: An Array of cookie value "lang".
|
1223
|
+
|
1224
|
+
</li>
|
1225
|
+
<li>accept_language: The value of HTTP_ACCEPT_LANGUAGE
|
1226
|
+
|
1227
|
+
</li>
|
1228
|
+
<li>accept_charset: The value of HTTP_ACCEPT_CHARSET
|
1229
|
+
|
1230
|
+
</li>
|
1231
|
+
</ul>
|
1232
|
+
|
1233
|
+
<p class="source_link" id="M000001-show-link"><a href="#" onclick="toggle('M000001-source'); toggleText('M000001-link'); return false;" id="M000001-link">Show source...</a></p><div class="source" id="M000001-source"><pre> <span class="ruby-comment cmt"># File lib/locale/driver/cgi.rb, line 109</span>
|
1234
|
+
109: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_request</span>(<span class="ruby-identifier">query_langs</span>, <span class="ruby-identifier">cookie_langs</span>, <span class="ruby-identifier">accept_language</span>, <span class="ruby-identifier">accept_charset</span>)
|
1235
|
+
110: <span class="ruby-ivar">@@locale_driver_module</span>.<span class="ruby-identifier">set_request</span>(<span class="ruby-identifier">query_langs</span>, <span class="ruby-identifier">cookie_langs</span>, <span class="ruby-identifier">accept_language</span>, <span class="ruby-identifier">accept_charset</span>)
|
1236
|
+
111: <span class="ruby-keyword kw">self</span>
|
1237
|
+
112: <span class="ruby-keyword kw">end</span></pre></div>
|
1238
|
+
</div>
|
1239
|
+
|
1240
|
+
|
1241
|
+
|
1242
|
+
|
1243
|
+
|
1244
|
+
</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>
|