gettext 1.10.0 → 1.90.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.
- data/ChangeLog +156 -2
- data/NEWS +28 -0
- data/README +128 -138
- data/Rakefile +83 -43
- data/data/locale/es/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/hu/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/hu/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ua/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ua/LC_MESSAGES/rgettext.mo +0 -0
- data/doc/classes/ActiveRecord/Base.html +360 -0
- data/doc/classes/ActiveRecord/ConnectionAdapters/Column.html +182 -0
- data/doc/classes/ActiveRecord/Migration.html +118 -0
- data/doc/classes/GetText.html +1790 -0
- data/doc/classes/GetText/ActiveRecordParser.html +236 -0
- data/doc/classes/GetText/Container.html +119 -0
- data/doc/classes/GetText/ErbContainer.html +223 -0
- data/doc/classes/GetText/ErbParser.html +156 -0
- data/doc/classes/GetText/GladeParser.html +133 -0
- data/doc/classes/GetText/NoboundTextDomainError.html +119 -0
- data/doc/classes/GetText/PoParser.html +169 -0
- data/doc/classes/GetText/Rails.html +293 -0
- data/doc/classes/GetText/RubyParser.html +123 -0
- data/doc/classes/GetText/TextDomain.html +572 -0
- data/doc/classes/GetText/TextDomainManager.html +443 -0
- data/doc/classes/Iconv.html +257 -0
- data/doc/classes/Iconv/Failure.html +105 -0
- data/doc/classes/Iconv/IllegalSequence.html +118 -0
- data/doc/classes/Iconv/InvalidCharacter.html +118 -0
- data/doc/classes/Iconv/InvalidEncoding.html +118 -0
- data/doc/classes/Locale.html +839 -0
- data/doc/classes/Locale/Object.html +799 -0
- data/doc/classes/Locale/SystemBase.html +271 -0
- data/doc/classes/Locale/SystemCGI.html +312 -0
- data/doc/classes/Locale/SystemJRuby.html +112 -0
- data/doc/classes/Locale/SystemPosix.html +113 -0
- data/doc/classes/Locale/SystemWin32.html +182 -0
- data/doc/classes/MOFile.html +678 -0
- data/doc/classes/MOFile/InvalidFormat.html +111 -0
- data/doc/classes/Module.html +158 -0
- data/doc/classes/String.html +225 -0
- data/doc/created.rid +1 -0
- data/doc/files/ChangeLog.html +2355 -0
- data/doc/files/README.html +510 -0
- data/doc/files/lib/gettext/active_record_rb.html +110 -0
- data/doc/files/lib/gettext/cgi_rb.html +110 -0
- data/doc/files/lib/gettext/container_rb.html +108 -0
- data/doc/files/lib/gettext/erb_rb.html +109 -0
- data/doc/files/lib/gettext/iconv_rb.html +109 -0
- data/doc/files/lib/gettext/mo_rb.html +108 -0
- data/doc/files/lib/gettext/parser/active_record_rb.html +119 -0
- data/doc/files/lib/gettext/parser/erb_rb.html +109 -0
- data/doc/files/lib/gettext/parser/glade_rb.html +109 -0
- data/doc/files/lib/gettext/parser/ruby_rb.html +110 -0
- data/doc/files/lib/gettext/poparser_rb.html +108 -0
- data/doc/files/lib/gettext/rails_compat_rb.html +108 -0
- data/doc/files/lib/gettext/rails_rb.html +112 -0
- data/doc/files/lib/gettext/rgettext_rb.html +110 -0
- data/doc/files/lib/gettext/rmsgfmt_rb.html +112 -0
- data/doc/files/lib/gettext/rmsgmerge_rb.html +112 -0
- data/doc/files/lib/gettext/string_rb.html +101 -0
- data/doc/files/lib/gettext/textdomain_rb.html +109 -0
- data/doc/files/lib/gettext/textdomainmanager_rb.html +109 -0
- data/doc/files/lib/gettext/utils_rb.html +111 -0
- data/doc/files/lib/gettext/version_rb.html +101 -0
- data/doc/files/lib/gettext_rb.html +113 -0
- data/doc/files/lib/locale/base_rb.html +101 -0
- data/doc/files/lib/locale/cgi_rb.html +108 -0
- data/doc/files/lib/locale/jruby_rb.html +110 -0
- data/doc/files/lib/locale/object_rb.html +101 -0
- data/doc/files/lib/locale/posix_rb.html +108 -0
- data/doc/files/lib/locale/win32_rb.html +110 -0
- data/doc/files/lib/locale/win32_table_rb.html +101 -0
- data/doc/files/lib/locale_rb.html +111 -0
- data/doc/fr_class_index.html +57 -0
- data/doc/fr_file_index.html +58 -0
- data/doc/fr_method_index.html +155 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/gettext.rb +102 -50
- data/lib/gettext/cgi.rb +2 -27
- data/lib/gettext/iconv.rb +76 -62
- data/lib/gettext/mo.rb +3 -3
- data/lib/gettext/parser/erb.rb +2 -2
- data/lib/gettext/rails.rb +69 -48
- data/lib/gettext/rgettext.rb +2 -2
- data/lib/gettext/rmsgmerge.rb +2 -2
- data/lib/gettext/string.rb +9 -5
- data/lib/gettext/textdomain.rb +3 -3
- data/lib/gettext/textdomainmanager.rb +5 -5
- data/lib/gettext/utils.rb +4 -3
- data/lib/gettext/version.rb +1 -1
- data/lib/{gettext/locale.rb → locale.rb} +11 -58
- data/lib/locale/base.rb +60 -0
- data/lib/{gettext/locale_cgi.rb → locale/cgi.rb} +30 -28
- data/lib/locale/jruby.rb +36 -0
- data/lib/{gettext/locale_object.rb → locale/object.rb} +78 -24
- data/lib/locale/posix.rb +22 -0
- data/lib/locale/win32.rb +48 -0
- data/lib/{gettext/locale_table_win32.rb → locale/win32_table.rb} +3 -2
- data/po/es/rails.po +1 -2
- data/po/hu/rails.po +139 -0
- data/po/hu/rgettext.po +126 -0
- data/po/ja/rails.po +5 -5
- data/po/ua/rails.po +150 -0
- data/po/ua/rgettext.po +132 -0
- data/pre-setup.rb +2 -4
- data/samples/cgi/cookie.cgi +1 -0
- data/samples/cgi/helloerb1.cgi +6 -3
- data/samples/cgi/helloerb2.cgi +6 -3
- data/samples/cgi/http.rb +3 -7
- data/samples/cgi/index.cgi +2 -1
- data/samples/cgi/locale/hu/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/hu/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/hu/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/hu/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/ua/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/ua/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/ua/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/ua/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/po/hu/helloerb1.po +59 -0
- data/samples/cgi/po/hu/helloerb2.po +51 -0
- data/samples/cgi/po/hu/hellolib.po +23 -0
- data/samples/cgi/po/hu/main.po +82 -0
- data/samples/cgi/po/ua/helloerb1.po +62 -0
- data/samples/cgi/po/ua/helloerb2.po +54 -0
- data/samples/cgi/po/ua/hellolib.po +26 -0
- data/samples/cgi/po/ua/main.po +84 -0
- data/samples/locale/hu/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/hu/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/hu/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/hu/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/hu/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/hu/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/hu/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/locale/ua/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/ua/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/ua/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/ua/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/ua/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/ua/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/ua/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/po/hu/hello.po +22 -0
- data/samples/po/hu/hello2.po +30 -0
- data/samples/po/hu/hello_noop.po +26 -0
- data/samples/po/hu/hello_plural.po +25 -0
- data/samples/po/hu/helloglade2.po +31 -0
- data/samples/po/hu/hellogtk.po +22 -0
- data/samples/po/hu/hellotk.po +23 -0
- data/samples/po/ua/hello.po +22 -0
- data/samples/po/ua/hello2.po +30 -0
- data/samples/po/ua/hello_noop.po +26 -0
- data/samples/po/ua/hello_plural.po +29 -0
- data/samples/po/ua/helloglade2.po +34 -0
- data/samples/po/ua/hellogtk.po +22 -0
- data/samples/po/ua/hellotk.po +26 -0
- data/samples/rails/README +15 -31
- data/samples/rails/Rakefile +1 -1
- data/samples/rails/app/controllers/application.rb +11 -4
- data/samples/rails/app/controllers/articles_controller.rb +96 -0
- data/samples/rails/app/helpers/application_helper.rb +1 -1
- data/samples/rails/app/helpers/{blog_helper.rb → articles_helper.rb} +6 -7
- data/samples/rails/app/views/articles/edit.html.erb +18 -0
- data/samples/rails/app/views/articles/index.html.erb +17 -0
- data/samples/rails/app/views/articles/new.html.erb +16 -0
- data/samples/rails/app/views/articles/show.html.erb +6 -0
- data/samples/rails/app/views/layouts/articles.html.erb +26 -0
- data/samples/rails/config/boot.rb +104 -13
- data/samples/rails/config/database.yml +24 -21
- data/samples/rails/config/environment.rb +35 -30
- data/samples/rails/config/environments/development.rb +5 -6
- data/samples/rails/config/environments/production.rb +2 -3
- data/samples/rails/config/environments/test.rb +5 -2
- data/samples/rails/config/initializers/inflections.rb +10 -0
- data/samples/rails/config/initializers/mime_types.rb +5 -0
- data/samples/rails/config/routes.rb +30 -11
- data/samples/rails/db/migrate/001_create_articles.rb +14 -0
- data/samples/rails/db/schema.rb +16 -5
- data/samples/rails/lib/tasks/gettext.rake +2 -2
- data/samples/rails/locale/bs/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/ca/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/cs/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/de/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/el/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/en/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/eo/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/es/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/fr/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/hr/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/hu/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/it/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/ja/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/ko/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/nb/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/nl/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/pt_BR/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/ru/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/ua/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/vi/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/zh/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/zh_TW/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/po/blog.pot +24 -24
- data/samples/rails/po/bs/blog.po +29 -29
- data/samples/rails/po/ca/blog.po +27 -27
- data/samples/rails/po/cs/blog.po +27 -27
- data/samples/rails/po/de/blog.po +27 -27
- data/samples/rails/po/el/blog.po +27 -27
- data/samples/rails/po/en/blog.po +24 -24
- data/samples/rails/po/eo/blog.po +27 -27
- data/samples/rails/po/es/blog.po +27 -27
- data/samples/rails/po/fr/blog.po +27 -27
- data/samples/rails/po/hr/blog.po +29 -29
- data/samples/rails/po/hu/blog.po +105 -0
- data/samples/rails/po/it/blog.po +27 -27
- data/samples/rails/po/ja/blog.po +27 -27
- data/samples/rails/po/ko/blog.po +27 -27
- data/samples/rails/po/nb/blog.po +26 -27
- data/samples/rails/po/nl/blog.po +27 -27
- data/samples/rails/po/pt_BR/blog.po +27 -27
- data/samples/rails/po/ru/blog.po +27 -27
- data/samples/rails/po/ua/blog.po +108 -0
- data/samples/rails/po/vi/blog.po +26 -31
- data/samples/rails/po/zh/blog.po +27 -27
- data/samples/rails/po/zh_TW/blog.po +27 -27
- data/samples/rails/public/404.html +27 -5
- data/samples/rails/public/422.html +30 -0
- data/samples/rails/public/500.html +27 -5
- data/samples/rails/public/index.html +6 -6
- data/samples/rails/public/javascripts/application.js +2 -0
- data/samples/rails/public/javascripts/controls.js +532 -319
- data/samples/rails/public/javascripts/dragdrop.js +521 -133
- data/samples/rails/public/javascripts/effects.js +708 -442
- data/samples/rails/public/javascripts/prototype.js +3393 -953
- data/samples/rails/public/stylesheets/blog.css +4 -0
- data/samples/rails/public/stylesheets/scaffold.css +5 -5
- data/samples/rails/test/functional/articles_controller_test.rb +51 -0
- data/samples/rails/test/test_helper.rb +31 -19
- data/samples/rails/test/unit/article_test.rb +2 -9
- data/samples/rails/vendor/plugins/gettext/init.rb +5 -3
- data/samples/rails/vendor/plugins/gettext/lib/gettext_plugin.rb +9 -10
- data/samples/rails/vendor/plugins/gettext/locale/eo/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/vendor/plugins/gettext/locale/hu/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/vendor/plugins/gettext/locale/ua/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/vendor/plugins/gettext/po/eo/gettext_plugin.po +28 -0
- data/samples/rails/vendor/plugins/gettext/po/hu/gettext_plugin.po +27 -0
- data/samples/rails/vendor/plugins/gettext/po/ua/gettext_plugin.po +30 -0
- data/test/Rakefile +2 -1
- data/test/benchmark.rb +28 -0
- data/test/fixtures/topic.rb +15 -0
- data/test/rails/Rakefile +2 -1
- data/test/rails/app/controllers/articles_controller.rb +1 -1
- data/test/rails/app/controllers/users_controller.rb +10 -0
- data/test/rails/app/models/user.rb +2 -1
- data/test/rails/app/views/articles/{_form.rhtml → _form.html.erb} +0 -0
- data/test/rails/app/views/articles/active_form_error.html.erb +1 -0
- data/test/rails/app/views/articles/change_title_error_messages_for.html.erb +21 -0
- data/test/rails/app/views/articles/{edit.rhtml → edit.html.erb} +0 -0
- data/test/rails/app/views/articles/{list.rhtml → list.html.erb} +0 -3
- data/test/rails/app/views/articles/{list_fr.rhtml → list_fr.html.erb} +0 -0
- data/test/rails/app/views/articles/{multi_error_messages_for.rhtml → multi_error_messages_for.html.erb} +0 -0
- data/test/rails/app/views/articles/{new.rhtml → new.html.erb} +0 -0
- data/test/rails/app/views/articles/{show.rhtml → show.html.erb} +0 -0
- data/test/rails/app/views/layouts/{application.rhtml → application.html.erb} +0 -0
- data/test/rails/app/views/layouts/{mailer.rhtml → mailer.html.erb} +0 -0
- data/test/rails/app/views/layouts/users.html.erb +13 -0
- data/test/rails/app/views/users/custom_error_message.html.erb +13 -0
- data/test/rails/app/views/users/custom_error_message_fr.html.erb +13 -0
- data/test/rails/config/environment.rb +6 -1
- data/test/rails/config/environments/development.rb +0 -3
- data/test/rails/db/schema.rb +17 -10
- data/test/rails/locale/ja/LC_MESSAGES/rails_test.mo +0 -0
- data/test/rails/log/development.log +136 -29
- data/test/rails/log/test.log +2002 -128
- data/test/rails/po/ja/rails_test.po +68 -61
- data/test/rails/po/rails_test.pot +57 -55
- data/test/rails/test/fixtures/users.yml +5 -0
- data/test/rails/test/functional/articles_controller_test.rb +6 -1
- data/test/rails/test/functional/users_controller_test.rb +65 -0
- data/test/rails/test/result/en/custom_error_message.html +83 -0
- data/test/rails/test/result/en/custom_error_message_with_plural.html +83 -0
- data/test/rails/test/result/en/list.html +0 -3
- data/test/rails/test/result/en/multi_error_messages_for.html +1 -1
- data/test/rails/test/result/fr/custom_error_message.html +83 -0
- data/test/rails/test/result/fr/custom_error_message_with_plural.html +83 -0
- data/test/rails/test/result/ja/custom_error_message.html +83 -0
- data/test/rails/test/result/ja/custom_error_message_with_plural.html +83 -0
- data/test/rails/test/result/ja/list.html +0 -3
- data/test/rails/test/result/ja/multi_error_messages_for.html +1 -1
- data/test/test.sh +5 -7
- data/test/{gettext_test_active_record.rb → test_active_record.rb} +20 -10
- data/test/{gettext_test_cgi.rb → test_cgi.rb} +0 -0
- data/test/{gettext_test.rb → test_gettext.rb} +91 -9
- data/test/test_java.sh +12 -0
- data/test/{gettext_test_locale.rb → test_locale.rb} +3 -8
- data/test/{gettext_test_multi_textdomain.rb → test_multi_textdomain.rb} +2 -2
- data/test/{gettext_test_parser.rb → test_parser.rb} +77 -77
- data/test/{gettext_test_rails.rb → test_rails.rb} +0 -0
- data/test/{gettext_test_rails_caching.rb → test_rails_caching.rb} +16 -2
- data/test/{gettext_test_string.rb → test_string.rb} +1 -0
- data/test/{test_rubyparser_N.rb → testlib/N_.rb} +0 -0
- data/test/testlib/erb.rhtml +15 -0
- data/test/testlib/erb.rxml +16 -0
- data/test/{test_rubyparser.rb → testlib/gettext.rb} +0 -0
- data/test/testlib/gladeparser.glade +183 -0
- data/test/{test_rubyparser_n_.rb → testlib/ngettext.rb} +0 -0
- data/test/{test_nsgettext.rb → testlib/nsgettext.rb} +0 -0
- data/test/{test_sgettext.rb → testlib/sgettext.rb} +0 -0
- data/test/{testlib1.rb → testlib/testlib1.rb} +0 -0
- data/test/{testlib2.rb → testlib/testlib2.rb} +1 -1
- data/test/{testlib3.rb → testlib/testlib3.rb} +0 -0
- data/test/{testlib4.rb → testlib/testlib4.rb} +1 -1
- data/test/{testlib5.rb → testlib/testlib5.rb} +0 -0
- data/test/{testlib6.rb → testlib/testlib6.rb} +0 -0
- metadata +1374 -1171
- data/ext/gettext/extconf.rb +0 -20
- data/ext/gettext/locale_system.c +0 -83
- data/lib/gettext/locale_posix.rb +0 -82
- data/lib/gettext/locale_win32.rb +0 -82
- data/samples/cgi/ruby.bat +0 -4
- data/samples/rails/app/controllers/blog_controller.rb +0 -58
- data/samples/rails/app/views/blog/_form.rhtml +0 -25
- data/samples/rails/app/views/blog/edit.rhtml +0 -22
- data/samples/rails/app/views/blog/list.rhtml +0 -29
- data/samples/rails/app/views/blog/new.rhtml +0 -21
- data/samples/rails/app/views/blog/show.rhtml +0 -18
- data/samples/rails/app/views/layouts/blog.rhtml +0 -36
- data/samples/rails/test/functional/blog_controller_test.rb +0 -98
- data/test/gettext_runner.rb +0 -22
|
@@ -0,0 +1,799 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Class: Locale::Object</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Locale::Object</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/lib/locale/object_rb.html">
|
|
59
|
+
lib/locale/object.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
<a href="Object.html">
|
|
69
|
+
Object
|
|
70
|
+
</a>
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
</div>
|
|
75
|
+
<!-- banner header -->
|
|
76
|
+
|
|
77
|
+
<div id="bodyContent">
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<div id="contextContent">
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div id="method-list">
|
|
88
|
+
<h3 class="section-bar">Methods</h3>
|
|
89
|
+
|
|
90
|
+
<div class="name-list">
|
|
91
|
+
<a href="#M000108">charset=</a>
|
|
92
|
+
<a href="#M000114">clear</a>
|
|
93
|
+
<a href="#M000107">country=</a>
|
|
94
|
+
<a href="#M000106">language=</a>
|
|
95
|
+
<a href="#M000111">modifier=</a>
|
|
96
|
+
<a href="#M000113">new</a>
|
|
97
|
+
<a href="#M000112">parse</a>
|
|
98
|
+
<a href="#M000109">script=</a>
|
|
99
|
+
<a href="#M000119">to_a</a>
|
|
100
|
+
<a href="#M000118">to_general</a>
|
|
101
|
+
<a href="#M000116">to_iso3066</a>
|
|
102
|
+
<a href="#M000115">to_posix</a>
|
|
103
|
+
<a href="#M000120">to_s</a>
|
|
104
|
+
<a href="#M000121">to_str</a>
|
|
105
|
+
<a href="#M000117">to_win</a>
|
|
106
|
+
<a href="#M000110">variant=</a>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
<!-- if includes -->
|
|
114
|
+
|
|
115
|
+
<div id="section">
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
<div id="attribute-list">
|
|
122
|
+
<h3 class="section-bar">Attributes</h3>
|
|
123
|
+
|
|
124
|
+
<div class="name-list">
|
|
125
|
+
<table>
|
|
126
|
+
<tr class="top-aligned-row context-row">
|
|
127
|
+
<td class="context-item-name">charset</td>
|
|
128
|
+
<td class="context-item-value"> [R] </td>
|
|
129
|
+
<td class="context-item-desc"></td>
|
|
130
|
+
</tr>
|
|
131
|
+
<tr class="top-aligned-row context-row">
|
|
132
|
+
<td class="context-item-name">country</td>
|
|
133
|
+
<td class="context-item-value"> [R] </td>
|
|
134
|
+
<td class="context-item-desc"></td>
|
|
135
|
+
</tr>
|
|
136
|
+
<tr class="top-aligned-row context-row">
|
|
137
|
+
<td class="context-item-name">fallback</td>
|
|
138
|
+
<td class="context-item-value"> [RW] </td>
|
|
139
|
+
<td class="context-item-desc">
|
|
140
|
+
A fallback locale. With <a href="../GetText.html">GetText</a>, you
|
|
141
|
+
don‘t need to set English(en,C,POSIX) by yourself because English is
|
|
142
|
+
used as the last fallback locale anytime.
|
|
143
|
+
|
|
144
|
+
</td>
|
|
145
|
+
</tr>
|
|
146
|
+
<tr class="top-aligned-row context-row">
|
|
147
|
+
<td class="context-item-name">language</td>
|
|
148
|
+
<td class="context-item-value"> [R] </td>
|
|
149
|
+
<td class="context-item-desc"></td>
|
|
150
|
+
</tr>
|
|
151
|
+
<tr class="top-aligned-row context-row">
|
|
152
|
+
<td class="context-item-name">modifier</td>
|
|
153
|
+
<td class="context-item-value"> [R] </td>
|
|
154
|
+
<td class="context-item-desc"></td>
|
|
155
|
+
</tr>
|
|
156
|
+
<tr class="top-aligned-row context-row">
|
|
157
|
+
<td class="context-item-name">orig_str</td>
|
|
158
|
+
<td class="context-item-value"> [R] </td>
|
|
159
|
+
<td class="context-item-desc"></td>
|
|
160
|
+
</tr>
|
|
161
|
+
<tr class="top-aligned-row context-row">
|
|
162
|
+
<td class="context-item-name">script</td>
|
|
163
|
+
<td class="context-item-value"> [R] </td>
|
|
164
|
+
<td class="context-item-desc"></td>
|
|
165
|
+
</tr>
|
|
166
|
+
<tr class="top-aligned-row context-row">
|
|
167
|
+
<td class="context-item-name">variant</td>
|
|
168
|
+
<td class="context-item-value"> [R] </td>
|
|
169
|
+
<td class="context-item-desc"></td>
|
|
170
|
+
</tr>
|
|
171
|
+
</table>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
<!-- if method_list -->
|
|
178
|
+
<div id="methods">
|
|
179
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
180
|
+
|
|
181
|
+
<div id="method-M000113" class="method-detail">
|
|
182
|
+
<a name="M000113"></a>
|
|
183
|
+
|
|
184
|
+
<div class="method-heading">
|
|
185
|
+
<a href="#M000113" class="method-signature">
|
|
186
|
+
<span class="method-name">new</span><span class="method-args">(language_or_locale_name, country = nil, charset = nil)</span>
|
|
187
|
+
</a>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<div class="method-description">
|
|
191
|
+
<p>
|
|
192
|
+
Initialize <a href="Object.html">Locale::Object</a>.
|
|
193
|
+
</p>
|
|
194
|
+
<ul>
|
|
195
|
+
<li>language_or_locale_name: language(ISO 639) or POSIX or RFC3066 style locale
|
|
196
|
+
name
|
|
197
|
+
|
|
198
|
+
</li>
|
|
199
|
+
<li>country: an uppercase ISO 3166-1 country/region identifier, or nil
|
|
200
|
+
|
|
201
|
+
</li>
|
|
202
|
+
<li>charset: charset(codeset) (no standard), or nil
|
|
203
|
+
|
|
204
|
+
</li>
|
|
205
|
+
</ul>
|
|
206
|
+
<pre>
|
|
207
|
+
Locale::Object.new("ja", "JP", "eucJP")
|
|
208
|
+
-> language = "ja", country = "JP", charset = "eucJP".
|
|
209
|
+
Locale::Object.new("ja", "JP")
|
|
210
|
+
-> language = "ja", country = "JP", charset = nil.
|
|
211
|
+
Locale::Object.new("ja_JP.eucJP")
|
|
212
|
+
-> language = "ja", country = "JP", charset = "eucJP".
|
|
213
|
+
Locale::Object.new("ja_JP.eucJP", nil, "UTF-8")
|
|
214
|
+
-> language = "ja", country = "JP", charset = "UTF-8".
|
|
215
|
+
Locale::Object.new("en-US", "CA")
|
|
216
|
+
-> language = "en", country = "CA", charset = nil.
|
|
217
|
+
Locale::Object.new("uz-uz-latn")
|
|
218
|
+
-> language = "uz", country = "UZ", charset = nil, script = "Latn"
|
|
219
|
+
Locale::Object.new("uz_UZ_Latn")
|
|
220
|
+
-> language = "uz", country = "UZ", charset = nil, script = "Latn"
|
|
221
|
+
Locale::Object.new("we_BE.iso885915@euro")
|
|
222
|
+
-> language = "we", country = "BE", charset = "iso885915", modifier = "euroo".
|
|
223
|
+
Locale::Object.new("C")
|
|
224
|
+
-> language = "en", country = nil, charset = nil.
|
|
225
|
+
Locale::Object.new("POSIX")
|
|
226
|
+
-> language = "en", country = nil, charset = nil.
|
|
227
|
+
</pre>
|
|
228
|
+
<p><a class="source-toggle" href="#"
|
|
229
|
+
onclick="toggleCode('M000113-source');return false;">[Source]</a></p>
|
|
230
|
+
<div class="method-source-code" id="M000113-source">
|
|
231
|
+
<pre>
|
|
232
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 149</span>
|
|
233
|
+
149: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">language_or_locale_name</span>, <span class="ruby-identifier">country</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">charset</span> = <span class="ruby-keyword kw">nil</span>)
|
|
234
|
+
150: <span class="ruby-ivar">@orig_str</span> = <span class="ruby-identifier">language_or_locale_name</span>
|
|
235
|
+
151: <span class="ruby-ivar">@language</span>, <span class="ruby-ivar">@country</span>, <span class="ruby-ivar">@charset</span>, <span class="ruby-ivar">@script</span>, <span class="ruby-ivar">@variant</span>, <span class="ruby-ivar">@modifier</span> =
|
|
236
|
+
152: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">language_or_locale_name</span>)
|
|
237
|
+
153: <span class="ruby-ivar">@country</span> = <span class="ruby-identifier">country</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">country</span>
|
|
238
|
+
154: <span class="ruby-ivar">@charset</span> = <span class="ruby-identifier">charset</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">charset</span>
|
|
239
|
+
155: <span class="ruby-ivar">@fallback</span> = <span class="ruby-keyword kw">nil</span>
|
|
240
|
+
156: <span class="ruby-identifier">clear</span>
|
|
241
|
+
157: <span class="ruby-keyword kw">end</span>
|
|
242
|
+
</pre>
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
|
|
247
|
+
<div id="method-M000112" class="method-detail">
|
|
248
|
+
<a name="M000112"></a>
|
|
249
|
+
|
|
250
|
+
<div class="method-heading">
|
|
251
|
+
<a href="#M000112" class="method-signature">
|
|
252
|
+
<span class="method-name">parse</span><span class="method-args">(locale_name)</span>
|
|
253
|
+
</a>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
<div class="method-description">
|
|
257
|
+
<p>
|
|
258
|
+
Parse POSIX or RFC 3066 style locale name to Array.
|
|
259
|
+
</p>
|
|
260
|
+
<ul>
|
|
261
|
+
<li>locale_name: locale name as <a href="../String.html">String</a>
|
|
262
|
+
|
|
263
|
+
<ul>
|
|
264
|
+
<li>Basic POSIX format:
|
|
265
|
+
<language>_<COUNTRY>.<charset>@<modifier>
|
|
266
|
+
|
|
267
|
+
<ul>
|
|
268
|
+
<li>Both of POSIX and C are converted to "en".
|
|
269
|
+
|
|
270
|
+
</li>
|
|
271
|
+
</ul>
|
|
272
|
+
</li>
|
|
273
|
+
<li>Basic RFC3066 format: <language>-<COUNTRY>
|
|
274
|
+
|
|
275
|
+
</li>
|
|
276
|
+
<li>Win32 format: <language>-<COUNTRY>-<Script>_<sort
|
|
277
|
+
order>
|
|
278
|
+
|
|
279
|
+
</li>
|
|
280
|
+
<li>CLDR format:
|
|
281
|
+
<language>_<Script>_<COUNTRY>_<variant>@<modifier>
|
|
282
|
+
|
|
283
|
+
</li>
|
|
284
|
+
<li>Some broken format: <language>_<country>_<script> #
|
|
285
|
+
Don‘t use this.
|
|
286
|
+
|
|
287
|
+
</li>
|
|
288
|
+
<li>The max locale format is below:
|
|
289
|
+
|
|
290
|
+
<ul>
|
|
291
|
+
<li><language>-<COUNTRY>-<Script>_<sort
|
|
292
|
+
order>.<charset>@<modifier>
|
|
293
|
+
|
|
294
|
+
</li>
|
|
295
|
+
<li>format:
|
|
296
|
+
<language>_<Script>_<COUNTRY>_<variant>@<modifier>
|
|
297
|
+
|
|
298
|
+
<ul>
|
|
299
|
+
<li>both of ’-’ and ‘_’ are separators.
|
|
300
|
+
|
|
301
|
+
</li>
|
|
302
|
+
<li>each elements are omittable.
|
|
303
|
+
|
|
304
|
+
</li>
|
|
305
|
+
</ul>
|
|
306
|
+
</li>
|
|
307
|
+
</ul>
|
|
308
|
+
</li>
|
|
309
|
+
</ul>
|
|
310
|
+
<p>
|
|
311
|
+
(e.g.) uz-UZ-Latn, ja_JP.eucJP, wa_BE.iso885915@euro
|
|
312
|
+
</p>
|
|
313
|
+
</li>
|
|
314
|
+
<li>Returns: [language, country, charset, script, modifier]
|
|
315
|
+
|
|
316
|
+
<ul>
|
|
317
|
+
<li>language: a lowercase ISO 639(or 639-2/T) language code.
|
|
318
|
+
|
|
319
|
+
</li>
|
|
320
|
+
<li>country: an uppercase ISO 3166-1 country/region identifier.
|
|
321
|
+
|
|
322
|
+
</li>
|
|
323
|
+
<li>charset: charset(codeset) (no standard)
|
|
324
|
+
|
|
325
|
+
</li>
|
|
326
|
+
<li>script: an initial-uppercase ISO 15924 script code.
|
|
327
|
+
|
|
328
|
+
</li>
|
|
329
|
+
<li>variant: variant value in CLDR or sort order in Win32.
|
|
330
|
+
|
|
331
|
+
</li>
|
|
332
|
+
<li>modifier: (no standard)
|
|
333
|
+
|
|
334
|
+
</li>
|
|
335
|
+
</ul>
|
|
336
|
+
</li>
|
|
337
|
+
</ul>
|
|
338
|
+
<pre>
|
|
339
|
+
(e.g.)
|
|
340
|
+
"ja_JP.eucJP" => ["ja", "JP", "eucJP", nil, nil]
|
|
341
|
+
"ja-jp.utf-8" => ["ja", "JP", "utf-8", nil, nil]
|
|
342
|
+
"ja-jp" => ["ja", "JP", nil, nil, nil]
|
|
343
|
+
"ja" => ["ja", nil, nil, nil, nil]
|
|
344
|
+
"uz@Latn" => ["uz", nil, nil, nil, "Latn"]
|
|
345
|
+
"uz-UZ-Latn" => ["uz", "UZ", nil, "Latn", nil]
|
|
346
|
+
"uz_UZ_Latn" => ["uz", "UZ", nil, "Latn", nil]
|
|
347
|
+
"wa_BE.iso885915@euro" => ["wa", "BE", "iso885915", nil, "euro"]
|
|
348
|
+
"C" => ["en", nil, nil, nil, nil]
|
|
349
|
+
"POSIX" => ["en", nil, nil, nil, nil]
|
|
350
|
+
"zh_Hant" => ["zh", nil, nil, "Hant", nil]
|
|
351
|
+
"zh_Hant_HK" => ["zh", "HK", nil, "Hant", nil]
|
|
352
|
+
"de_DE@collation=phonebook,currency=DDM" => ["de", "DE", nil, nil, "collation=phonebook,currency=DDM"]
|
|
353
|
+
</pre>
|
|
354
|
+
<p><a class="source-toggle" href="#"
|
|
355
|
+
onclick="toggleCode('M000112-source');return false;">[Source]</a></p>
|
|
356
|
+
<div class="method-source-code" id="M000112-source">
|
|
357
|
+
<pre>
|
|
358
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 97</span>
|
|
359
|
+
97: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">locale_name</span>)
|
|
360
|
+
98: <span class="ruby-identifier">lang_charset</span>, <span class="ruby-identifier">modifier</span> = <span class="ruby-identifier">locale_name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/@/</span>)
|
|
361
|
+
99: <span class="ruby-identifier">lang</span>, <span class="ruby-identifier">charset</span> = <span class="ruby-identifier">lang_charset</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\./</span>)
|
|
362
|
+
100: <span class="ruby-identifier">language</span>, <span class="ruby-identifier">country</span>, <span class="ruby-identifier">script</span>, <span class="ruby-identifier">variant</span> = <span class="ruby-identifier">lang</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/_/</span>, <span class="ruby-value str">"-"</span>).<span class="ruby-identifier">split</span>(<span class="ruby-value str">'-'</span>)
|
|
363
|
+
101: <span class="ruby-identifier">language</span> = <span class="ruby-identifier">language</span> <span class="ruby-value">? </span><span class="ruby-identifier">language</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
|
|
364
|
+
102: <span class="ruby-identifier">language</span> = <span class="ruby-value str">"en"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">language</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"c"</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">language</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"posix"</span>
|
|
365
|
+
103: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">country</span>
|
|
366
|
+
104: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">country</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A[A-Z][a-z]+\Z/</span> <span class="ruby-comment cmt">#Latn => script</span>
|
|
367
|
+
105: <span class="ruby-identifier">tmp</span> = <span class="ruby-identifier">script</span>
|
|
368
|
+
106: <span class="ruby-identifier">script</span> = <span class="ruby-identifier">country</span>
|
|
369
|
+
107: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tmp</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A[A-Z]+\Z/</span> <span class="ruby-comment cmt">#US => country</span>
|
|
370
|
+
108: <span class="ruby-identifier">country</span> = <span class="ruby-identifier">tmp</span>
|
|
371
|
+
109: <span class="ruby-keyword kw">else</span>
|
|
372
|
+
110: <span class="ruby-identifier">country</span> = <span class="ruby-keyword kw">nil</span>
|
|
373
|
+
111: <span class="ruby-identifier">variant</span> = <span class="ruby-identifier">tmp</span>
|
|
374
|
+
112: <span class="ruby-keyword kw">end</span>
|
|
375
|
+
113: <span class="ruby-keyword kw">else</span>
|
|
376
|
+
114: <span class="ruby-identifier">country</span> = <span class="ruby-identifier">country</span>.<span class="ruby-identifier">upcase</span>
|
|
377
|
+
115: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">script</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/\A[A-Z][a-z]+\Z/</span> <span class="ruby-comment cmt">#Latn => script</span>
|
|
378
|
+
116: <span class="ruby-identifier">variant</span> = <span class="ruby-identifier">script</span>
|
|
379
|
+
117: <span class="ruby-identifier">script</span> = <span class="ruby-keyword kw">nil</span>
|
|
380
|
+
118: <span class="ruby-keyword kw">end</span>
|
|
381
|
+
119: <span class="ruby-keyword kw">end</span>
|
|
382
|
+
120: <span class="ruby-keyword kw">end</span>
|
|
383
|
+
121: [<span class="ruby-identifier">language</span>, <span class="ruby-identifier">country</span>, <span class="ruby-identifier">charset</span>, <span class="ruby-identifier">script</span>, <span class="ruby-identifier">variant</span>, <span class="ruby-identifier">modifier</span>]
|
|
384
|
+
122: <span class="ruby-keyword kw">end</span>
|
|
385
|
+
</pre>
|
|
386
|
+
</div>
|
|
387
|
+
</div>
|
|
388
|
+
</div>
|
|
389
|
+
|
|
390
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
391
|
+
|
|
392
|
+
<div id="method-M000108" class="method-detail">
|
|
393
|
+
<a name="M000108"></a>
|
|
394
|
+
|
|
395
|
+
<div class="method-heading">
|
|
396
|
+
<a href="#M000108" class="method-signature">
|
|
397
|
+
<span class="method-name">charset=</span><span class="method-args">(val)</span>
|
|
398
|
+
</a>
|
|
399
|
+
</div>
|
|
400
|
+
|
|
401
|
+
<div class="method-description">
|
|
402
|
+
<p>
|
|
403
|
+
Set the charset. e.g.) UTF-8, EUC-JP, Shift_JIS
|
|
404
|
+
</p>
|
|
405
|
+
<p><a class="source-toggle" href="#"
|
|
406
|
+
onclick="toggleCode('M000108-source');return false;">[Source]</a></p>
|
|
407
|
+
<div class="method-source-code" id="M000108-source">
|
|
408
|
+
<pre>
|
|
409
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 30</span>
|
|
410
|
+
30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">charset=</span>(<span class="ruby-identifier">val</span>)
|
|
411
|
+
31: <span class="ruby-ivar">@charset</span> = <span class="ruby-identifier">val</span>
|
|
412
|
+
32: <span class="ruby-identifier">clear</span>
|
|
413
|
+
33: <span class="ruby-keyword kw">end</span>
|
|
414
|
+
</pre>
|
|
415
|
+
</div>
|
|
416
|
+
</div>
|
|
417
|
+
</div>
|
|
418
|
+
|
|
419
|
+
<div id="method-M000114" class="method-detail">
|
|
420
|
+
<a name="M000114"></a>
|
|
421
|
+
|
|
422
|
+
<div class="method-heading">
|
|
423
|
+
<a href="#M000114" class="method-signature">
|
|
424
|
+
<span class="method-name">clear</span><span class="method-args">()</span>
|
|
425
|
+
</a>
|
|
426
|
+
</div>
|
|
427
|
+
|
|
428
|
+
<div class="method-description">
|
|
429
|
+
<p><a class="source-toggle" href="#"
|
|
430
|
+
onclick="toggleCode('M000114-source');return false;">[Source]</a></p>
|
|
431
|
+
<div class="method-source-code" id="M000114-source">
|
|
432
|
+
<pre>
|
|
433
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 159</span>
|
|
434
|
+
159: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear</span>
|
|
435
|
+
160: <span class="ruby-ivar">@posix</span> = <span class="ruby-keyword kw">nil</span>
|
|
436
|
+
161: <span class="ruby-ivar">@iso3066</span> = <span class="ruby-keyword kw">nil</span>
|
|
437
|
+
162: <span class="ruby-ivar">@win</span> = <span class="ruby-keyword kw">nil</span>
|
|
438
|
+
163: <span class="ruby-ivar">@general</span> = <span class="ruby-keyword kw">nil</span>
|
|
439
|
+
164: <span class="ruby-ivar">@hash</span> = <span class="ruby-node">"#{self.class}:#{to_general}.#{@charset}@#{@modifier}"</span>.<span class="ruby-identifier">hash</span>
|
|
440
|
+
165: <span class="ruby-keyword kw">end</span>
|
|
441
|
+
</pre>
|
|
442
|
+
</div>
|
|
443
|
+
</div>
|
|
444
|
+
</div>
|
|
445
|
+
|
|
446
|
+
<div id="method-M000107" class="method-detail">
|
|
447
|
+
<a name="M000107"></a>
|
|
448
|
+
|
|
449
|
+
<div class="method-heading">
|
|
450
|
+
<a href="#M000107" class="method-signature">
|
|
451
|
+
<span class="method-name">country=</span><span class="method-args">(val)</span>
|
|
452
|
+
</a>
|
|
453
|
+
</div>
|
|
454
|
+
|
|
455
|
+
<div class="method-description">
|
|
456
|
+
<p>
|
|
457
|
+
Set the country. e.g.) JP, US, FR, …
|
|
458
|
+
</p>
|
|
459
|
+
<p><a class="source-toggle" href="#"
|
|
460
|
+
onclick="toggleCode('M000107-source');return false;">[Source]</a></p>
|
|
461
|
+
<div class="method-source-code" id="M000107-source">
|
|
462
|
+
<pre>
|
|
463
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 24</span>
|
|
464
|
+
24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">country=</span>(<span class="ruby-identifier">val</span>)
|
|
465
|
+
25: <span class="ruby-ivar">@country</span> = <span class="ruby-identifier">val</span>
|
|
466
|
+
26: <span class="ruby-identifier">clear</span>
|
|
467
|
+
27: <span class="ruby-keyword kw">end</span>
|
|
468
|
+
</pre>
|
|
469
|
+
</div>
|
|
470
|
+
</div>
|
|
471
|
+
</div>
|
|
472
|
+
|
|
473
|
+
<div id="method-M000106" class="method-detail">
|
|
474
|
+
<a name="M000106"></a>
|
|
475
|
+
|
|
476
|
+
<div class="method-heading">
|
|
477
|
+
<a href="#M000106" class="method-signature">
|
|
478
|
+
<span class="method-name">language=</span><span class="method-args">(val)</span>
|
|
479
|
+
</a>
|
|
480
|
+
</div>
|
|
481
|
+
|
|
482
|
+
<div class="method-description">
|
|
483
|
+
<p>
|
|
484
|
+
Set the language. e.g.) ja, en, fr, …
|
|
485
|
+
</p>
|
|
486
|
+
<p><a class="source-toggle" href="#"
|
|
487
|
+
onclick="toggleCode('M000106-source');return false;">[Source]</a></p>
|
|
488
|
+
<div class="method-source-code" id="M000106-source">
|
|
489
|
+
<pre>
|
|
490
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 18</span>
|
|
491
|
+
18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">language=</span>(<span class="ruby-identifier">val</span>)
|
|
492
|
+
19: <span class="ruby-ivar">@language</span> = <span class="ruby-identifier">val</span>
|
|
493
|
+
20: <span class="ruby-identifier">clear</span>
|
|
494
|
+
21: <span class="ruby-keyword kw">end</span>
|
|
495
|
+
</pre>
|
|
496
|
+
</div>
|
|
497
|
+
</div>
|
|
498
|
+
</div>
|
|
499
|
+
|
|
500
|
+
<div id="method-M000111" class="method-detail">
|
|
501
|
+
<a name="M000111"></a>
|
|
502
|
+
|
|
503
|
+
<div class="method-heading">
|
|
504
|
+
<a href="#M000111" class="method-signature">
|
|
505
|
+
<span class="method-name">modifier=</span><span class="method-args">(val)</span>
|
|
506
|
+
</a>
|
|
507
|
+
</div>
|
|
508
|
+
|
|
509
|
+
<div class="method-description">
|
|
510
|
+
<p>
|
|
511
|
+
Set the modifier. e.g.) curreny=DDM
|
|
512
|
+
</p>
|
|
513
|
+
<p><a class="source-toggle" href="#"
|
|
514
|
+
onclick="toggleCode('M000111-source');return false;">[Source]</a></p>
|
|
515
|
+
<div class="method-source-code" id="M000111-source">
|
|
516
|
+
<pre>
|
|
517
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 48</span>
|
|
518
|
+
48: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">modifier=</span>(<span class="ruby-identifier">val</span>)
|
|
519
|
+
49: <span class="ruby-ivar">@modifier</span> = <span class="ruby-identifier">val</span>
|
|
520
|
+
50: <span class="ruby-identifier">clear</span>
|
|
521
|
+
51: <span class="ruby-keyword kw">end</span>
|
|
522
|
+
</pre>
|
|
523
|
+
</div>
|
|
524
|
+
</div>
|
|
525
|
+
</div>
|
|
526
|
+
|
|
527
|
+
<div id="method-M000109" class="method-detail">
|
|
528
|
+
<a name="M000109"></a>
|
|
529
|
+
|
|
530
|
+
<div class="method-heading">
|
|
531
|
+
<a href="#M000109" class="method-signature">
|
|
532
|
+
<span class="method-name">script=</span><span class="method-args">(val)</span>
|
|
533
|
+
</a>
|
|
534
|
+
</div>
|
|
535
|
+
|
|
536
|
+
<div class="method-description">
|
|
537
|
+
<p>
|
|
538
|
+
Set the script. e.g.) Latn
|
|
539
|
+
</p>
|
|
540
|
+
<p><a class="source-toggle" href="#"
|
|
541
|
+
onclick="toggleCode('M000109-source');return false;">[Source]</a></p>
|
|
542
|
+
<div class="method-source-code" id="M000109-source">
|
|
543
|
+
<pre>
|
|
544
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 36</span>
|
|
545
|
+
36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">script=</span>(<span class="ruby-identifier">val</span>)
|
|
546
|
+
37: <span class="ruby-ivar">@script</span> = <span class="ruby-identifier">val</span>
|
|
547
|
+
38: <span class="ruby-identifier">clear</span>
|
|
548
|
+
39: <span class="ruby-keyword kw">end</span>
|
|
549
|
+
</pre>
|
|
550
|
+
</div>
|
|
551
|
+
</div>
|
|
552
|
+
</div>
|
|
553
|
+
|
|
554
|
+
<div id="method-M000119" class="method-detail">
|
|
555
|
+
<a name="M000119"></a>
|
|
556
|
+
|
|
557
|
+
<div class="method-heading">
|
|
558
|
+
<a href="#M000119" class="method-signature">
|
|
559
|
+
<span class="method-name">to_a</span><span class="method-args">()</span>
|
|
560
|
+
</a>
|
|
561
|
+
</div>
|
|
562
|
+
|
|
563
|
+
<div class="method-description">
|
|
564
|
+
<p>
|
|
565
|
+
Gets the locale informations as an Array.
|
|
566
|
+
</p>
|
|
567
|
+
<ul>
|
|
568
|
+
<li>Returns [language, country, charset, script, variant, modifier]
|
|
569
|
+
|
|
570
|
+
<ul>
|
|
571
|
+
<li>language: a lowercase ISO 639(or 639-2/T) language code.
|
|
572
|
+
|
|
573
|
+
</li>
|
|
574
|
+
<li>country: an uppercase ISO 3166-1 country/region identifier.
|
|
575
|
+
|
|
576
|
+
</li>
|
|
577
|
+
<li>charset: charset(codeset) (no standard)
|
|
578
|
+
|
|
579
|
+
</li>
|
|
580
|
+
<li>script: an initial-uppercase ISO 15924 script code.
|
|
581
|
+
|
|
582
|
+
</li>
|
|
583
|
+
<li>variant: variant value in CLDR or sort order in Win32.
|
|
584
|
+
|
|
585
|
+
</li>
|
|
586
|
+
<li>modifier: (no standard)
|
|
587
|
+
|
|
588
|
+
</li>
|
|
589
|
+
</ul>
|
|
590
|
+
</li>
|
|
591
|
+
</ul>
|
|
592
|
+
<p><a class="source-toggle" href="#"
|
|
593
|
+
onclick="toggleCode('M000119-source');return false;">[Source]</a></p>
|
|
594
|
+
<div class="method-source-code" id="M000119-source">
|
|
595
|
+
<pre>
|
|
596
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 215</span>
|
|
597
|
+
215: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_a</span>
|
|
598
|
+
216: [<span class="ruby-ivar">@language</span>, <span class="ruby-ivar">@country</span>, <span class="ruby-ivar">@charset</span>, <span class="ruby-ivar">@script</span>, <span class="ruby-ivar">@variant</span>, <span class="ruby-ivar">@modifier</span>]
|
|
599
|
+
217: <span class="ruby-keyword kw">end</span>
|
|
600
|
+
</pre>
|
|
601
|
+
</div>
|
|
602
|
+
</div>
|
|
603
|
+
</div>
|
|
604
|
+
|
|
605
|
+
<div id="method-M000118" class="method-detail">
|
|
606
|
+
<a name="M000118"></a>
|
|
607
|
+
|
|
608
|
+
<div class="method-heading">
|
|
609
|
+
<a href="#M000118" class="method-signature">
|
|
610
|
+
<span class="method-name">to_general</span><span class="method-args">()</span>
|
|
611
|
+
</a>
|
|
612
|
+
</div>
|
|
613
|
+
|
|
614
|
+
<div class="method-description">
|
|
615
|
+
<p>
|
|
616
|
+
Returns the locale as ‘ruby’ general format. (e.g.)
|
|
617
|
+
"az_AZ_Latn"
|
|
618
|
+
</p>
|
|
619
|
+
<p><a class="source-toggle" href="#"
|
|
620
|
+
onclick="toggleCode('M000118-source');return false;">[Source]</a></p>
|
|
621
|
+
<div class="method-source-code" id="M000118-source">
|
|
622
|
+
<pre>
|
|
623
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 198</span>
|
|
624
|
+
198: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_general</span>
|
|
625
|
+
199: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@general</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@general</span>
|
|
626
|
+
200:
|
|
627
|
+
201: <span class="ruby-ivar">@general</span> = <span class="ruby-ivar">@language</span>.<span class="ruby-identifier">dup</span>
|
|
628
|
+
202: <span class="ruby-ivar">@general</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"_#{@country}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@country</span>
|
|
629
|
+
203: <span class="ruby-ivar">@general</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"_#{@script}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@script</span>
|
|
630
|
+
204: <span class="ruby-ivar">@general</span>
|
|
631
|
+
205: <span class="ruby-keyword kw">end</span>
|
|
632
|
+
</pre>
|
|
633
|
+
</div>
|
|
634
|
+
</div>
|
|
635
|
+
</div>
|
|
636
|
+
|
|
637
|
+
<div id="method-M000116" class="method-detail">
|
|
638
|
+
<a name="M000116"></a>
|
|
639
|
+
|
|
640
|
+
<div class="method-heading">
|
|
641
|
+
<a href="#M000116" class="method-signature">
|
|
642
|
+
<span class="method-name">to_iso3066</span><span class="method-args">()</span>
|
|
643
|
+
</a>
|
|
644
|
+
</div>
|
|
645
|
+
|
|
646
|
+
<div class="method-description">
|
|
647
|
+
<p>
|
|
648
|
+
Returns the locale as ISO3066 format. (e.g.) "ja-JP"
|
|
649
|
+
</p>
|
|
650
|
+
<p><a class="source-toggle" href="#"
|
|
651
|
+
onclick="toggleCode('M000116-source');return false;">[Source]</a></p>
|
|
652
|
+
<div class="method-source-code" id="M000116-source">
|
|
653
|
+
<pre>
|
|
654
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 177</span>
|
|
655
|
+
177: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_iso3066</span>
|
|
656
|
+
178: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@iso3066</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@iso3066</span>
|
|
657
|
+
179:
|
|
658
|
+
180: <span class="ruby-ivar">@iso3066</span> = <span class="ruby-ivar">@language</span>.<span class="ruby-identifier">dup</span>
|
|
659
|
+
181: <span class="ruby-ivar">@iso3066</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"-#{@country}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@country</span>
|
|
660
|
+
182: <span class="ruby-ivar">@iso3066</span>
|
|
661
|
+
183: <span class="ruby-keyword kw">end</span>
|
|
662
|
+
</pre>
|
|
663
|
+
</div>
|
|
664
|
+
</div>
|
|
665
|
+
</div>
|
|
666
|
+
|
|
667
|
+
<div id="method-M000115" class="method-detail">
|
|
668
|
+
<a name="M000115"></a>
|
|
669
|
+
|
|
670
|
+
<div class="method-heading">
|
|
671
|
+
<a href="#M000115" class="method-signature">
|
|
672
|
+
<span class="method-name">to_posix</span><span class="method-args">()</span>
|
|
673
|
+
</a>
|
|
674
|
+
</div>
|
|
675
|
+
|
|
676
|
+
<div class="method-description">
|
|
677
|
+
<p>
|
|
678
|
+
Returns the locale as POSIX format(but charset is ignored). (e.g.)
|
|
679
|
+
"ja_JP"
|
|
680
|
+
</p>
|
|
681
|
+
<p><a class="source-toggle" href="#"
|
|
682
|
+
onclick="toggleCode('M000115-source');return false;">[Source]</a></p>
|
|
683
|
+
<div class="method-source-code" id="M000115-source">
|
|
684
|
+
<pre>
|
|
685
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 168</span>
|
|
686
|
+
168: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_posix</span>
|
|
687
|
+
169: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@posix</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@posix</span>
|
|
688
|
+
170: <span class="ruby-ivar">@posix</span> = <span class="ruby-ivar">@language</span>.<span class="ruby-identifier">dup</span>
|
|
689
|
+
171:
|
|
690
|
+
172: <span class="ruby-ivar">@posix</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"_#{@country}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@country</span>
|
|
691
|
+
173: <span class="ruby-ivar">@posix</span>
|
|
692
|
+
174: <span class="ruby-keyword kw">end</span>
|
|
693
|
+
</pre>
|
|
694
|
+
</div>
|
|
695
|
+
</div>
|
|
696
|
+
</div>
|
|
697
|
+
|
|
698
|
+
<div id="method-M000120" class="method-detail">
|
|
699
|
+
<a name="M000120"></a>
|
|
700
|
+
|
|
701
|
+
<div class="method-heading">
|
|
702
|
+
<span class="method-name">to_s</span><span class="method-args">()</span>
|
|
703
|
+
</div>
|
|
704
|
+
|
|
705
|
+
<div class="method-description">
|
|
706
|
+
<p>
|
|
707
|
+
Alias for <a href="Object.html#M000115">to_posix</a>
|
|
708
|
+
</p>
|
|
709
|
+
</div>
|
|
710
|
+
</div>
|
|
711
|
+
|
|
712
|
+
<div id="method-M000121" class="method-detail">
|
|
713
|
+
<a name="M000121"></a>
|
|
714
|
+
|
|
715
|
+
<div class="method-heading">
|
|
716
|
+
<span class="method-name">to_str</span><span class="method-args">()</span>
|
|
717
|
+
</div>
|
|
718
|
+
|
|
719
|
+
<div class="method-description">
|
|
720
|
+
<p>
|
|
721
|
+
Alias for <a href="Object.html#M000115">to_posix</a>
|
|
722
|
+
</p>
|
|
723
|
+
</div>
|
|
724
|
+
</div>
|
|
725
|
+
|
|
726
|
+
<div id="method-M000117" class="method-detail">
|
|
727
|
+
<a name="M000117"></a>
|
|
728
|
+
|
|
729
|
+
<div class="method-heading">
|
|
730
|
+
<a href="#M000117" class="method-signature">
|
|
731
|
+
<span class="method-name">to_win</span><span class="method-args">()</span>
|
|
732
|
+
</a>
|
|
733
|
+
</div>
|
|
734
|
+
|
|
735
|
+
<div class="method-description">
|
|
736
|
+
<p>
|
|
737
|
+
Returns the locale as Win32 format. (e.g.) "az-AZ-Latn".
|
|
738
|
+
</p>
|
|
739
|
+
<p>
|
|
740
|
+
This is used to find the charset from locale table.
|
|
741
|
+
</p>
|
|
742
|
+
<p><a class="source-toggle" href="#"
|
|
743
|
+
onclick="toggleCode('M000117-source');return false;">[Source]</a></p>
|
|
744
|
+
<div class="method-source-code" id="M000117-source">
|
|
745
|
+
<pre>
|
|
746
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 188</span>
|
|
747
|
+
188: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_win</span>
|
|
748
|
+
189: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@win</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@win</span>
|
|
749
|
+
190:
|
|
750
|
+
191: <span class="ruby-ivar">@win</span> = <span class="ruby-ivar">@language</span>.<span class="ruby-identifier">dup</span>
|
|
751
|
+
192: <span class="ruby-ivar">@win</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"-#{@country}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@country</span>
|
|
752
|
+
193: <span class="ruby-ivar">@win</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"-#{@script}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@script</span>
|
|
753
|
+
194: <span class="ruby-ivar">@win</span>
|
|
754
|
+
195: <span class="ruby-keyword kw">end</span>
|
|
755
|
+
</pre>
|
|
756
|
+
</div>
|
|
757
|
+
</div>
|
|
758
|
+
</div>
|
|
759
|
+
|
|
760
|
+
<div id="method-M000110" class="method-detail">
|
|
761
|
+
<a name="M000110"></a>
|
|
762
|
+
|
|
763
|
+
<div class="method-heading">
|
|
764
|
+
<a href="#M000110" class="method-signature">
|
|
765
|
+
<span class="method-name">variant=</span><span class="method-args">(val)</span>
|
|
766
|
+
</a>
|
|
767
|
+
</div>
|
|
768
|
+
|
|
769
|
+
<div class="method-description">
|
|
770
|
+
<p>
|
|
771
|
+
Set the variant. e.g.) Hant
|
|
772
|
+
</p>
|
|
773
|
+
<p><a class="source-toggle" href="#"
|
|
774
|
+
onclick="toggleCode('M000110-source');return false;">[Source]</a></p>
|
|
775
|
+
<div class="method-source-code" id="M000110-source">
|
|
776
|
+
<pre>
|
|
777
|
+
<span class="ruby-comment cmt"># File lib/locale/object.rb, line 42</span>
|
|
778
|
+
42: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">variant=</span>(<span class="ruby-identifier">val</span>)
|
|
779
|
+
43: <span class="ruby-ivar">@variant</span> = <span class="ruby-identifier">val</span>
|
|
780
|
+
44: <span class="ruby-identifier">clear</span>
|
|
781
|
+
45: <span class="ruby-keyword kw">end</span>
|
|
782
|
+
</pre>
|
|
783
|
+
</div>
|
|
784
|
+
</div>
|
|
785
|
+
</div>
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
</div>
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
</div>
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
<div id="validator-badges">
|
|
795
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
796
|
+
</div>
|
|
797
|
+
|
|
798
|
+
</body>
|
|
799
|
+
</html>
|