locale 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. data/COPYING +55 -0
  2. data/ChangeLog +113 -0
  3. data/README +100 -0
  4. data/Rakefile +77 -0
  5. data/doc/classes/Locale/Driver.html +375 -0
  6. data/doc/classes/Locale/Driver/CGI.html +502 -0
  7. data/doc/classes/Locale/Driver/Env.html +440 -0
  8. data/doc/classes/Locale/Driver/JRuby.html +390 -0
  9. data/doc/classes/Locale/Driver/Posix.html +431 -0
  10. data/doc/classes/Locale/Driver/Win32.html +398 -0
  11. data/doc/classes/Locale/Driver/Win32Table.html +356 -0
  12. data/doc/classes/Locale/Info.html +586 -0
  13. data/doc/classes/Locale/Info/Language.html +764 -0
  14. data/doc/classes/Locale/Info/Region.html +470 -0
  15. data/doc/classes/Locale/Tag/Cldr.html +547 -0
  16. data/doc/classes/Locale/Tag/Common.html +655 -0
  17. data/doc/classes/Locale/Tag/Illegular.html +424 -0
  18. data/doc/classes/Locale/Tag/Posix.html +612 -0
  19. data/doc/classes/Locale/Tag/Rfc.html +610 -0
  20. data/doc/classes/Locale/Tag/Simple.html +684 -0
  21. data/doc/classes/Locale/TagList.html +783 -0
  22. data/doc/classes/Locale/Util.html +476 -0
  23. data/doc/classes/Locale/Util/Memoizable.html +356 -0
  24. data/doc/created.rid +1 -0
  25. data/doc/files/ChangeLog.html +497 -0
  26. data/doc/files/README.html +525 -0
  27. data/doc/files/lib/locale/driver/cgi_rb.html +342 -0
  28. data/doc/files/lib/locale/driver/env_rb.html +354 -0
  29. data/doc/files/lib/locale/driver/jruby_rb.html +359 -0
  30. data/doc/files/lib/locale/driver/posix_rb.html +349 -0
  31. data/doc/files/lib/locale/driver/win32_rb.html +359 -0
  32. data/doc/files/lib/locale/driver/win32_table_rb.html +342 -0
  33. data/doc/files/lib/locale/info/language_rb.html +353 -0
  34. data/doc/files/lib/locale/info/region_rb.html +353 -0
  35. data/doc/files/lib/locale/info_rb.html +354 -0
  36. data/doc/files/lib/locale/tag/cldr_rb.html +342 -0
  37. data/doc/files/lib/locale/tag/common_rb.html +342 -0
  38. data/doc/files/lib/locale/tag/illegular_rb.html +349 -0
  39. data/doc/files/lib/locale/tag/posix_rb.html +342 -0
  40. data/doc/files/lib/locale/tag/rfc_rb.html +342 -0
  41. data/doc/files/lib/locale/tag/simple_rb.html +349 -0
  42. data/doc/files/lib/locale/tag_rb.html +374 -0
  43. data/doc/files/lib/locale/taglist_rb.html +342 -0
  44. data/doc/files/lib/locale/util/memoizable_rb.html +360 -0
  45. data/doc/files/lib/locale/version_rb.html +342 -0
  46. data/doc/files/lib/locale_rb.html +379 -0
  47. data/doc/fr_class_index.html +20 -0
  48. data/doc/fr_file_index.html +23 -0
  49. data/doc/fr_method_index.html +80 -0
  50. data/doc/index.html +1 -0
  51. data/doc/rdoc-style.css +320 -0
  52. data/lib/locale.rb +248 -0
  53. data/lib/locale/data/languages.tab.gz +0 -0
  54. data/lib/locale/data/regions.tab.gz +0 -0
  55. data/lib/locale/driver/cgi.rb +132 -0
  56. data/lib/locale/driver/env.rb +64 -0
  57. data/lib/locale/driver/jruby.rb +53 -0
  58. data/lib/locale/driver/posix.rb +49 -0
  59. data/lib/locale/driver/win32.rb +61 -0
  60. data/lib/locale/driver/win32_table.rb +298 -0
  61. data/lib/locale/info.rb +12 -0
  62. data/lib/locale/info/language.rb +134 -0
  63. data/lib/locale/info/region.rb +74 -0
  64. data/lib/locale/tag.rb +36 -0
  65. data/lib/locale/tag/cldr.rb +93 -0
  66. data/lib/locale/tag/common.rb +122 -0
  67. data/lib/locale/tag/illegular.rb +38 -0
  68. data/lib/locale/tag/posix.rb +97 -0
  69. data/lib/locale/tag/rfc.rb +106 -0
  70. data/lib/locale/tag/simple.rb +145 -0
  71. data/lib/locale/taglist.rb +93 -0
  72. data/lib/locale/util/memoizable.rb +76 -0
  73. data/lib/locale/version.rb +12 -0
  74. data/samples/cgi/README +20 -0
  75. data/samples/cgi/cookie.cgi +62 -0
  76. data/samples/cgi/http.rb +52 -0
  77. data/samples/cgi/index.cgi +90 -0
  78. data/samples/cgi/locale.css +115 -0
  79. data/samples/sample_1.rb +25 -0
  80. data/samples/sample_info.rb +6 -0
  81. data/setup.rb +1585 -0
  82. data/test/test_detect_cgi.rb +179 -0
  83. data/test/test_detect_general.rb +159 -0
  84. data/test/test_info.rb +28 -0
  85. data/test/test_tag.rb +1183 -0
  86. data/test/test_thread.rb +37 -0
  87. metadata +162 -0
