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
data/COPYING ADDED
@@ -0,0 +1,55 @@
1
+ You can redistribute this program and/or modify it under either the terms of
2
+ the LGPL (see the file LGPL), or the conditions below:
3
+
4
+ 1. You may make and give away verbatim copies of the source form of the
5
+ software without restriction, provided that you duplicate all of the
6
+ original copyright notices and associated disclaimers.
7
+
8
+ 2. You may modify your copy of the software in any way, provided that
9
+ you do at least ONE of the following:
10
+
11
+ a) place your modifications in the Public Domain or otherwise
12
+ make them Freely Available, such as by posting said
13
+ modifications to Usenet or an equivalent medium, or by allowing
14
+ the author to include your modifications in the software.
15
+
16
+ b) use the modified software only within your corporation or
17
+ organization.
18
+
19
+ c) rename any non-standard executables so the names do not conflict
20
+ with standard executables, which must also be provided.
21
+
22
+ d) make other distribution arrangements with the author.
23
+
24
+ 3. You may distribute the software in object code or executable
25
+ form, provided that you do at least ONE of the following:
26
+
27
+ a) distribute the executables and library files of the software,
28
+ together with instructions (in the manual page or equivalent)
29
+ on where to get the original distribution.
30
+
31
+ b) accompany the distribution with the machine-readable source of
32
+ the software.
33
+
34
+ c) give non-standard executables non-standard names, with
35
+ instructions on where to get the original software distribution.
36
+
37
+ d) make other distribution arrangements with the author.
38
+
39
+ 4. You may modify and include the part of the software into any other
40
+ software (possibly commercial). But some files in the distribution
41
+ are not written by the author, so that they are not under these terms.
42
+
43
+ For the list of those files and their copying conditions, see the
44
+ file LEGAL.
45
+
46
+ 5. The scripts and library files supplied as input to or produced as
47
+ output from the software do not automatically fall under the
48
+ copyright of the software, but belong to whomever generated them,
49
+ and may be sold commercially, and may be aggregated with this
50
+ software.
51
+
52
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
53
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
54
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
55
+ PURPOSE.
@@ -0,0 +1,113 @@
1
+ 2008-12-04 Masao Mutoh <mutoh@highway.ne.jp>
2
+
3
+ * lib/locale/util/memoizable.rb: Modified.
4
+
5
+ 2008-12-03 Masao Mutoh <mutoh@highway.ne.jp>
6
+
7
+ * lib/locale/tag/*.rb: Add attribute writer to subtags.
8
+ * lib/locale/tag/*.rb: Remove tag attributes.
9
+ * lib/locale/tag/common.rb: Variant accept 3 or later size because of RFC3066 compatibility.
10
+ * test/test_tag.rb: Add tests.
11
+
12
+ 2008-12-01 Masao Mutoh <mutoh@highway.ne.jp>
13
+
14
+ * lib/locale/driver/win32.rb: Work on Win32 again.
15
+
16
+ 2008-11-22 Masao Mutoh <mutoh@highway.ne.jp>
17
+
18
+ * lib/locale.rb: Rename Locale.current_language_tags to Locale.candidates.
19
+ Locale.current_charset to Locale.charset.
20
+
21
+ 2008-11-21 Masao Mutoh <mutoh@highway.ne.jp>
22
+
23
+ * lib/locale/tag/simple.rb: Add Locale::Tag::Simple#to_str.
24
+ * lib/locale.rb: Remove set_current_charset. current_charset becomes read only.
25
+
26
+ 2008-11-20 Masao Mutoh <mutoh@highway.ne.jp>
27
+
28
+ * lib/locale/driver/cgi.rb: Accept plural lang values(query string and
29
+ cookies).
30
+
31
+ 2008-11-19 Masao Mutoh <mutoh@highway.ne.jp>
32
+
33
+ * lib/locale.rb: Locale.current_language_tags returns Locale::TagList.
34
+ * lib/tag/*.rb: Add #candidates method.
35
+
36
+ 2008-11-12 Masao Mutoh <mutoh@highway.ne.jp>
37
+
38
+ * lib/locale/util/meoizable.rb: Added.
39
+
40
+ 2008-11-03 Masao Mutoh <mutoh@highway.ne.jp>
41
+
42
+ * README: Updated.
43
+ * Rakefile: Add package tasks. Revise RDoc task.
44
+ * lib/locale/driver/win32.rb, win32_table.rb, jruby.rb: Work on Windows.
45
+
46
+ 2008-10-29 Masao Mutoh <mutoh@highway.ne.jp>
47
+
48
+ * samples/cgi/*.rb: Added CGI sample (Based on Ruby-GetText sample).
49
+
50
+ 2008-10-21 Masao Mutoh <mutoh@highway.ne.jp>
51
+
52
+ * samples/sample1.rb: Added.
53
+
54
+ 2008-10-07 Masao Mutoh <mutoh@highway.ne.jp>
55
+
56
+ * lib/locale/*.rb: Support Ruby 1.9.
57
+
58
+ 2008-10-01 Masao Mutoh <mutoh@highway.ne.jp>
59
+
60
+ * lib/locale/*.rb: Support JRuby. Tested on JRuby 1.1.4.
61
+
62
+ 2008-09-26 Masao Mutoh <mutoh@highway.ne.jp>
63
+
64
+ * lib/locale/driver/*: Apply tags.
65
+ * lib/locale/taglist.rb: Added. An array of tags. Also, it behaves
66
+ as the first tag in the array.
67
+ * test/test_detect_general.rb: Added.
68
+
69
+ 2008-09-25 Masao Mutoh <mutoh@highway.ne.jp>
70
+
71
+ * lib/locale/tag.rb, lib/locale/tag/*: Added. Support rfc4646/posix/cldr
72
+ language tags powerfully.
73
+ * lib/locale/object.rb: Removed(Moved to tags).
74
+ * test/test_tag.rb: Added.
75
+
76
+ 2008-09-21 Masao Mutoh <mutoh@highway.ne.jp>
77
+
78
+ * test/*: Added.
79
+
80
+ 2008-09-02 Masao Mutoh <mutoh@highway.ne.jp>
81
+
82
+ * lib/locale.rb: Added Locale.current_language_tags which returns
83
+ language tags strings as an Array order by priority.
84
+
85
+ 2008-08-20 Masao Mutoh <mutoh@highway.ne.jp>
86
+
87
+ * lib/locale/info/language.rb, region.rb: Move from
88
+ lib/locale/language.rb, country.rb.
89
+
90
+ 2008-08-18 Masao Mutoh <mutoh@highway.ne.jp>
91
+
92
+ * lib/locale.rb: Remove Locale.codeset, .charset, .current_charset.
93
+ Use Locale.get.charset instead.
94
+ Add Locale.current_preferable_locales, supported_locales,
95
+ .set_supported_locales
96
+
97
+ 2008-08-10 Masao Mutoh <mutoh@highway.ne.jp>
98
+
99
+ * Separates this locale library from Ruby-GetText-Package-1.92.0.
100
+ * lib/locale/country.rb, language.rb: Merge locale-0.1 by Brian Pontarelli.
101
+ Reimplement Locale::Language and Locale::Country. All APIs don't have
102
+ backward compatibility from locale-0.1.
103
+ * lib/locale/data/countries.tab.gz, languages.tab.gz: Merge from locale-0.1.
104
+ * lib/locale/base.rb, win32.rb, win32_table.rb, posix.rb, jruby.rb, cgi.rb:
105
+ Move to lib/locale/driver/.
106
+ These classes detect the user/system locale (the language tag or
107
+ the charset) from the environment variables or the system APIs
108
+ (Win32/Java). Support POSIX, Win32, JRuby, CGI and ENV.
109
+
110
+ * lib/locale.rb: Add Locale.init.
111
+ * lib/locale/info.rb: Added.
112
+ * lib/locale.rb: Locale.set_current becomes thread safe. Each thread has
113
+ a current locale.
data/README ADDED
@@ -0,0 +1,100 @@
1
+ = Ruby-Locale
2
+
3
+ Ruby-Locale is the pure ruby library which provides basic and general purpose
4
+ APIs for localization.
5
+
6
+ * Manage Locale ID(Language Tag)
7
+ * Each thread has a Locale ID.
8
+ * POSIX, CLDR, IETF(RFC4646, 3066(BCP47)), Win32 and Java language tags
9
+ and convert the tag string to each other.
10
+ * Auto detect Locale ID.
11
+ POSIX(Unix/Linux/*BSD), Win32, JRuby, CGI.
12
+
13
+ * Resources
14
+ * ISO 639-3 languages
15
+ * ISO 3166 region(countries).
16
+
17
+ * Support Ruby 1.8.7, Ruby 1.9.1, JRuby 1.1.4. Tested on Win32 and Linux.
18
+
19
+ == Website
20
+ * http://www.yotabanana.com/hiki/ruby-locale.html
21
+ * http://locale.rubyforge.org/
22
+
23
+ == Requirements
24
+ * Ruby-1.8.7 or later <http://www.ruby-lang.org/ja/>
25
+ * JRuby-1.1.4 or later <http://jruby.codehaus.org/>
26
+
27
+ == Install
28
+ * gem:
29
+ ($ su)
30
+ # gem install locale
31
+
32
+ * tar-ball:
33
+ Download tar-ball from http://rubyforge.org/projects/locale/
34
+ De-Compress archive and enter its top directory.
35
+ Then type:
36
+ ($ su)
37
+ # ruby setup.rb
38
+
39
+ == The simplest usage
40
+
41
+ require 'rubygems'
42
+ require 'locale'
43
+
44
+ p Locale.current
45
+
46
+ == License
47
+ This program is licenced under the same licence as Ruby.
48
+ (See the file 'COPYING'.)
49
+
50
+ * locale/language.rb, locale/region.rb,
51
+ locale/data/language.tab.gz, locale/data/region.tab.gz:
52
+ * Copyright (C) 2006 Antonio Terceiro
53
+ * Copyright (C) 2008 Masao Mutoh <mutoh at highway.ne.jp>
54
+
55
+ * setup.rb version 3.4.1
56
+ * Copyright (C) 2000-2005 Minero Aoki <aamine at loveruby.net>
57
+ * This file is released under LGPL. See the top of the setup.rb.
58
+
59
+ * Others(Some files are separated from Ruby-GetText-Package-1.92.0)
60
+ * Copyright (C) 2008 Masao Mutoh <mutoh at highwhay.ne.jp>
61
+
62
+ == References
63
+ === Other libraries
64
+ * langtag-0.1.0
65
+ by Martin Dürst <http://rubyforge.org/projects/langtag/>
66
+
67
+ * memoizable.rb
68
+ from ActiveSupport-2.2.0 <http://rubyforge.org/projects/activesupport/>
69
+
70
+ * Ruby-GetText-Package-1.92.0
71
+ by Masao Mutoh <http://www.yotabanana.com/hiki/ruby-gettext.html>
72
+
73
+ === Documents
74
+ * The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 Edition
75
+ Internationalization Variables
76
+ <http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html>
77
+
78
+ * GNU `gettext' utilities - Setting the Locale through Environment Variables
79
+ <http://www.gnu.org/software/gettext/manual/gettext.html#Setting-the-POSIX-Locale>
80
+
81
+ * BCP47 / RFC4646, RFC3066 - Tags for Identifying Languages (Keep RFC3066 compatibility)
82
+ <http://www.ietf.org/rfc/rfc4646.txt>
83
+ <http://www.ietf.org/rfc/rfc3066.txt>
84
+
85
+ * Unicode Locale Data Markup Language (LDML) 1.6.1
86
+ Unicode Language and Locale Identifiers
87
+ <http://www.unicode.org/reports/tr35/tr35-11.html#Unicode_Language_and_Locale_Identifiers>
88
+
89
+ * JDK 6 Documentation - Java Supported Locales
90
+ <http://java.sun.com/javase/6/docs/technotes/guides/intl/locale.doc.html>
91
+
92
+ * Microsoft Developer Network - Locales and Languages
93
+ <http://msdn.microsoft.com/en-us/library/ms776264(VS.85).aspx>
94
+
95
+ * ISO 639
96
+
97
+ * ISO 3166
98
+
99
+ == Maintainer
100
+ Masao Mutoh <mutoh at highway.ne.jp>
@@ -0,0 +1,77 @@
1
+ $:.unshift "./lib"
2
+
3
+ require 'rake'
4
+ require 'rake/testtask'
5
+ require 'rake/rdoctask'
6
+ require 'rake/packagetask'
7
+ require 'rake/gempackagetask'
8
+
9
+ require 'locale/version'
10
+
11
+ desc "Default Task"
12
+ task :default => [ :test ]
13
+
14
+ PKG_VERSION = Locale::VERSION
15
+
16
+ # Run the unit tests
17
+ task :test do
18
+ Dir.glob("test/test_*.rb").each do |v|
19
+ ruby "-Ilib #{v}"
20
+ end
21
+ end
22
+
23
+ Rake::RDocTask.new { |rdoc|
24
+ begin
25
+ allison = `allison --path`.chop
26
+ rescue Exception
27
+ allison = ""
28
+ end
29
+ rdoc.rdoc_dir = 'doc'
30
+ rdoc.title = "Ruby-Locale library"
31
+ rdoc.options << '--line-numbers' << '--inline-source'
32
+ rdoc.rdoc_files.include('README', 'ChangeLog')
33
+ rdoc.rdoc_files.include('lib/**/*.rb')
34
+ rdoc.template = allison if allison.size > 0
35
+ }
36
+
37
+ desc "Create gem and tar.gz"
38
+ spec = Gem::Specification.new do |s|
39
+ s.name = 'locale'
40
+ s.version = PKG_VERSION
41
+ s.summary = 'Ruby-Locale is the pure ruby library which provides basic APIs for localization.'
42
+ s.author = 'Masao Mutoh'
43
+ s.email = 'mutoh@highway.ne.jp'
44
+ s.homepage = 'http://locale.rubyforge.org/'
45
+ s.rubyforge_project = "locale"
46
+ s.files = FileList['**/*'].to_a.select{|v| v !~ /pkg|CVS/}
47
+ s.require_path = 'lib'
48
+ s.bindir = 'bin'
49
+ s.has_rdoc = true
50
+ s.description = <<-EOF
51
+ Ruby-Locale is the pure ruby library which provides basic APIs for localization.
52
+ EOF
53
+ end
54
+
55
+ Rake::PackageTask.new("ruby-locale", PKG_VERSION) do |o|
56
+ o.package_files = FileList['**/*'].to_a.select{|v| v !~ /pkg|CVS/}
57
+ o.need_tar_gz = true
58
+ o.need_zip = false
59
+ end
60
+
61
+ Rake::GemPackageTask.new(spec) do |p|
62
+ p.gem_spec = spec
63
+ p.need_tar_gz = false
64
+ p.need_zip = false
65
+ end
66
+
67
+ desc "Publish the release files to RubyForge."
68
+ task :release => [ :package ] do
69
+ require 'rubyforge'
70
+
71
+ rubyforge = RubyForge.new
72
+ rubyforge.login
73
+ rubyforge.add_release("locale", "locale",
74
+ "Ruby-Locale #{PKG_VERSION}",
75
+ "pkg/locale-#{PKG_VERSION}.gem",
76
+ "pkg/ruby-locale-#{PKG_VERSION}.tar.gz")
77
+ end
@@ -0,0 +1,375 @@
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>Module: Locale::Driver</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::Driver
320
+ </h1></span>
321
+ </div><div class="clear"></div><div id="left">
322
+
323
+ <div class="navigation darker top" id="defined_in"><h3>Defined in</h3>
324
+
325
+ <a href="../../files/lib/locale/driver/env_rb.html">lib/locale/driver/env.rb</a>
326
+
327
+
328
+ <a href="../../files/lib/locale/driver/jruby_rb.html">lib/locale/driver/jruby.rb</a>
329
+
330
+
331
+ <a href="../../files/lib/locale/driver/posix_rb.html">lib/locale/driver/posix.rb</a>
332
+
333
+
334
+ <a href="../../files/lib/locale/driver/win32_table_rb.html">lib/locale/driver/win32_table.rb</a>
335
+
336
+
337
+ <a href="../../files/lib/locale/driver/win32_rb.html">lib/locale/driver/win32.rb</a>
338
+
339
+
340
+ <a href="../../files/lib/locale/driver/cgi_rb.html">lib/locale/driver/cgi.rb</a>
341
+
342
+ </div>
343
+
344
+
345
+
346
+ <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 onclick="toggle('class'); toggleText('class_link'); return false;" href="#" id="class_link">Hide...</a></div><div class="clear"></div><div id="class"><form><label for="filter_class">Filter:&nbsp;&nbsp;</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 onclick="toggle('file'); toggleText('file_link'); return false;" href="#" id="file_link">Hide...</a></div><div class="clear"></div><div id="file"><form><label for="filter_file">Filter:&nbsp;&nbsp;</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 onclick="toggle('method'); toggleText('method_link'); return false;" href="#" id="method_link">Show...</a></div><div class="clear"></div><div id="method"><form><label for="filter_method">Filter:&nbsp;&nbsp;</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">
347
+ <h1 id="item_name">Module: Locale::Driver</h1>
348
+
349
+ <div id="description"><p>
350
+ <a href="Driver.html">Locale::Driver</a> module for <a
351
+ href="Driver/CGI.html">CGI</a>. Detect the user locales and the charset
352
+ from <a href="Driver/CGI.html">CGI</a> parameters. This is a low-level
353
+ class. Application shouldn&#8216;t use this directly.
354
+ </p>
355
+ </div>
356
+
357
+
358
+
359
+
360
+ <p></p>
361
+
362
+ <h1>Child modules and classes</h1><p>Module <a href="Driver/CGI.html" class="link">Locale::Driver::CGI</a><br />
363
+ Module <a href="Driver/Env.html" class="link">Locale::Driver::Env</a><br />
364
+ Module <a href="Driver/JRuby.html" class="link">Locale::Driver::JRuby</a><br />
365
+ Module <a href="Driver/Posix.html" class="link">Locale::Driver::Posix</a><br />
366
+ Module <a href="Driver/Win32.html" class="link">Locale::Driver::Win32</a><br />
367
+ Module <a href="Driver/Win32Table.html" class="link">Locale::Driver::Win32Table</a><br />
368
+ </p>
369
+
370
+
371
+
372
+
373
+
374
+
375
+ </div><div class="clear" id="footer">Generated on Jan 21, 2008 / Allison 2 &copy; 2007 <a href="http://cloudbur.st">Cloudburst, LLC</a></div></div></body></html>