@@ -0,0 +1,20 @@
1
+
2
+ <a href="classes/Locale/Driver.html">Locale::Driver<br/></a>
3
+ <a href="classes/Locale/Driver/CGI.html">Locale::Driver::CGI<br/></a>
4
+ <a href="classes/Locale/Driver/Env.html">Locale::Driver::Env<br/></a>
5
+ <a href="classes/Locale/Driver/JRuby.html">Locale::Driver::JRuby<br/></a>
6
+ <a href="classes/Locale/Driver/Posix.html">Locale::Driver::Posix<br/></a>
7
+ <a href="classes/Locale/Driver/Win32.html">Locale::Driver::Win32<br/></a>
8
+ <a href="classes/Locale/Driver/Win32Table.html">Locale::Driver::Win32Table<br/></a>
9
+ <a href="classes/Locale/Info.html">Locale::Info<br/></a>
10
+ <a href="classes/Locale/Info/Language.html">Locale::Info::Language<br/></a>
11
+ <a href="classes/Locale/Info/Region.html">Locale::Info::Region<br/></a>
12
+ <a href="classes/Locale/Tag/Cldr.html">Locale::Tag::Cldr<br/></a>
13
+ <a href="classes/Locale/Tag/Common.html">Locale::Tag::Common<br/></a>
14
+ <a href="classes/Locale/Tag/Illegular.html">Locale::Tag::Illegular<br/></a>
15
+ <a href="classes/Locale/Tag/Posix.html">Locale::Tag::Posix<br/></a>
16
+ <a href="classes/Locale/Tag/Rfc.html">Locale::Tag::Rfc<br/></a>
17
+ <a href="classes/Locale/Tag/Simple.html">Locale::Tag::Simple<br/></a>
18
+ <a href="classes/Locale/TagList.html">Locale::TagList<br/></a>
19
+ <a href="classes/Locale/Util.html">Locale::Util<br/></a>
20
+ <a href="classes/Locale/Util/Memoizable.html">Locale::Util::Memoizable<br/></a>
@@ -0,0 +1,23 @@
1
+
2
+ <a href="files/ChangeLog.html">ChangeLog<br/></a>
3
+ <a href="files/README.html">README<br/></a>
4
+ <a href="files/lib/locale_rb.html">lib/locale.rb<br/></a>
5
+ <a href="files/lib/locale/driver/cgi_rb.html">lib/locale/driver/cgi.rb<br/></a>
6
+ <a href="files/lib/locale/driver/env_rb.html">lib/locale/driver/env.rb<br/></a>
7
+ <a href="files/lib/locale/driver/jruby_rb.html">lib/locale/driver/jruby.rb<br/></a>
8
+ <a href="files/lib/locale/driver/posix_rb.html">lib/locale/driver/posix.rb<br/></a>
9
+ <a href="files/lib/locale/driver/win32_rb.html">lib/locale/driver/win32.rb<br/></a>
10
+ <a href="files/lib/locale/driver/win32_table_rb.html">lib/locale/driver/win32_table.rb<br/></a>
11
+ <a href="files/lib/locale/info_rb.html">lib/locale/info.rb<br/></a>
12
+ <a href="files/lib/locale/info/language_rb.html">lib/locale/info/language.rb<br/></a>
13
+ <a href="files/lib/locale/info/region_rb.html">lib/locale/info/region.rb<br/></a>
14
+ <a href="files/lib/locale/tag_rb.html">lib/locale/tag.rb<br/></a>
15
+ <a href="files/lib/locale/tag/cldr_rb.html">lib/locale/tag/cldr.rb<br/></a>
16
+ <a href="files/lib/locale/tag/common_rb.html">lib/locale/tag/common.rb<br/></a>
17
+ <a href="files/lib/locale/tag/illegular_rb.html">lib/locale/tag/illegular.rb<br/></a>
18
+ <a href="files/lib/locale/tag/posix_rb.html">lib/locale/tag/posix.rb<br/></a>
19
+ <a href="files/lib/locale/tag/rfc_rb.html">lib/locale/tag/rfc.rb<br/></a>
20
+ <a href="files/lib/locale/tag/simple_rb.html">lib/locale/tag/simple.rb<br/></a>
21
+ <a href="files/lib/locale/taglist_rb.html">lib/locale/taglist.rb<br/></a>
22
+ <a href="files/lib/locale/util/memoizable_rb.html">lib/locale/util/memoizable.rb<br/></a>
23
+ <a href="files/lib/locale/version_rb.html">lib/locale/version.rb<br/></a>
@@ -0,0 +1,80 @@
1
+
2
+ <a href="classes/Locale/Info/Language.html#M000051">ancient? (Locale::Info::Language)<br/></a>
3
+ <a href="classes/Locale/Tag/Posix.html#M000026">candidates (Locale::Tag::Posix)<br/></a>
4
+ <a href="classes/Locale/Tag/Common.html#M000011">candidates (Locale::Tag::Common)<br/></a>
5
+ <a href="classes/Locale/Tag/Simple.html#M000033">candidates (Locale::Tag::Simple)<br/></a>
6
+ <a href="classes/Locale/Tag/Illegular.html#M000005">candidates (Locale::Tag::Illegular)<br/></a>
7
+ <a href="classes/Locale/TagList.html#M000069">charset (Locale::TagList)<br/></a>
8
+ <a href="classes/Locale/Driver/Win32.html#M000063">charset (Locale::Driver::Win32)<br/></a>
9
+ <a href="classes/Locale/Driver/CGI.html#M000059">charset (Locale::Driver::CGI)<br/></a>
10
+ <a href="classes/Locale/Driver/JRuby.html#M000064">charset (Locale::Driver::JRuby)<br/></a>
11
+ <a href="classes/Locale/Driver/Posix.html#M000062">charset (Locale::Driver::Posix)<br/></a>
12
+ <a href="classes/Locale/Tag/Posix.html#M000024">charset= (Locale::Tag::Posix)<br/></a>
13
+ <a href="classes/Locale/Util.html#M000002">clear (Locale::Util)<br/></a>
14
+ <a href="classes/Locale/Info/Language.html#M000048">constructed? (Locale::Info::Language)<br/></a>
15
+ <a href="classes/Locale/Tag/Simple.html#M000030">country (Locale::Tag::Simple)<br/></a>
16
+ <a href="classes/Locale/TagList.html#M000066">country (Locale::TagList)<br/></a>
17
+ <a href="classes/Locale/TagList.html#M000071">extensions (Locale::TagList)<br/></a>
18
+ <a href="classes/Locale/Tag/Cldr.html#M000015">extensions= (Locale::Tag::Cldr)<br/></a>
19
+ <a href="classes/Locale/Tag/Rfc.html#M000019">extensions= (Locale::Tag::Rfc)<br/></a>
20
+ <a href="classes/Locale/Info/Language.html#M000050">extinct? (Locale::Info::Language)<br/></a>
21
+ <a href="classes/Locale/Info.html#M000036">get_language (Locale::Info)<br/></a>
22
+ <a href="classes/Locale/Info.html#M000039">get_region (Locale::Info)<br/></a>
23
+ <a href="classes/Locale/Info/Language.html#M000052">historical? (Locale::Info::Language)<br/></a>
24
+ <a href="classes/Locale/Util.html#M000001">included (Locale::Util)<br/></a>
25
+ <a href="classes/Locale/Info/Language.html#M000045">individual? (Locale::Info::Language)<br/></a>
26
+ <a href="classes/Locale/Info/Language.html#M000055">iso_language? (Locale::Info::Language)<br/></a>
27
+ <a href="classes/Locale/Info/Region.html#M000042">iso_region? (Locale::Info::Region)<br/></a>
28
+ <a href="classes/Locale/TagList.html#M000065">language (Locale::TagList)<br/></a>
29
+ <a href="classes/Locale/Tag/Simple.html#M000031">language= (Locale::Tag::Simple)<br/></a>
30
+ <a href="classes/Locale/Info.html#M000037">language_code? (Locale::Info)<br/></a>
31
+ <a href="classes/Locale/Info/Language.html#M000049">living? (Locale::Info::Language)<br/></a>
32
+ <a href="classes/Locale/Driver/Env.html#M000056">locale (Locale::Driver::Env)<br/></a>
33
+ <a href="classes/Locale/Driver/CGI.html#M000058">locales (Locale::Driver::CGI)<br/></a>
34
+ <a href="classes/Locale/Driver/Env.html#M000057">locales (Locale::Driver::Env)<br/></a>
35
+ <a href="classes/Locale/Driver/Posix.html#M000061">locales (Locale::Driver::Posix)<br/></a>
36
+ <a href="classes/Locale/Info/Language.html#M000046">macro? (Locale::Info::Language)<br/></a>
37
+ <a href="classes/Locale/Util.html#M000003">memoize (Locale::Util)<br/></a>
38
+ <a href="classes/Locale/TagList.html#M000070">modifier (Locale::TagList)<br/></a>
39
+ <a href="classes/Locale/Tag/Posix.html#M000025">modifier= (Locale::Tag::Posix)<br/></a>
40
+ <a href="classes/Locale/Info/Region.html#M000041">new (Locale::Info::Region)<br/></a>
41
+ <a href="classes/Locale/Tag/Cldr.html#M000012">new (Locale::Tag::Cldr)<br/></a>
42
+ <a href="classes/Locale/Tag/Common.html#M000006">new (Locale::Tag::Common)<br/></a>
43
+ <a href="classes/Locale/Tag/Rfc.html#M000016">new (Locale::Tag::Rfc)<br/></a>
44
+ <a href="classes/Locale/Tag/Simple.html#M000028">new (Locale::Tag::Simple)<br/></a>
45
+ <a href="classes/Locale/Info/Language.html#M000044">new (Locale::Info::Language)<br/></a>
46
+ <a href="classes/Locale/Tag/Posix.html#M000021">new (Locale::Tag::Posix)<br/></a>
47
+ <a href="classes/Locale/Tag/Illegular.html#M000004">new (Locale::Tag::Illegular)<br/></a>
48
+ <a href="classes/Locale/Tag/Posix.html#M000022">parse (Locale::Tag::Posix)<br/></a>
49
+ <a href="classes/Locale/Tag/Common.html#M000007">parse (Locale::Tag::Common)<br/></a>
50
+ <a href="classes/Locale/Tag/Cldr.html#M000013">parse (Locale::Tag::Cldr)<br/></a>
51
+ <a href="classes/Locale/Tag/Rfc.html#M000017">parse (Locale::Tag::Rfc)<br/></a>
52
+ <a href="classes/Locale/Tag/Simple.html#M000027">parse (Locale::Tag::Simple)<br/></a>
53
+ <a href="classes/Locale/TagList.html#M000072">privateuse (Locale::TagList)<br/></a>
54
+ <a href="classes/Locale/Tag/Rfc.html#M000020">privateuse= (Locale::Tag::Rfc)<br/></a>
55
+ <a href="classes/Locale/TagList.html#M000067">region (Locale::TagList)<br/></a>
56
+ <a href="classes/Locale/Tag/Simple.html#M000032">region= (Locale::Tag::Simple)<br/></a>
57
+ <a href="classes/Locale/Info.html#M000038">regions (Locale::Info)<br/></a>
58
+ <a href="classes/Locale/TagList.html#M000068">script (Locale::TagList)<br/></a>
59
+ <a href="classes/Locale/Tag/Common.html#M000008">script= (Locale::Tag::Common)<br/></a>
60
+ <a href="classes/Locale/Driver/CGI.html#M000060">set_cgi (Locale::Driver::CGI)<br/></a>
61
+ <a href="classes/Locale/Info/Language.html#M000047">special? (Locale::Info::Language)<br/></a>
62
+ <a href="classes/Locale/Info/Language.html#M000053">special_type? (Locale::Info::Language)<br/></a>
63
+ <a href="classes/Locale/Info.html#M000034">three_languages (Locale::Info)<br/></a>
64
+ <a href="classes/Locale/TagList.html#M000078">to_cldr (Locale::TagList)<br/></a>
65
+ <a href="classes/Locale/TagList.html#M000075">to_common (Locale::TagList)<br/></a>
66
+ <a href="classes/Locale/TagList.html#M000079">to_posix (Locale::TagList)<br/></a>
67
+ <a href="classes/Locale/TagList.html#M000077">to_rfc (Locale::TagList)<br/></a>
68
+ <a href="classes/Locale/Tag/Common.html#M000010">to_s (Locale::Tag::Common)<br/></a>
69
+ <a href="classes/Locale/Tag/Simple.html#M000029">to_s (Locale::Tag::Simple)<br/></a>
70
+ <a href="classes/Locale/Tag/Cldr.html#M000014">to_s (Locale::Tag::Cldr)<br/></a>
71
+ <a href="classes/Locale/Tag/Posix.html#M000023">to_s (Locale::Tag::Posix)<br/></a>
72
+ <a href="classes/Locale/Info/Region.html#M000043">to_s (Locale::Info::Region)<br/></a>
73
+ <a href="classes/Locale/Tag/Rfc.html#M000018">to_s (Locale::Tag::Rfc)<br/></a>
74
+ <a href="classes/Locale/TagList.html#M000074">to_s (Locale::TagList)<br/></a>
75
+ <a href="classes/Locale/Info/Language.html#M000054">to_s (Locale::Info::Language)<br/></a>
76
+ <a href="classes/Locale/TagList.html#M000076">to_simple (Locale::TagList)<br/></a>
77
+ <a href="classes/Locale/TagList.html#M000073">to_str (Locale::TagList)<br/></a>
78
+ <a href="classes/Locale/Info.html#M000035">two_languages (Locale::Info)<br/></a>
79
+ <a href="classes/Locale/Info.html#M000040">valid_region_code? (Locale::Info)<br/></a>
80
+ <a href="classes/Locale/Tag/Common.html#M000009">variants= (Locale::Tag::Common)<br/></a>
@@ -0,0 +1 @@
1
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><title>Ruby-Locale library</title><link type="text/css" href="rdoc-style.css" media="screen" rel="stylesheet"/><meta content="0;url=files/README.html" http-equiv="refresh"/></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"><span id="title"><p>&nbsp;</p><h1>Ruby Documentation</h1></span></div><div class="clear"></div><div id="redirect"><a href="files/README.html"><h1>Redirect</h1></a></div></div></body></html>
@@ -0,0 +1,320 @@
1
+
2
+ /*;
3
+ Allison 2 template;
4
+ Copyright 2007, 2008 Cloudburst, LLC. Licensed under the AFL 3. See the included LICENSE file.;
5
+ */;
6
+
7
+ /* default styles */
8
+
9
+ * {
10
+ margin: 0;
11
+ padding: 0;
12
+ border: none;
13
+ }
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+ .clear {
25
+ clear: both;
26
+ }
27
+
28
+ a {
29
+ color: #304878;
30
+ font-weight: bold;
31
+ text-decoration: none;
32
+ }
33
+
34
+ a:hover {
35
+ text-decoration: underline;
36
+ }
37
+
38
+ html, body {
39
+ color: #000;
40
+ font-size: 13px;
41
+ font-family: helvetica, verdana, sans;
42
+ background-color: #fff;
43
+ text-align: center;
44
+ margin: 0;
45
+ padding: 0;
46
+ }
47
+
48
+ p, ul, ol {
49
+ line-height: 16px;
50
+ } li {
51
+ margin: 3px;
52
+ _margin-left: 40px;
53
+ } p, pre, table, ol, ul {
54
+ margin: 16px;
55
+ } #item_name {
56
+ margin-top: -8px;
57
+ }
58
+
59
+ h1 {
60
+ font-size: 22px;
61
+ margin-top: 16px;
62
+ } h2, h3 {
63
+ font-size: 18px;
64
+ margin: 6px;
65
+ margin-right: 0;
66
+ padding-top: 12px;
67
+ }
68
+
69
+ /* center everything */
70
+
71
+ #container {
72
+ margin: 20px auto 0 auto;
73
+ width: 900px;
74
+ text-align: left;
75
+ }
76
+
77
+ /* header stuff */
78
+
79
+ #header {
80
+ padding: 6px;
81
+ padding-top: 3px;
82
+ width: 888px;
83
+ height: 52px;
84
+ _height: 58px;
85
+ margin-bottom: 12px;
86
+ vertical-align: baseline;
87
+ background-color: #181848;
88
+ overflow: hidden;
89
+ } .curve {
90
+ background-color: #181848;
91
+ margin: 0;
92
+ padding: 0;
93
+ height: 1px;
94
+ overflow: hidden /* again, ie problem */;
95
+ }
96
+
97
+
98
+
99
+
100
+
101
+ #preheader_curve_5{border-left: 1px solid #fff; border-right: 1px solid #fff; width: 898px; _width: 888px; }
102
+ #preheader_curve_4{border-left: 1px solid #fff; border-right: 1px solid #fff; width: 898px; _width: 888px; }
103
+ #preheader_curve_3{border-left: 2px solid #fff; border-right: 2px solid #fff; width: 896px; _width: 888px; }
104
+ #preheader_curve_2{border-left: 3px solid #fff; border-right: 3px solid #fff; width: 894px; _width: 888px; }
105
+ #preheader_curve_1{border-left: 4px solid #fff; border-right: 4px solid #fff; width: 892px; _width: 888px; }
106
+ #preheader_curve_0{border-left: 6px solid #fff; border-right: 6px solid #fff; width: 888px; _width: 888px; }
107
+
108
+ #header h1 {
109
+ color: #fff;
110
+ font-size: 30px;
111
+ margin: 4px 0 0 0;
112
+ } #header p {
113
+ margin: 0;
114
+ padding: 0;
115
+ padding-left: 3px;
116
+ font-size: 16px;
117
+ color: #fff;
118
+ } #header a {
119
+ color: #fff;
120
+ text-decoration: none;
121
+ font-weight: bold;
122
+ }
123
+
124
+ /* basic layout and navigation bars */
125
+
126
+ #left {
127
+ background-color: #181848;
128
+ width: 220px;
129
+ float: left;
130
+ _width: 208px;
131
+ margin-bottom: 24px;
132
+ } #left a {
133
+ line-height: 14px;
134
+ }
135
+
136
+ /* navigation bar colors and text styles */
137
+
138
+ .navigation {
139
+ width: 196px;
140
+ margin: 6px;
141
+ padding: 6px;
142
+ text-align: left;
143
+ background-color: #fff;
144
+ overflow: hidden;
145
+ } .navigation h3 {
146
+ font-weight: bold;
147
+ margin-bottom: 5px;
148
+ } .navigation span, .navigation a {
149
+ margin-left: 6px;
150
+ } #includes .navigation span, #includes .navigation a {
151
+ margin-left: 0;
152
+ } .darker {
153
+ background-color: #e4ebed;
154
+ } #spacer {
155
+ background-color: #fff;
156
+ height: 18px;
157
+ display: none;
158
+ }
159
+
160
+ /* content area */
161
+
162
+ #content {
163
+ padding: 20px;
164
+ width: 640px;
165
+ float: left;
166
+ min-height: 450px;
167
+ margin: 0;
168
+ margin-bottom: -4px;
169
+ } #content img {
170
+ padding-top: 6px;
171
+ padding-bottom: 12px;
172
+ }
173
+
174
+ #content h1, h2 {
175
+ border-top: 1px solid #e4ebed;
176
+ } #content h1 {
177
+ padding-top: 18px;
178
+ } #content #item_name { /* why does this need to be fully qualified? */
179
+ padding-top: 0;
180
+ border: none;
181
+ }
182
+
183
+ /* footer */
184
+
185
+ #footer {
186
+ text-align: center;
187
+ background-color: #fff;
188
+ padding: 18px;
189
+ border-top: 1px solid #e4ebed;
190
+ color: #ccd5dc;
191
+ } #footer a {
192
+ font-weight: normal;
193
+ color: #ccd5dc;
194
+ }
195
+
196
+ /* for that dumb redirect index page I can't avoid */
197
+
198
+ #redirect {
199
+ text-align: center;
200
+ } #redirect a {
201
+ color: #181848;
202
+ }
203
+
204
+ /* tables */
205
+
206
+ table {
207
+ width: 585px;
208
+ margin-right: 0;
209
+ border-collapse: collapse;
210
+ border: 1px solid #e4ebed;
211
+ } td, th {
212
+ background-color: #fff;
213
+ text-align: left;
214
+ padding: 6px;
215
+ line-height: 14px;
216
+ font-size: 13px;
217
+ } td.normal {
218
+ font-family: Courier, Courier New, monospace;
219
+ font-size: 12px;
220
+ } td.highlight {
221
+ color: #304878;
222
+ }
223
+
224
+ /* method_block details */
225
+
226
+ div.method_block {
227
+ border-bottom: 1px solid #e4ebed;
228
+ margin-left: 20px;
229
+ margin-bottom: -17px;
230
+ margin-top: 17px;
231
+ } div.method_block h3 {
232
+ color: #181848;
233
+ margin-left: 0;
234
+ padding: 0;
235
+ } #content div.method_block h1, #content #description h1 {
236
+ margin-left: 6px;
237
+ color: #ccd5dc;
238
+ } div.method_block a.small { /* where is this used? */
239
+ font-size: 3px;
240
+ line-height: 3px;
241
+ }
242
+
243
+ /* index includes on the navigation bar */
244
+
245
+ div.index a {
246
+ font-size: 13px;
247
+ } #method {
248
+ display: none;
249
+ } #file, #class {
250
+ display: block;
251
+ } div.list_header {
252
+ float: left;
253
+ } div.list_header_link {
254
+ float: right;
255
+ padding-top: 3px;
256
+ } div.list_header_link a {
257
+ font-weight: normal;
258
+ } div.navigation h3, .list_header_link {
259
+ margin: 0;
260
+ margin-top: 6px;
261
+ margin-bottom: 6px;
262
+ padding: 0;
263
+ }
264
+
265
+ .index label {
266
+ font-size: 13px;
267
+ } .index form input {
268
+ width: 136px;
269
+ } .index form {
270
+ margin-bottom: 6px;
271
+ }
272
+
273
+ ol, ul {
274
+ margin-left: 6px;
275
+ }
276
+
277
+ p.source_link a {
278
+ text-align: right;
279
+ font-weight: normal;
280
+ } div.source {
281
+ display: none;
282
+ } pre, tt {
283
+ color: #181848;
284
+ font-weight: normal;
285
+ font-family: Courier, Courier New, monospace;
286
+ font-size: 12px;
287
+ } pre {
288
+ line-height: 14px;
289
+ margin-left: 12px;
290
+ overflow: auto;
291
+ /* next 4 lines because IE sucks */
292
+ _position: relative;
293
+ _width: 587px;
294
+ _overflow-x:scroll;
295
+ _overflow-y:visible;
296
+ } b tt, tt b {
297
+ font-weight: bold;
298
+ } div.source g {
299
+ margin-left: 0;
300
+ } p.source_link {
301
+ text-align: center;
302
+ }
303
+
304
+ /* source code highlighting */
305
+
306
+ .source pre {
307
+ color: black;
308
+ }
309
+ pre .ruby-value, pre .ruby-symbol {
310
+ color: #1104bb;
311
+ } pre .ruby-value.str, pre .ruby-node {
312
+ color: #181848;
313
+ } pre .ruby-ivar, pre .ruby-cvar {
314
+ } pre .ruby-comment {
315
+ color: #009500;
316
+ } pre .ruby-constant {
317
+ color: #cd8802;
318
+ } pre .ruby-keyword {
319
+ color: #8d04aa;
320
+ }
@@ -0,0 +1,248 @@
1
+ =begin
2
+ locale.rb - Locale module
3
+
4
+ Copyright (C) 2002-2008 Masao Mutoh
5
+
6
+ You may redistribute it and/or modify it under the same
7
+ license terms as Ruby.
8
+
9
+ Original: Ruby-GetText-Package-1.92.0.
10
+
11
+ $Id: locale.rb 27 2008-12-03 15:06:50Z mutoh $
12
+ =end
13
+
14
+ require 'locale/util/memoizable'
15
+ require 'locale/tag'
16
+ require 'locale/taglist'
17
+ require 'locale/version'
18
+
19
+ # Locale module manages the locale informations of the application.
20
+ module Locale
21
+ @@default_tag = nil
22
+ @@locale_driver_module = nil
23
+
24
+ include Locale::Util::Memoizable
25
+
26
+ module_function
27
+ # Initialize Locale library.
28
+ # Usually, you don't need to call this directly, because
29
+ # this is called when Locale's methods are called.
30
+ # If you need to specify the option, call this once first.
31
+ # (But Almost of all case, you don't need this, because the
32
+ # framework/library such as gettext calls this.)
33
+ #
34
+ # If you use this library with CGI(and not use frameworks/gettext),
35
+ # You need to call Locale.init(:driver => :cgi).
36
+ #
37
+ # * opts: Options as a Hash.
38
+ # * :driver - The driver. :cgi if you use Locale module with CGI,
39
+ # nil if you use system locale.
40
+ # (ex) Locale.init(:driver => :cgi)
41
+ #
42
+ def init(opts = {})
43
+ if opts[:driver]
44
+ require "locale/driver/#{opts[:driver]}"
45
+ else
46
+ if /cygwin|mingw|win32/ =~ RUBY_PLATFORM
47
+ require 'locale/driver/win32'
48
+ elsif /java/ =~ RUBY_PLATFORM
49
+ require 'locale/driver/jruby'
50
+ else
51
+ require 'locale/driver/posix'
52
+ end
53
+ end
54
+ end
55
+
56
+ # Gets the driver module.
57
+ #
58
+ # Usually you don't need to call this method.
59
+ #
60
+ # * Returns: the driver module.
61
+ def driver_module
62
+ unless @@locale_driver_module
63
+ Locale.init
64
+ end
65
+ @@locale_driver_module
66
+ end
67
+
68
+ # Sets the default locale as the language tag
69
+ # (Locale::Tag's class or String(such as "ja_JP")).
70
+ #
71
+ # * tag: the default language_tag
72
+ # * Returns: self.
73
+ def set_default(tag)
74
+ default_tag = nil
75
+ Thread.list.each do |thread|
76
+ thread[:current_languages] = nil
77
+ thread[:candidates_caches] = {}
78
+ end
79
+
80
+ if tag
81
+ if tag.kind_of? Locale::Tag::Simple
82
+ default_tag = tag
83
+ else
84
+ default_tag = Locale::Tag.parse(tag)
85
+ end
86
+ end
87
+ @@default_tag = default_tag
88
+ self
89
+ end
90
+
91
+ # Same as Locale.set_default.
92
+ #
93
+ # * locale: the default locale (Locale::Tag's class) or a String such as "ja-JP".
94
+ # * Returns: locale.
95
+ def default=(tag)
96
+ set_default(tag)
97
+ @@default_tag
98
+ end
99
+
100
+ # Gets the default locale(language tag).
101
+ #
102
+ # If the default language tag is not set, this returns nil.
103
+ #
104
+ # * Returns: the default locale (Locale::Tag's class).
105
+ def default
106
+ @@default_tag
107
+ end
108
+
109
+ # Sets the locales of the current thread order by the priority.
110
+ # Each thread has a current locales.
111
+ # The default locale/system locale is used if the thread doesn't have current locales.
112
+ #
113
+ # * tag: Locale::Language::Tag's class or the language tag as a String. nil if you need to
114
+ # clear current locales.
115
+ # * charset: the charset (override the charset even if the locale name has charset) or nil.
116
+ # * Returns: self
117
+ #
118
+ # Locale.set_current("ja_JP.eucJP")
119
+ # Locale.set_current("ja-JP")
120
+ # Locale.set_current("en_AU", "en_US", ...)
121
+ # Locale.set_current(Locale::Tag::Simple.new("ja", "JP"), ...)
122
+ def set_current(*tags)
123
+ languages = nil
124
+ if tags[0]
125
+ languages = Locale::TagList.new
126
+ tags.each do |tag|
127
+ if tag.kind_of? Locale::Tag::Simple
128
+ languages << tag
129
+ else
130
+ languages << Locale::Tag.parse(tag)
131
+ end
132
+ end
133
+ end
134
+ Thread.current[:current_languages] = languages
135
+ Thread.current[:candidates_caches] = {}
136
+ self
137
+ end
138
+
139
+ # Sets a current locale. This is a single argument version of Locale.set_current.
140
+ #
141
+ # * tag: the language tag such as "ja-JP"
142
+ # * Returns: an Array of the current locale (Locale::Tag's class).
143
+ #
144
+ # Locale.current = "ja-JP"
145
+ # Locale.current = "ja_JP.eucJP"
146
+ def current=(tag)
147
+ set_current(tag)
148
+ Thread.current[:current_languages]
149
+ end
150
+
151
+ # Gets the current locales (Locale::Tag's class).
152
+ #
153
+ # If the current locale is not set, this returns default/system locale.
154
+ # * Returns: an Array of the current locales (Locale::Tag's class).
155
+ def current
156
+ Thread.current[:current_languages] ||= (default ? Locale::TagList.new([default]) : driver_module.locales)
157
+ Thread.current[:current_languages]
158
+ end
159
+
160
+ # Deprecated.
161
+ def get #:nodoc:
162
+ current
163
+ end
164
+
165
+ # Deprecated.
166
+ def set(tag) #:nodoc:
167
+ set_current(tag)
168
+ end
169
+
170
+ # Returns the language tags which are variations of the current locales order by priority.
171
+ # For example, if the current locales are ["fr", "ja_JP", "en_US", "en-Latn-GB-VARIANT"],
172
+ # then returns ["fr", "ja_JP", "en_US", "en-Latn-GB-VARIANT", "en_Latn_GB", "en_GB", "ja", "en"].
173
+ # "en" is the default locale. It's added at the end of the list even if it isn't exist.
174
+ # Usually, this method is used to find the locale data as the path(or a kind of IDs).
175
+ # * options: options as a Hash or nil.
176
+ # * :supported_language_tags: an Array of the language tags order by the priority. This option
177
+ # filters the locales which are supported by the library/application.
178
+ # Default is nil if you don't need to filter the locales.
179
+ # * (e.g.1) ["fr_FR", "en_GB", "en_US", ...], (e.g.2) ["fr-FR", "en-GB", "en-US", ...]
180
+ # * :type: the type of language tag. :common, :rfc, :cldr, :posix and
181
+ # :simple are available. Default value is :common
182
+ # * :default_language_tags: the default languages as an Array. Default value is ["en"].
183
+ def candidates(options = {})
184
+ opts = {:supported_language_tags => nil, :type => :common,
185
+ :default_language_tags => ["en"]}.merge(options)
186
+
187
+ cache_key = opts.hash
188
+ if Thread.current[:candidates_caches]
189
+ cache = Thread.current[:candidates_caches][cache_key]
190
+ return cache if cache
191
+ else
192
+ Thread.current[:candidates_caches] = {}
193
+ end
194
+
195
+ default_language_tags = opts[:default_language_tags].collect{|v|
196
+ Locale::Tag.parse(v).send("to_#{opts[:type]}")}.flatten.uniq
197
+
198
+ candidate_tags = current.collect{|v| v.send("to_#{opts[:type]}").candidates}
199
+
200
+ tags = []
201
+ (0...candidate_tags[0].size).each {|i|
202
+ tags += candidate_tags.collect{|v| v[i]}
203
+ }
204
+ tags += default_language_tags
205
+ tags.uniq!
206
+
207
+ if opts[:supported_language_tags]
208
+ tags &= opts[:supported_language_tags].collect{|v|
209
+ Locale::Tag.parse(v).send("to_#{opts[:type]}")}.flatten
210
+ tags += default_language_tags if tags.size == 0
211
+ end
212
+ tags = Locale::TagList.new(tags)
213
+ Thread.current[:candidates_caches][cache_key] = tags
214
+ tags
215
+ end
216
+
217
+
218
+ # Gets the current charset.
219
+ #
220
+ # This returns the current user/system charset. This value is
221
+ # read only, so you can't set it by yourself.
222
+ #
223
+ # * Returns: the current charset.
224
+ def charset
225
+ driver_module.charset
226
+ end
227
+ memoize :charset
228
+
229
+ # Clear current locale and current charset.
230
+ # * Returns: self
231
+ def clear
232
+ Thread.current[:current_languages] = nil
233
+ Thread.current[:candidates_caches] = {}
234
+ self
235
+ end
236
+
237
+ # Clear all locales and charsets of all threads.
238
+ # This doesn't clear the default locale.
239
+ # Use Locale.default = nil to unset the default locale.
240
+ # * Returns: self
241
+ def clear_all
242
+ Thread.list.each do |thread|
243
+ thread[:current_languages] = nil
244
+ thread[:candidates_caches] = {}
245
+ end
246
+ self
247
+ end
248
+ end