gettext 1.10.0 → 1.90.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,182 @@
|
|
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: ActiveRecord::ConnectionAdapters::Column</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">ActiveRecord::ConnectionAdapters::Column</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/gettext/active_record_rb.html">
|
59
|
+
lib/gettext/active_record.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
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
An abstract definition of a column in a table.
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000122">human_name_with_gettext</a>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
<!-- if includes -->
|
103
|
+
|
104
|
+
<div id="section">
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<div id="aliases-list">
|
109
|
+
<h3 class="section-bar">External Aliases</h3>
|
110
|
+
|
111
|
+
<div class="name-list">
|
112
|
+
<table summary="aliases">
|
113
|
+
<tr class="top-aligned-row context-row">
|
114
|
+
<td class="context-item-name">human_name</td>
|
115
|
+
<td>-></td>
|
116
|
+
<td class="context-item-value">human_name_witout_localized</td>
|
117
|
+
</tr>
|
118
|
+
</table>
|
119
|
+
</div>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
|
123
|
+
<div id="attribute-list">
|
124
|
+
<h3 class="section-bar">Attributes</h3>
|
125
|
+
|
126
|
+
<div class="name-list">
|
127
|
+
<table>
|
128
|
+
<tr class="top-aligned-row context-row">
|
129
|
+
<td class="context-item-name">table_class</td>
|
130
|
+
<td class="context-item-value"> [RW] </td>
|
131
|
+
<td class="context-item-desc"></td>
|
132
|
+
</tr>
|
133
|
+
</table>
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
<!-- if method_list -->
|
140
|
+
<div id="methods">
|
141
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
142
|
+
|
143
|
+
<div id="method-M000122" class="method-detail">
|
144
|
+
<a name="M000122"></a>
|
145
|
+
|
146
|
+
<div class="method-heading">
|
147
|
+
<a href="#M000122" class="method-signature">
|
148
|
+
<span class="method-name">human_name_with_gettext</span><span class="method-args">()</span>
|
149
|
+
</a>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
<div class="method-description">
|
153
|
+
<p><a class="source-toggle" href="#"
|
154
|
+
onclick="toggleCode('M000122-source');return false;">[Source]</a></p>
|
155
|
+
<div class="method-source-code" id="M000122-source">
|
156
|
+
<pre>
|
157
|
+
<span class="ruby-comment cmt"># File lib/gettext/active_record.rb, line 40</span>
|
158
|
+
40: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">human_name_with_gettext</span>
|
159
|
+
41: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">table_class</span>
|
160
|
+
42: <span class="ruby-identifier">table_class</span>.<span class="ruby-identifier">human_attribute_name</span>(<span class="ruby-ivar">@name</span>)
|
161
|
+
43: <span class="ruby-keyword kw">else</span>
|
162
|
+
44: <span class="ruby-ivar">@name</span>.<span class="ruby-identifier">humanize</span>
|
163
|
+
45: <span class="ruby-keyword kw">end</span>
|
164
|
+
46: <span class="ruby-keyword kw">end</span>
|
165
|
+
</pre>
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
|
171
|
+
</div>
|
172
|
+
|
173
|
+
|
174
|
+
</div>
|
175
|
+
|
176
|
+
|
177
|
+
<div id="validator-badges">
|
178
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
</body>
|
182
|
+
</html>
|
@@ -0,0 +1,118 @@
|
|
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: ActiveRecord::Migration</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">ActiveRecord::Migration</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/gettext/active_record_rb.html">
|
59
|
+
lib/gettext/active_record.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
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
<!-- if includes -->
|
90
|
+
<div id="includes">
|
91
|
+
<h3 class="section-bar">Included Modules</h3>
|
92
|
+
|
93
|
+
<div id="includes-list">
|
94
|
+
<span class="include-name"><a href="../GetText.html">GetText</a></span>
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
|
98
|
+
<div id="section">
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<!-- if method_list -->
|
108
|
+
|
109
|
+
|
110
|
+
</div>
|
111
|
+
|
112
|
+
|
113
|
+
<div id="validator-badges">
|
114
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
</body>
|
118
|
+
</html>
|
@@ -0,0 +1,1790 @@
|
|
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>Module: GetText</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>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">GetText</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/gettext/poparser_rb.html">
|
59
|
+
lib/gettext/poparser.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../files/lib/gettext/textdomain_rb.html">
|
63
|
+
lib/gettext/textdomain.rb
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
<a href="../files/lib/gettext/utils_rb.html">
|
67
|
+
lib/gettext/utils.rb
|
68
|
+
</a>
|
69
|
+
<br />
|
70
|
+
<a href="../files/lib/gettext/rails_rb.html">
|
71
|
+
lib/gettext/rails.rb
|
72
|
+
</a>
|
73
|
+
<br />
|
74
|
+
<a href="../files/lib/gettext/version_rb.html">
|
75
|
+
lib/gettext/version.rb
|
76
|
+
</a>
|
77
|
+
<br />
|
78
|
+
<a href="../files/lib/gettext/rgettext_rb.html">
|
79
|
+
lib/gettext/rgettext.rb
|
80
|
+
</a>
|
81
|
+
<br />
|
82
|
+
<a href="../files/lib/gettext/rmsgfmt_rb.html">
|
83
|
+
lib/gettext/rmsgfmt.rb
|
84
|
+
</a>
|
85
|
+
<br />
|
86
|
+
<a href="../files/lib/gettext/container_rb.html">
|
87
|
+
lib/gettext/container.rb
|
88
|
+
</a>
|
89
|
+
<br />
|
90
|
+
<a href="../files/lib/gettext/textdomainmanager_rb.html">
|
91
|
+
lib/gettext/textdomainmanager.rb
|
92
|
+
</a>
|
93
|
+
<br />
|
94
|
+
<a href="../files/lib/gettext/cgi_rb.html">
|
95
|
+
lib/gettext/cgi.rb
|
96
|
+
</a>
|
97
|
+
<br />
|
98
|
+
<a href="../files/lib/gettext/rmsgmerge_rb.html">
|
99
|
+
lib/gettext/rmsgmerge.rb
|
100
|
+
</a>
|
101
|
+
<br />
|
102
|
+
<a href="../files/lib/gettext/parser/glade_rb.html">
|
103
|
+
lib/gettext/parser/glade.rb
|
104
|
+
</a>
|
105
|
+
<br />
|
106
|
+
<a href="../files/lib/gettext/parser/ruby_rb.html">
|
107
|
+
lib/gettext/parser/ruby.rb
|
108
|
+
</a>
|
109
|
+
<br />
|
110
|
+
<a href="../files/lib/gettext/parser/active_record_rb.html">
|
111
|
+
lib/gettext/parser/active_record.rb
|
112
|
+
</a>
|
113
|
+
<br />
|
114
|
+
<a href="../files/lib/gettext/parser/erb_rb.html">
|
115
|
+
lib/gettext/parser/erb.rb
|
116
|
+
</a>
|
117
|
+
<br />
|
118
|
+
<a href="../files/lib/gettext/erb_rb.html">
|
119
|
+
lib/gettext/erb.rb
|
120
|
+
</a>
|
121
|
+
<br />
|
122
|
+
<a href="../files/lib/gettext_rb.html">
|
123
|
+
lib/gettext.rb
|
124
|
+
</a>
|
125
|
+
<br />
|
126
|
+
</td>
|
127
|
+
</tr>
|
128
|
+
|
129
|
+
</table>
|
130
|
+
</div>
|
131
|
+
<!-- banner header -->
|
132
|
+
|
133
|
+
<div id="bodyContent">
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
<div id="contextContent">
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
</div>
|
142
|
+
|
143
|
+
<div id="method-list">
|
144
|
+
<h3 class="section-bar">Methods</h3>
|
145
|
+
|
146
|
+
<div class="name-list">
|
147
|
+
<a href="#M000037">N_</a>
|
148
|
+
<a href="#M000038">Nn_</a>
|
149
|
+
<a href="#M000050">_</a>
|
150
|
+
<a href="#M000047">add_default_locale_path</a>
|
151
|
+
<a href="#M000030">bindtextdomain</a>
|
152
|
+
<a href="#M000031">bindtextdomain_to</a>
|
153
|
+
<a href="#M000027">cached=</a>
|
154
|
+
<a href="#M000028">cached?</a>
|
155
|
+
<a href="#M000025">cgi</a>
|
156
|
+
<a href="#M000024">cgi=</a>
|
157
|
+
<a href="#M000029">clear_cache</a>
|
158
|
+
<a href="#M000019">create_mofiles</a>
|
159
|
+
<a href="#M000048">current_textdomain_info</a>
|
160
|
+
<a href="#M000034">gettext</a>
|
161
|
+
<a href="#M000046">locale</a>
|
162
|
+
<a href="#M000042">locale=</a>
|
163
|
+
<a href="#M000018">msgmerge</a>
|
164
|
+
<a href="#M000051">n_</a>
|
165
|
+
<a href="#M000036">ngettext</a>
|
166
|
+
<a href="#M000053">ns_</a>
|
167
|
+
<a href="#M000039">nsgettext</a>
|
168
|
+
<a href="#M000045">output_charset</a>
|
169
|
+
<a href="#M000044">output_charset=</a>
|
170
|
+
<a href="#M000021">rgettext</a>
|
171
|
+
<a href="#M000022">rmsgfmt</a>
|
172
|
+
<a href="#M000026">rmsgmerge</a>
|
173
|
+
<a href="#M000052">s_</a>
|
174
|
+
<a href="#M000023">set_cgi</a>
|
175
|
+
<a href="#M000040">set_locale</a>
|
176
|
+
<a href="#M000041">set_locale_all</a>
|
177
|
+
<a href="#M000043">set_output_charset</a>
|
178
|
+
<a href="#M000049">setlocale</a>
|
179
|
+
<a href="#M000035">sgettext</a>
|
180
|
+
<a href="#M000032">textdomain</a>
|
181
|
+
<a href="#M000033">textdomain_to</a>
|
182
|
+
<a href="#M000020">update_pofiles</a>
|
183
|
+
</div>
|
184
|
+
</div>
|
185
|
+
|
186
|
+
</div>
|
187
|
+
|
188
|
+
|
189
|
+
<!-- if includes -->
|
190
|
+
<div id="includes">
|
191
|
+
<h3 class="section-bar">Included Modules</h3>
|
192
|
+
|
193
|
+
<div id="includes-list">
|
194
|
+
<span class="include-name"><a href="GetText.html">GetText</a></span>
|
195
|
+
<span class="include-name"><a href="GetText.html">GetText</a></span>
|
196
|
+
</div>
|
197
|
+
</div>
|
198
|
+
|
199
|
+
<div id="section">
|
200
|
+
|
201
|
+
<div id="class-list">
|
202
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
203
|
+
|
204
|
+
Module <a href="GetText/ActiveRecordParser.html" class="link">GetText::ActiveRecordParser</a><br />
|
205
|
+
Module <a href="GetText/Container.html" class="link">GetText::Container</a><br />
|
206
|
+
Module <a href="GetText/ErbContainer.html" class="link">GetText::ErbContainer</a><br />
|
207
|
+
Module <a href="GetText/ErbParser.html" class="link">GetText::ErbParser</a><br />
|
208
|
+
Module <a href="GetText/GladeParser.html" class="link">GetText::GladeParser</a><br />
|
209
|
+
Module <a href="GetText/Rails.html" class="link">GetText::Rails</a><br />
|
210
|
+
Module <a href="GetText/RubyParser.html" class="link">GetText::RubyParser</a><br />
|
211
|
+
Class <a href="GetText/NoboundTextDomainError.html" class="link">GetText::NoboundTextDomainError</a><br />
|
212
|
+
Class <a href="GetText/PoParser.html" class="link">GetText::PoParser</a><br />
|
213
|
+
Class <a href="GetText/TextDomain.html" class="link">GetText::TextDomain</a><br />
|
214
|
+
Class <a href="GetText/TextDomainManager.html" class="link">GetText::TextDomainManager</a><br />
|
215
|
+
|
216
|
+
</div>
|
217
|
+
|
218
|
+
<div id="constants-list">
|
219
|
+
<h3 class="section-bar">Constants</h3>
|
220
|
+
|
221
|
+
<div class="name-list">
|
222
|
+
<table summary="Constants">
|
223
|
+
<tr class="top-aligned-row context-row">
|
224
|
+
<td class="context-item-name">VERSION</td>
|
225
|
+
<td>=</td>
|
226
|
+
<td class="context-item-value">"1.90.0"</td>
|
227
|
+
</tr>
|
228
|
+
</table>
|
229
|
+
</div>
|
230
|
+
</div>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
<!-- if method_list -->
|
238
|
+
<div id="methods">
|
239
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
240
|
+
|
241
|
+
<div id="method-M000037" class="method-detail">
|
242
|
+
<a name="M000037"></a>
|
243
|
+
|
244
|
+
<div class="method-heading">
|
245
|
+
<a href="#M000037" class="method-signature">
|
246
|
+
<span class="method-name">N_</span><span class="method-args">(msgid)</span>
|
247
|
+
</a>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<div class="method-description">
|
251
|
+
<p>
|
252
|
+
This function does nothing. But it is required in order to recognize the
|
253
|
+
msgid by <a href="GetText.html#M000021">rgettext</a>.
|
254
|
+
</p>
|
255
|
+
<ul>
|
256
|
+
<li>msgid: the message id.
|
257
|
+
|
258
|
+
</li>
|
259
|
+
<li>Returns: msgid.
|
260
|
+
|
261
|
+
</li>
|
262
|
+
</ul>
|
263
|
+
<p><a class="source-toggle" href="#"
|
264
|
+
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
265
|
+
<div class="method-source-code" id="M000037-source">
|
266
|
+
<pre>
|
267
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 310</span>
|
268
|
+
310: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">N_</span>(<span class="ruby-identifier">msgid</span>)
|
269
|
+
311: <span class="ruby-identifier">msgid</span>
|
270
|
+
312: <span class="ruby-keyword kw">end</span>
|
271
|
+
</pre>
|
272
|
+
</div>
|
273
|
+
</div>
|
274
|
+
</div>
|
275
|
+
|
276
|
+
<div id="method-M000038" class="method-detail">
|
277
|
+
<a name="M000038"></a>
|
278
|
+
|
279
|
+
<div class="method-heading">
|
280
|
+
<a href="#M000038" class="method-signature">
|
281
|
+
<span class="method-name">Nn_</span><span class="method-args">(msgid, msgid_plural)</span>
|
282
|
+
</a>
|
283
|
+
</div>
|
284
|
+
|
285
|
+
<div class="method-description">
|
286
|
+
<p>
|
287
|
+
This is same function as <a href="GetText.html#M000037">N_</a> but for <a
|
288
|
+
href="GetText.html#M000036">ngettext</a>.
|
289
|
+
</p>
|
290
|
+
<ul>
|
291
|
+
<li>msgid: the message id.
|
292
|
+
|
293
|
+
</li>
|
294
|
+
<li>msgid_plural: the plural message id.
|
295
|
+
|
296
|
+
</li>
|
297
|
+
<li>Returns: msgid.
|
298
|
+
|
299
|
+
</li>
|
300
|
+
</ul>
|
301
|
+
<p><a class="source-toggle" href="#"
|
302
|
+
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
303
|
+
<div class="method-source-code" id="M000038-source">
|
304
|
+
<pre>
|
305
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 318</span>
|
306
|
+
318: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Nn_</span>(<span class="ruby-identifier">msgid</span>, <span class="ruby-identifier">msgid_plural</span>)
|
307
|
+
319: [<span class="ruby-identifier">msgid</span>, <span class="ruby-identifier">msgid_plural</span>]
|
308
|
+
320: <span class="ruby-keyword kw">end</span>
|
309
|
+
</pre>
|
310
|
+
</div>
|
311
|
+
</div>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
<div id="method-M000050" class="method-detail">
|
315
|
+
<a name="M000050"></a>
|
316
|
+
|
317
|
+
<div class="method-heading">
|
318
|
+
<span class="method-name">_</span><span class="method-args">(msgid)</span>
|
319
|
+
</div>
|
320
|
+
|
321
|
+
<div class="method-description">
|
322
|
+
<p>
|
323
|
+
Alias for <a href="GetText.html#M000034">gettext</a>
|
324
|
+
</p>
|
325
|
+
</div>
|
326
|
+
</div>
|
327
|
+
|
328
|
+
<div id="method-M000047" class="method-detail">
|
329
|
+
<a name="M000047"></a>
|
330
|
+
|
331
|
+
<div class="method-heading">
|
332
|
+
<a href="#M000047" class="method-signature">
|
333
|
+
<span class="method-name">add_default_locale_path</span><span class="method-args">(path)</span>
|
334
|
+
</a>
|
335
|
+
</div>
|
336
|
+
|
337
|
+
<div class="method-description">
|
338
|
+
<p>
|
339
|
+
Add default <a href="GetText.html#M000046">locale</a> path.
|
340
|
+
</p>
|
341
|
+
<ul>
|
342
|
+
<li>path: a new <a href="GetText.html#M000046">locale</a> path. (e.g.)
|
343
|
+
"/usr/share/locale/%{<a
|
344
|
+
href="GetText.html#M000046">locale</a>}/LC_MESSAGES/%{name}.mo"
|
345
|
+
(‘<a href="GetText.html#M000046">locale</a>’ =>
|
346
|
+
"ja_JP", ‘name’ => "<a
|
347
|
+
href="GetText.html#M000032">textdomain</a>")
|
348
|
+
|
349
|
+
</li>
|
350
|
+
<li>Returns: the new DEFAULT_LOCALE_PATHS
|
351
|
+
|
352
|
+
</li>
|
353
|
+
</ul>
|
354
|
+
<p><a class="source-toggle" href="#"
|
355
|
+
onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
|
356
|
+
<div class="method-source-code" id="M000047-source">
|
357
|
+
<pre>
|
358
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 492</span>
|
359
|
+
492: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_default_locale_path</span>(<span class="ruby-identifier">path</span>)
|
360
|
+
493: <span class="ruby-constant">TextDomain</span>.<span class="ruby-identifier">add_default_locale_path</span>(<span class="ruby-identifier">path</span>)
|
361
|
+
494: <span class="ruby-keyword kw">end</span>
|
362
|
+
</pre>
|
363
|
+
</div>
|
364
|
+
</div>
|
365
|
+
</div>
|
366
|
+
|
367
|
+
<div id="method-M000030" class="method-detail">
|
368
|
+
<a name="M000030"></a>
|
369
|
+
|
370
|
+
<div class="method-heading">
|
371
|
+
<a href="#M000030" class="method-signature">
|
372
|
+
<span class="method-name">bindtextdomain(domainname, options = {})<br />
|
373
|
+
</span>
|
374
|
+
</a>
|
375
|
+
</div>
|
376
|
+
|
377
|
+
<div class="method-description">
|
378
|
+
<p>
|
379
|
+
Bind a <a href="GetText.html#M000032">textdomain</a>(%{path}/%{<a
|
380
|
+
href="GetText.html#M000046">locale</a>}/LC_MESSAGES/%{domainname}.mo) to
|
381
|
+
your program. Normally, the texdomain scope becomes a ruby-script-file. So
|
382
|
+
you need to call this function each ruby-script-files. On the other hand,
|
383
|
+
if you call this function under <a
|
384
|
+
href="GetText/Container.html">GetText::Container</a> (gettext/container,
|
385
|
+
gettext/erb, gettext/rails), the <a
|
386
|
+
href="GetText.html#M000032">textdomain</a> scope becomes a Class/<a
|
387
|
+
href="Module.html">Module</a>.
|
388
|
+
</p>
|
389
|
+
<ul>
|
390
|
+
<li>domainname: the <a href="GetText.html#M000032">textdomain</a> name.
|
391
|
+
|
392
|
+
</li>
|
393
|
+
<li>options: options as an Hash.
|
394
|
+
|
395
|
+
<ul>
|
396
|
+
<li>:path - the path to the mo-files. When the value is nil, it will search
|
397
|
+
default paths such as /usr/share/locale, /usr/local/share/locale)
|
398
|
+
|
399
|
+
</li>
|
400
|
+
<li>:<a href="GetText.html#M000046">locale</a> - the <a
|
401
|
+
href="GetText.html#M000046">locale</a> string such as
|
402
|
+
"ja_JP.UTF-8". Generally, you should use <a
|
403
|
+
href="GetText.html#M000040">GetText.set_locale</a> instead. The value is
|
404
|
+
searched order by: the value of this value > System default language.
|
405
|
+
|
406
|
+
</li>
|
407
|
+
<li>:charset - output charset. This affect the current <a
|
408
|
+
href="GetText.html#M000032">textdomain</a> only. Generally, you should use
|
409
|
+
<a href="GetText.html#M000043">GetText.set_output_charset</a> instead. The
|
410
|
+
value is searched order by: the value of Locale.set_output_charset >
|
411
|
+
ENV["OUTPUT_CHARSET"] > this value > System default
|
412
|
+
charset.
|
413
|
+
|
414
|
+
</li>
|
415
|
+
</ul>
|
416
|
+
</li>
|
417
|
+
<li>Returns: the <a
|
418
|
+
href="GetText/TextDomainManager.html">GetText::TextDomainManager</a>.
|
419
|
+
|
420
|
+
</li>
|
421
|
+
</ul>
|
422
|
+
<p>
|
423
|
+
Note: Don‘t use locale_, charset argument(not in options). They are
|
424
|
+
remained for backward compatibility.
|
425
|
+
</p>
|
426
|
+
<p><a class="source-toggle" href="#"
|
427
|
+
onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
|
428
|
+
<div class="method-source-code" id="M000030-source">
|
429
|
+
<pre>
|
430
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 82</span>
|
431
|
+
82: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bindtextdomain</span>(<span class="ruby-identifier">domainname</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-identifier">locale_</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">charset</span> = <span class="ruby-keyword kw">nil</span>)
|
432
|
+
83: <span class="ruby-identifier">opt</span> = {}
|
433
|
+
84: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">String</span>
|
434
|
+
85: <span class="ruby-comment cmt"># For backward compatibility</span>
|
435
|
+
86: <span class="ruby-identifier">opt</span> = {<span class="ruby-identifier">:path</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>, <span class="ruby-identifier">:locale</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">locale_</span>, <span class="ruby-identifier">:charset</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">charset</span>}
|
436
|
+
87: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>
|
437
|
+
88: <span class="ruby-identifier">opt</span> = <span class="ruby-identifier">options</span>
|
438
|
+
89: <span class="ruby-keyword kw">end</span>
|
439
|
+
90: <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:locale</span>] = <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:locale</span>] <span class="ruby-operator">?</span> <span class="ruby-constant">Locale</span><span class="ruby-operator">::</span><span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:locale</span>]) <span class="ruby-operator">:</span> <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">get</span>
|
440
|
+
91: <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:charset</span>] = <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">output_charset</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">output_charset</span>
|
441
|
+
92: <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:locale</span>].<span class="ruby-identifier">charset</span> = <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:charset</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:charset</span>]
|
442
|
+
93: <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">set_current</span>(<span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:locale</span>])
|
443
|
+
94: <span class="ruby-identifier">target_key</span> = <span class="ruby-identifier">bound_target</span>
|
444
|
+
95: <span class="ruby-identifier">manager</span> = <span class="ruby-ivar">@@__textdomainmanagers</span>[<span class="ruby-identifier">target_key</span>]
|
445
|
+
96: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">manager</span>
|
446
|
+
97: <span class="ruby-identifier">manager</span>.<span class="ruby-identifier">set_locale</span>(<span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:locale</span>])
|
447
|
+
98: <span class="ruby-keyword kw">else</span>
|
448
|
+
99: <span class="ruby-identifier">manager</span> = <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">target_key</span>, <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">:locale</span>])
|
449
|
+
100: <span class="ruby-ivar">@@__textdomainmanagers</span>[<span class="ruby-identifier">target_key</span>] = <span class="ruby-identifier">manager</span>
|
450
|
+
101: <span class="ruby-keyword kw">end</span>
|
451
|
+
102: <span class="ruby-identifier">manager</span>.<span class="ruby-identifier">add_textdomain</span>(<span class="ruby-identifier">domainname</span>, <span class="ruby-identifier">opt</span>)
|
452
|
+
103: <span class="ruby-identifier">manager</span>
|
453
|
+
104: <span class="ruby-keyword kw">end</span>
|
454
|
+
</pre>
|
455
|
+
</div>
|
456
|
+
</div>
|
457
|
+
</div>
|
458
|
+
|
459
|
+
<div id="method-M000031" class="method-detail">
|
460
|
+
<a name="M000031"></a>
|
461
|
+
|
462
|
+
<div class="method-heading">
|
463
|
+
<a href="#M000031" class="method-signature">
|
464
|
+
<span class="method-name">bindtextdomain_to</span><span class="method-args">(klass, domainname, options = {})</span>
|
465
|
+
</a>
|
466
|
+
</div>
|
467
|
+
|
468
|
+
<div class="method-description">
|
469
|
+
<p>
|
470
|
+
Includes <a href="GetText.html">GetText</a> module and bind a <a
|
471
|
+
href="GetText.html#M000032">textdomain</a> to a class.
|
472
|
+
</p>
|
473
|
+
<ul>
|
474
|
+
<li>klass: the target ruby class.
|
475
|
+
|
476
|
+
</li>
|
477
|
+
<li>domainname: the <a href="GetText.html#M000032">textdomain</a> name.
|
478
|
+
|
479
|
+
</li>
|
480
|
+
<li>options: options as an Hash. See <a
|
481
|
+
href="GetText.html#M000030">GetText.bindtextdomain</a>.
|
482
|
+
|
483
|
+
</li>
|
484
|
+
</ul>
|
485
|
+
<p><a class="source-toggle" href="#"
|
486
|
+
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
|
487
|
+
<div class="method-source-code" id="M000031-source">
|
488
|
+
<pre>
|
489
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 110</span>
|
490
|
+
110: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bindtextdomain_to</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">domainname</span>, <span class="ruby-identifier">options</span> = {})
|
491
|
+
111: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
492
|
+
112: <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">module_eval</span> {
|
493
|
+
113: <span class="ruby-identifier">include</span> <span class="ruby-constant">GetText</span>
|
494
|
+
114: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">bindtextdomain</span>(<span class="ruby-identifier">domainname</span>, <span class="ruby-identifier">options</span>)
|
495
|
+
115: }
|
496
|
+
116: <span class="ruby-identifier">ret</span>
|
497
|
+
117: <span class="ruby-keyword kw">end</span>
|
498
|
+
</pre>
|
499
|
+
</div>
|
500
|
+
</div>
|
501
|
+
</div>
|
502
|
+
|
503
|
+
<div id="method-M000027" class="method-detail">
|
504
|
+
<a name="M000027"></a>
|
505
|
+
|
506
|
+
<div class="method-heading">
|
507
|
+
<a href="#M000027" class="method-signature">
|
508
|
+
<span class="method-name">cached=</span><span class="method-args">(val)</span>
|
509
|
+
</a>
|
510
|
+
</div>
|
511
|
+
|
512
|
+
<div class="method-description">
|
513
|
+
<p>
|
514
|
+
Set the value whether cache messages or not. true to cache messages,
|
515
|
+
otherwise false.
|
516
|
+
</p>
|
517
|
+
<p>
|
518
|
+
Default is true. If $DEBUG is false, messages are not checked even if this
|
519
|
+
value is true.
|
520
|
+
</p>
|
521
|
+
<p><a class="source-toggle" href="#"
|
522
|
+
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
523
|
+
<div class="method-source-code" id="M000027-source">
|
524
|
+
<pre>
|
525
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 39</span>
|
526
|
+
39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cached=</span>(<span class="ruby-identifier">val</span>)
|
527
|
+
40: <span class="ruby-ivar">@@__cached</span> = <span class="ruby-identifier">val</span>
|
528
|
+
41: <span class="ruby-constant">GetText</span><span class="ruby-operator">::</span><span class="ruby-constant">TextDomain</span>.<span class="ruby-identifier">check_mo</span> = <span class="ruby-operator">!</span> <span class="ruby-identifier">val</span>
|
529
|
+
42: <span class="ruby-keyword kw">end</span>
|
530
|
+
</pre>
|
531
|
+
</div>
|
532
|
+
</div>
|
533
|
+
</div>
|
534
|
+
|
535
|
+
<div id="method-M000028" class="method-detail">
|
536
|
+
<a name="M000028"></a>
|
537
|
+
|
538
|
+
<div class="method-heading">
|
539
|
+
<a href="#M000028" class="method-signature">
|
540
|
+
<span class="method-name">cached?</span><span class="method-args">()</span>
|
541
|
+
</a>
|
542
|
+
</div>
|
543
|
+
|
544
|
+
<div class="method-description">
|
545
|
+
<p>
|
546
|
+
Return the cached value.
|
547
|
+
</p>
|
548
|
+
<p><a class="source-toggle" href="#"
|
549
|
+
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
550
|
+
<div class="method-source-code" id="M000028-source">
|
551
|
+
<pre>
|
552
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 45</span>
|
553
|
+
45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cached?</span>
|
554
|
+
46: <span class="ruby-ivar">@@__cached</span>
|
555
|
+
47: <span class="ruby-keyword kw">end</span>
|
556
|
+
</pre>
|
557
|
+
</div>
|
558
|
+
</div>
|
559
|
+
</div>
|
560
|
+
|
561
|
+
<div id="method-M000025" class="method-detail">
|
562
|
+
<a name="M000025"></a>
|
563
|
+
|
564
|
+
<div class="method-heading">
|
565
|
+
<a href="#M000025" class="method-signature">
|
566
|
+
<span class="method-name">cgi</span><span class="method-args">()</span>
|
567
|
+
</a>
|
568
|
+
</div>
|
569
|
+
|
570
|
+
<div class="method-description">
|
571
|
+
<p>
|
572
|
+
Gets the CGI object. If it is nil, returns new CGI object.
|
573
|
+
</p>
|
574
|
+
<ul>
|
575
|
+
<li>Returns: the CGI object
|
576
|
+
|
577
|
+
</li>
|
578
|
+
</ul>
|
579
|
+
<p><a class="source-toggle" href="#"
|
580
|
+
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
581
|
+
<div class="method-source-code" id="M000025-source">
|
582
|
+
<pre>
|
583
|
+
<span class="ruby-comment cmt"># File lib/gettext/cgi.rb, line 36</span>
|
584
|
+
36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cgi</span>
|
585
|
+
37: <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">cgi</span>
|
586
|
+
38: <span class="ruby-keyword kw">end</span>
|
587
|
+
</pre>
|
588
|
+
</div>
|
589
|
+
</div>
|
590
|
+
</div>
|
591
|
+
|
592
|
+
<div id="method-M000024" class="method-detail">
|
593
|
+
<a name="M000024"></a>
|
594
|
+
|
595
|
+
<div class="method-heading">
|
596
|
+
<a href="#M000024" class="method-signature">
|
597
|
+
<span class="method-name">cgi=</span><span class="method-args">(cgi_)</span>
|
598
|
+
</a>
|
599
|
+
</div>
|
600
|
+
|
601
|
+
<div class="method-description">
|
602
|
+
<p>
|
603
|
+
Same as <a href="GetText.html#M000023">GetText.set_cgi</a>.
|
604
|
+
</p>
|
605
|
+
<ul>
|
606
|
+
<li>cgi_: CGI object
|
607
|
+
|
608
|
+
</li>
|
609
|
+
<li>Returns: cgi_
|
610
|
+
|
611
|
+
</li>
|
612
|
+
</ul>
|
613
|
+
<p><a class="source-toggle" href="#"
|
614
|
+
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
615
|
+
<div class="method-source-code" id="M000024-source">
|
616
|
+
<pre>
|
617
|
+
<span class="ruby-comment cmt"># File lib/gettext/cgi.rb, line 29</span>
|
618
|
+
29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cgi=</span>(<span class="ruby-identifier">cgi_</span>)
|
619
|
+
30: <span class="ruby-identifier">set_cgi</span>(<span class="ruby-identifier">cgi_</span>)
|
620
|
+
31: <span class="ruby-identifier">cgi_</span>
|
621
|
+
32: <span class="ruby-keyword kw">end</span>
|
622
|
+
</pre>
|
623
|
+
</div>
|
624
|
+
</div>
|
625
|
+
</div>
|
626
|
+
|
627
|
+
<div id="method-M000029" class="method-detail">
|
628
|
+
<a name="M000029"></a>
|
629
|
+
|
630
|
+
<div class="method-heading">
|
631
|
+
<a href="#M000029" class="method-signature">
|
632
|
+
<span class="method-name">clear_cache</span><span class="method-args">()</span>
|
633
|
+
</a>
|
634
|
+
</div>
|
635
|
+
|
636
|
+
<div class="method-description">
|
637
|
+
<p>
|
638
|
+
Clear the cached messages.
|
639
|
+
</p>
|
640
|
+
<p><a class="source-toggle" href="#"
|
641
|
+
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
|
642
|
+
<div class="method-source-code" id="M000029-source">
|
643
|
+
<pre>
|
644
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 50</span>
|
645
|
+
50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear_cache</span>
|
646
|
+
51: <span class="ruby-ivar">@@__cache_msgids</span> = {}
|
647
|
+
52: <span class="ruby-ivar">@@__cache_nmsgids</span> = {}
|
648
|
+
53: <span class="ruby-ivar">@@__cache_target_classes</span> = {}
|
649
|
+
54: <span class="ruby-ivar">@@__cache_bound_target</span> = {}
|
650
|
+
55: <span class="ruby-ivar">@@__cache_bound_targets</span> = {}
|
651
|
+
56: <span class="ruby-keyword kw">end</span>
|
652
|
+
</pre>
|
653
|
+
</div>
|
654
|
+
</div>
|
655
|
+
</div>
|
656
|
+
|
657
|
+
<div id="method-M000019" class="method-detail">
|
658
|
+
<a name="M000019"></a>
|
659
|
+
|
660
|
+
<div class="method-heading">
|
661
|
+
<a href="#M000019" class="method-signature">
|
662
|
+
<span class="method-name">create_mofiles</span><span class="method-args">(verbose = false, podir = "./po", targetdir = "./data/locale", targetpath_rule = "%s/LC_MESSAGES")</span>
|
663
|
+
</a>
|
664
|
+
</div>
|
665
|
+
|
666
|
+
<div class="method-description">
|
667
|
+
<p>
|
668
|
+
Creates mo-files using #{po_root}/#{lang}/*.po an put them to
|
669
|
+
#{targetdir}/#{targetpath_rule}/.
|
670
|
+
</p>
|
671
|
+
<p>
|
672
|
+
This is a convenience function of <a
|
673
|
+
href="GetText.html#M000022">GetText.rmsgfmt</a> for plural target files.
|
674
|
+
</p>
|
675
|
+
<ul>
|
676
|
+
<li>verbose: true if verbose mode, otherwise false
|
677
|
+
|
678
|
+
</li>
|
679
|
+
<li>po_root: the root directory of po-files.
|
680
|
+
|
681
|
+
</li>
|
682
|
+
<li>targetdir: the target root directory where the mo-files are stored.
|
683
|
+
|
684
|
+
</li>
|
685
|
+
<li>targetpath_rule: the target directory for each mo-files. "%s"
|
686
|
+
becomes "#{lang}" under po_root.
|
687
|
+
|
688
|
+
</li>
|
689
|
+
</ul>
|
690
|
+
<p><a class="source-toggle" href="#"
|
691
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
692
|
+
<div class="method-source-code" id="M000019-source">
|
693
|
+
<pre>
|
694
|
+
<span class="ruby-comment cmt"># File lib/gettext/utils.rb, line 89</span>
|
695
|
+
89: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_mofiles</span>(<span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>,
|
696
|
+
90: <span class="ruby-identifier">podir</span> = <span class="ruby-value str">"./po"</span>, <span class="ruby-identifier">targetdir</span> = <span class="ruby-value str">"./data/locale"</span>,
|
697
|
+
91: <span class="ruby-identifier">targetpath_rule</span> = <span class="ruby-value str">"%s/LC_MESSAGES"</span>)
|
698
|
+
92:
|
699
|
+
93: <span class="ruby-identifier">modir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">targetdir</span>, <span class="ruby-identifier">targetpath_rule</span>)
|
700
|
+
94: <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">podir</span>, <span class="ruby-value str">"*/*.po"</span>)) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
701
|
+
95: <span class="ruby-identifier">lang</span>, <span class="ruby-identifier">basename</span> = <span class="ruby-regexp re">/\/([^\/]+?)\/(.*)\.po/</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">file</span>[<span class="ruby-identifier">podir</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]).<span class="ruby-identifier">to_a</span>[<span class="ruby-value">1</span>,<span class="ruby-value">2</span>]
|
702
|
+
96: <span class="ruby-identifier">outdir</span> = <span class="ruby-identifier">modir</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">lang</span>
|
703
|
+
97: <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">outdir</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">outdir</span>)
|
704
|
+
98: <span class="ruby-identifier">rmsgfmt</span>(<span class="ruby-identifier">file</span>, <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">outdir</span>, <span class="ruby-node">"#{basename}.mo"</span>))
|
705
|
+
99: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">verbose</span>
|
706
|
+
100: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">%Q[#{file} -> #{File.join(outdir, "#{basename}.mo")}]</span>
|
707
|
+
101: <span class="ruby-keyword kw">end</span>
|
708
|
+
102: <span class="ruby-keyword kw">end</span>
|
709
|
+
103: <span class="ruby-keyword kw">end</span>
|
710
|
+
</pre>
|
711
|
+
</div>
|
712
|
+
</div>
|
713
|
+
</div>
|
714
|
+
|
715
|
+
<div id="method-M000048" class="method-detail">
|
716
|
+
<a name="M000048"></a>
|
717
|
+
|
718
|
+
<div class="method-heading">
|
719
|
+
<a href="#M000048" class="method-signature">
|
720
|
+
<span class="method-name">current_textdomain_info</span><span class="method-args">(options = {})</span>
|
721
|
+
</a>
|
722
|
+
</div>
|
723
|
+
|
724
|
+
<div class="method-description">
|
725
|
+
<p>
|
726
|
+
Show the current <a href="GetText.html#M000032">textdomain</a> information.
|
727
|
+
This function is for debugging.
|
728
|
+
</p>
|
729
|
+
<ul>
|
730
|
+
<li>options: options as a Hash.
|
731
|
+
|
732
|
+
<ul>
|
733
|
+
<li>:with_messages - show informations with messages of the current mo file.
|
734
|
+
Default is false.
|
735
|
+
|
736
|
+
</li>
|
737
|
+
<li>:out - An output target. Default is STDOUT.
|
738
|
+
|
739
|
+
</li>
|
740
|
+
<li>:with_paths - show the load paths for mo-files.
|
741
|
+
|
742
|
+
</li>
|
743
|
+
</ul>
|
744
|
+
</li>
|
745
|
+
</ul>
|
746
|
+
<p><a class="source-toggle" href="#"
|
747
|
+
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
|
748
|
+
<div class="method-source-code" id="M000048-source">
|
749
|
+
<pre>
|
750
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 501</span>
|
751
|
+
501: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_textdomain_info</span>(<span class="ruby-identifier">options</span> = {})
|
752
|
+
502: <span class="ruby-identifier">opts</span> = {<span class="ruby-identifier">:with_messages</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">:with_paths</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">:out</span> =<span class="ruby-operator">></span> <span class="ruby-constant">STDOUT</span>}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
|
753
|
+
503: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
754
|
+
504: <span class="ruby-identifier">each_textdomain</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">textdomain</span><span class="ruby-operator">|</span>
|
755
|
+
505: <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:out</span>].<span class="ruby-identifier">puts</span> <span class="ruby-node">"TextDomain name: \"#{textdomain.name}\""</span>
|
756
|
+
506: <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:out</span>].<span class="ruby-identifier">puts</span> <span class="ruby-node">"TextDomain current locale: \"#{textdomain.current_locale}\""</span>
|
757
|
+
507: <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:out</span>].<span class="ruby-identifier">puts</span> <span class="ruby-node">"TextDomain current mo filename: \"#{textdomain.current_mo.filename}\""</span>
|
758
|
+
508: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:with_paths</span>]
|
759
|
+
509: <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:out</span>].<span class="ruby-identifier">puts</span> <span class="ruby-value str">"TextDomain locale file paths:"</span>
|
760
|
+
510: <span class="ruby-identifier">textdomain</span>.<span class="ruby-identifier">locale_paths</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
761
|
+
511: <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:out</span>].<span class="ruby-identifier">puts</span> <span class="ruby-node">" #{v}"</span>
|
762
|
+
512: <span class="ruby-keyword kw">end</span>
|
763
|
+
513: <span class="ruby-keyword kw">end</span>
|
764
|
+
514: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:with_messages</span>]
|
765
|
+
515: <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:out</span>].<span class="ruby-identifier">puts</span> <span class="ruby-value str">"The messages in the mo file:"</span>
|
766
|
+
516: <span class="ruby-identifier">textdomain</span>.<span class="ruby-identifier">current_mo</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
767
|
+
517: <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:out</span>].<span class="ruby-identifier">puts</span> <span class="ruby-node">" \"#{k}\": \"#{v}\""</span>
|
768
|
+
518: }
|
769
|
+
519: <span class="ruby-keyword kw">end</span>
|
770
|
+
520: }
|
771
|
+
521: <span class="ruby-keyword kw">end</span>
|
772
|
+
</pre>
|
773
|
+
</div>
|
774
|
+
</div>
|
775
|
+
</div>
|
776
|
+
|
777
|
+
<div id="method-M000034" class="method-detail">
|
778
|
+
<a name="M000034"></a>
|
779
|
+
|
780
|
+
<div class="method-heading">
|
781
|
+
<a href="#M000034" class="method-signature">
|
782
|
+
<span class="method-name">gettext(msgid)<br />
|
783
|
+
_(msgid)<br />
|
784
|
+
</span>
|
785
|
+
</a>
|
786
|
+
</div>
|
787
|
+
|
788
|
+
<div class="method-description">
|
789
|
+
<p>
|
790
|
+
Translates msgid and return the message.
|
791
|
+
</p>
|
792
|
+
<ul>
|
793
|
+
<li>msgid: the message id.
|
794
|
+
|
795
|
+
</li>
|
796
|
+
<li>Returns: localized text by msgid. If there are not binded mo-file, it will
|
797
|
+
return msgid.
|
798
|
+
|
799
|
+
</li>
|
800
|
+
</ul>
|
801
|
+
<p><a class="source-toggle" href="#"
|
802
|
+
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
803
|
+
<div class="method-source-code" id="M000034-source">
|
804
|
+
<pre>
|
805
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 243</span>
|
806
|
+
243: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gettext</span>(<span class="ruby-identifier">msgid</span>)
|
807
|
+
244: <span class="ruby-identifier">sgettext</span>(<span class="ruby-identifier">msgid</span>, <span class="ruby-keyword kw">nil</span>)
|
808
|
+
245: <span class="ruby-keyword kw">end</span>
|
809
|
+
</pre>
|
810
|
+
</div>
|
811
|
+
</div>
|
812
|
+
</div>
|
813
|
+
|
814
|
+
<div id="method-M000046" class="method-detail">
|
815
|
+
<a name="M000046"></a>
|
816
|
+
|
817
|
+
<div class="method-heading">
|
818
|
+
<a href="#M000046" class="method-signature">
|
819
|
+
<span class="method-name">locale</span><span class="method-args">()</span>
|
820
|
+
</a>
|
821
|
+
</div>
|
822
|
+
|
823
|
+
<div class="method-description">
|
824
|
+
<p>
|
825
|
+
Gets the current <a href="GetText.html#M000046">locale</a>.
|
826
|
+
</p>
|
827
|
+
<ul>
|
828
|
+
<li>Returns: a current <a href="Locale/Object.html">Locale::Object</a>
|
829
|
+
|
830
|
+
</li>
|
831
|
+
</ul>
|
832
|
+
<p><a class="source-toggle" href="#"
|
833
|
+
onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
|
834
|
+
<div class="method-source-code" id="M000046-source">
|
835
|
+
<pre>
|
836
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 484</span>
|
837
|
+
484: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">locale</span>
|
838
|
+
485: <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">current</span>
|
839
|
+
486: <span class="ruby-keyword kw">end</span>
|
840
|
+
</pre>
|
841
|
+
</div>
|
842
|
+
</div>
|
843
|
+
</div>
|
844
|
+
|
845
|
+
<div id="method-M000042" class="method-detail">
|
846
|
+
<a name="M000042"></a>
|
847
|
+
|
848
|
+
<div class="method-heading">
|
849
|
+
<a href="#M000042" class="method-signature">
|
850
|
+
<span class="method-name">locale=</span><span class="method-args">(locale)</span>
|
851
|
+
</a>
|
852
|
+
</div>
|
853
|
+
|
854
|
+
<div class="method-description">
|
855
|
+
<p>
|
856
|
+
Sets the default/current <a href="GetText.html#M000046">locale</a>. This
|
857
|
+
method haves the strongest infulence. All of the Textdomains are set the
|
858
|
+
new <a href="GetText.html#M000046">locale</a>.
|
859
|
+
</p>
|
860
|
+
<p>
|
861
|
+
Note that you shouldn‘t use this for your own Libraries.
|
862
|
+
</p>
|
863
|
+
<ul>
|
864
|
+
<li><a href="GetText.html#M000046">locale</a>: a <a
|
865
|
+
href="GetText.html#M000046">locale</a> string or <a
|
866
|
+
href="Locale/Object.html">Locale::Object</a>
|
867
|
+
|
868
|
+
</li>
|
869
|
+
<li>Returns: a <a href="GetText.html#M000046">locale</a> string
|
870
|
+
|
871
|
+
</li>
|
872
|
+
</ul>
|
873
|
+
<p><a class="source-toggle" href="#"
|
874
|
+
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
|
875
|
+
<div class="method-source-code" id="M000042-source">
|
876
|
+
<pre>
|
877
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 454</span>
|
878
|
+
454: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">locale=</span>(<span class="ruby-identifier">locale</span>)
|
879
|
+
455: <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">default</span> = <span class="ruby-identifier">locale</span>
|
880
|
+
456: <span class="ruby-identifier">set_locale_all</span>(<span class="ruby-identifier">locale</span>)
|
881
|
+
457: <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">default</span>
|
882
|
+
458: <span class="ruby-keyword kw">end</span>
|
883
|
+
</pre>
|
884
|
+
</div>
|
885
|
+
</div>
|
886
|
+
</div>
|
887
|
+
|
888
|
+
<div id="method-M000018" class="method-detail">
|
889
|
+
<a name="M000018"></a>
|
890
|
+
|
891
|
+
<div class="method-heading">
|
892
|
+
<a href="#M000018" class="method-signature">
|
893
|
+
<span class="method-name">msgmerge</span><span class="method-args">(defpo, refpo, app_version)</span>
|
894
|
+
</a>
|
895
|
+
</div>
|
896
|
+
|
897
|
+
<div class="method-description">
|
898
|
+
<p>
|
899
|
+
Merges two Uniforum style .po files together.
|
900
|
+
</p>
|
901
|
+
<p>
|
902
|
+
<b>Note</b> This function requires "<a
|
903
|
+
href="GetText.html#M000018">msgmerge</a>" tool included in GNU <a
|
904
|
+
href="GetText.html">GetText</a>. So you need to install GNU <a
|
905
|
+
href="GetText.html">GetText</a>.
|
906
|
+
</p>
|
907
|
+
<p>
|
908
|
+
The def.po file is an existing PO file with translations which will be
|
909
|
+
taken over to the newly created file as long as they still match; comments
|
910
|
+
will be preserved, but extracted comments and file positions will be
|
911
|
+
discarded.
|
912
|
+
</p>
|
913
|
+
<p>
|
914
|
+
The ref.pot file is the last created PO file with up-to-date source
|
915
|
+
references but old translations, or a PO Template file (generally created
|
916
|
+
by <a href="GetText.html#M000021">rgettext</a>); any translations or
|
917
|
+
comments in the file will be discarded, however dot comments and file
|
918
|
+
positions will be preserved. Where an exact match cannot be found, fuzzy
|
919
|
+
matching is used to produce better results.
|
920
|
+
</p>
|
921
|
+
<p>
|
922
|
+
Usually you don‘t need to call this function directly. Use <a
|
923
|
+
href="GetText.html#M000020">GetText.update_pofiles</a> instead.
|
924
|
+
</p>
|
925
|
+
<ul>
|
926
|
+
<li>defpo: a po-file. translations referring to old sources
|
927
|
+
|
928
|
+
</li>
|
929
|
+
<li>refpo: a po-file. references to new sources
|
930
|
+
|
931
|
+
</li>
|
932
|
+
<li>app_version: the application information which appears
|
933
|
+
"Project-Id-Version: #{app_version}" in the pot/po-files.
|
934
|
+
|
935
|
+
</li>
|
936
|
+
<li>Returns: self
|
937
|
+
|
938
|
+
</li>
|
939
|
+
</ul>
|
940
|
+
<p><a class="source-toggle" href="#"
|
941
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
942
|
+
<div class="method-source-code" id="M000018-source">
|
943
|
+
<pre>
|
944
|
+
<span class="ruby-comment cmt"># File lib/gettext/utils.rb, line 44</span>
|
945
|
+
44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">msgmerge</span>(<span class="ruby-identifier">defpo</span>, <span class="ruby-identifier">refpo</span>, <span class="ruby-identifier">app_version</span>)
|
946
|
+
45: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">defpo</span>
|
947
|
+
46: <span class="ruby-identifier">cmd</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">"MSGMERGE_PATH"</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">"msgmerge"</span>
|
948
|
+
47:
|
949
|
+
48: <span class="ruby-identifier">cont</span> = <span class="ruby-value str">""</span>
|
950
|
+
49: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">FileTest</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">defpo</span>
|
951
|
+
50: <span class="ruby-identifier">cont</span> = <span class="ruby-node">`#{cmd} #{defpo} #{refpo}`</span>
|
952
|
+
51: <span class="ruby-keyword kw">else</span>
|
953
|
+
52: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">refpo</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
|
954
|
+
53: <span class="ruby-identifier">cont</span> = <span class="ruby-identifier">io</span>.<span class="ruby-identifier">read</span>
|
955
|
+
54: <span class="ruby-keyword kw">end</span>
|
956
|
+
55: <span class="ruby-keyword kw">end</span>
|
957
|
+
56: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cont</span>.<span class="ruby-identifier">empty?</span>
|
958
|
+
57: <span class="ruby-identifier">failed_filename</span> = <span class="ruby-identifier">refpo</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"~"</span>
|
959
|
+
58: <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">cp</span>(<span class="ruby-identifier">refpo</span>, <span class="ruby-identifier">failed_filename</span>)
|
960
|
+
59: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">_</span>(<span class="ruby-value str">"Failed to merge with %{defpo}"</span>) <span class="ruby-operator">%</span> {<span class="ruby-identifier">:defpo</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">defpo</span>}
|
961
|
+
60: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">_</span>(<span class="ruby-value str">"New .pot was copied to %{failed_filename}"</span>) <span class="ruby-operator">%</span>{<span class="ruby-identifier">:failed_filename</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">failed_filename</span>}
|
962
|
+
61: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">_</span>(<span class="ruby-node">"`#{cmd}' may not be found. \nInstall GNU Gettext then set PATH or MSGMERGE_PATH correctly."</span>)
|
963
|
+
62: <span class="ruby-keyword kw">else</span>
|
964
|
+
63: <span class="ruby-identifier">cont</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/(Project-Id-Version\:).*$/</span>, <span class="ruby-node">"\\1 #{app_version}\\n\""</span>)
|
965
|
+
64: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">defpo</span>, <span class="ruby-value str">"w"</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
|
966
|
+
65: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">cont</span>)
|
967
|
+
66: <span class="ruby-keyword kw">end</span>
|
968
|
+
67: <span class="ruby-keyword kw">end</span>
|
969
|
+
68: <span class="ruby-keyword kw">self</span>
|
970
|
+
69: <span class="ruby-keyword kw">end</span>
|
971
|
+
</pre>
|
972
|
+
</div>
|
973
|
+
</div>
|
974
|
+
</div>
|
975
|
+
|
976
|
+
<div id="method-M000051" class="method-detail">
|
977
|
+
<a name="M000051"></a>
|
978
|
+
|
979
|
+
<div class="method-heading">
|
980
|
+
<span class="method-name">n_</span><span class="method-args">(arg1, arg2, arg3 = nil)</span>
|
981
|
+
</div>
|
982
|
+
|
983
|
+
<div class="method-description">
|
984
|
+
<p>
|
985
|
+
Alias for <a href="GetText.html#M000036">ngettext</a>
|
986
|
+
</p>
|
987
|
+
</div>
|
988
|
+
</div>
|
989
|
+
|
990
|
+
<div id="method-M000036" class="method-detail">
|
991
|
+
<a name="M000036"></a>
|
992
|
+
|
993
|
+
<div class="method-heading">
|
994
|
+
<a href="#M000036" class="method-signature">
|
995
|
+
<span class="method-name">ngettext(msgid, msgid_plural, n)<br />
|
996
|
+
ngettext(msgids, n) # msgids = [msgid, msgid_plural]<br />
|
997
|
+
n_(msgid, msgid_plural, n)<br />
|
998
|
+
n_(msgids, n) # msgids = [msgid, msgid_plural]<br />
|
999
|
+
</span>
|
1000
|
+
</a>
|
1001
|
+
</div>
|
1002
|
+
|
1003
|
+
<div class="method-description">
|
1004
|
+
<p>
|
1005
|
+
The <a href="GetText.html#M000036">ngettext</a> is similar to the <a
|
1006
|
+
href="GetText.html#M000034">gettext</a> function as it finds the message
|
1007
|
+
catalogs in the same way. But it takes two extra arguments for plural form.
|
1008
|
+
</p>
|
1009
|
+
<ul>
|
1010
|
+
<li>msgid: the singular form.
|
1011
|
+
|
1012
|
+
</li>
|
1013
|
+
<li>msgid_plural: the plural form.
|
1014
|
+
|
1015
|
+
</li>
|
1016
|
+
<li>n: a number used to determine the plural form.
|
1017
|
+
|
1018
|
+
</li>
|
1019
|
+
<li>Returns: the localized text which key is msgid_plural if n is plural(follow
|
1020
|
+
plural-rule) or msgid. "plural-rule" is defined in po-file.
|
1021
|
+
|
1022
|
+
</li>
|
1023
|
+
</ul>
|
1024
|
+
<p><a class="source-toggle" href="#"
|
1025
|
+
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
1026
|
+
<div class="method-source-code" id="M000036-source">
|
1027
|
+
<pre>
|
1028
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 303</span>
|
1029
|
+
303: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ngettext</span>(<span class="ruby-identifier">arg1</span>, <span class="ruby-identifier">arg2</span>, <span class="ruby-identifier">arg3</span> = <span class="ruby-keyword kw">nil</span>)
|
1030
|
+
304: <span class="ruby-identifier">nsgettext</span>(<span class="ruby-identifier">arg1</span>, <span class="ruby-identifier">arg2</span>, <span class="ruby-identifier">arg3</span>, <span class="ruby-keyword kw">nil</span>)
|
1031
|
+
305: <span class="ruby-keyword kw">end</span>
|
1032
|
+
</pre>
|
1033
|
+
</div>
|
1034
|
+
</div>
|
1035
|
+
</div>
|
1036
|
+
|
1037
|
+
<div id="method-M000053" class="method-detail">
|
1038
|
+
<a name="M000053"></a>
|
1039
|
+
|
1040
|
+
<div class="method-heading">
|
1041
|
+
<span class="method-name">ns_</span><span class="method-args">(arg1, arg2, arg3 = "|", arg4 = "|")</span>
|
1042
|
+
</div>
|
1043
|
+
|
1044
|
+
<div class="method-description">
|
1045
|
+
<p>
|
1046
|
+
Alias for <a href="GetText.html#M000039">nsgettext</a>
|
1047
|
+
</p>
|
1048
|
+
</div>
|
1049
|
+
</div>
|
1050
|
+
|
1051
|
+
<div id="method-M000039" class="method-detail">
|
1052
|
+
<a name="M000039"></a>
|
1053
|
+
|
1054
|
+
<div class="method-heading">
|
1055
|
+
<a href="#M000039" class="method-signature">
|
1056
|
+
<span class="method-name">nsgettext(msgid, msgid_plural, n, div = "|")<br />
|
1057
|
+
nsgettext(msgids, n, div = "|") # msgids = [msgid, msgid_plural]<br />
|
1058
|
+
n_(msgid, msgid_plural, n, div = "|")<br />
|
1059
|
+
n_(msgids, n, div = "|") # msgids = [msgid, msgid_plural]<br />
|
1060
|
+
</span>
|
1061
|
+
</a>
|
1062
|
+
</div>
|
1063
|
+
|
1064
|
+
<div class="method-description">
|
1065
|
+
<p>
|
1066
|
+
The <a href="GetText.html#M000039">nsgettext</a> is similar to the <a
|
1067
|
+
href="GetText.html#M000036">ngettext</a>. But if there are no localized
|
1068
|
+
text, it returns a last part of msgid separeted "div".
|
1069
|
+
</p>
|
1070
|
+
<ul>
|
1071
|
+
<li>msgid: the singular form with "div". (e.g. "Special|An
|
1072
|
+
apple")
|
1073
|
+
|
1074
|
+
</li>
|
1075
|
+
<li>msgid_plural: the plural form. (e.g. "%{num} Apples")
|
1076
|
+
|
1077
|
+
</li>
|
1078
|
+
<li>n: a number used to determine the plural form.
|
1079
|
+
|
1080
|
+
</li>
|
1081
|
+
<li>Returns: the localized text which key is msgid_plural if n is plural(follow
|
1082
|
+
plural-rule) or msgid. "plural-rule" is defined in po-file.
|
1083
|
+
|
1084
|
+
</li>
|
1085
|
+
</ul>
|
1086
|
+
<p><a class="source-toggle" href="#"
|
1087
|
+
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
|
1088
|
+
<div class="method-source-code" id="M000039-source">
|
1089
|
+
<pre>
|
1090
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 338</span>
|
1091
|
+
338: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nsgettext</span>(<span class="ruby-identifier">arg1</span>, <span class="ruby-identifier">arg2</span>, <span class="ruby-identifier">arg3</span> = <span class="ruby-value str">"|"</span>, <span class="ruby-identifier">arg4</span> = <span class="ruby-value str">"|"</span>)
|
1092
|
+
339: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arg1</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Array</span>)
|
1093
|
+
340: <span class="ruby-identifier">msgid</span> = <span class="ruby-identifier">arg1</span>[<span class="ruby-value">0</span>]
|
1094
|
+
341: <span class="ruby-identifier">msgid_plural</span> = <span class="ruby-identifier">arg1</span>[<span class="ruby-value">1</span>]
|
1095
|
+
342: <span class="ruby-identifier">n</span> = <span class="ruby-identifier">arg2</span>
|
1096
|
+
343: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arg3</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">arg3</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Numeric</span>
|
1097
|
+
344: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-identifier">_</span>(<span class="ruby-value str">"3rd parmeter is wrong: value = %{number}"</span>) <span class="ruby-operator">%</span> {<span class="ruby-identifier">:number</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">arg3</span>}
|
1098
|
+
345: <span class="ruby-keyword kw">end</span>
|
1099
|
+
346: <span class="ruby-identifier">div</span> = <span class="ruby-identifier">arg3</span>
|
1100
|
+
347: <span class="ruby-keyword kw">else</span>
|
1101
|
+
348: <span class="ruby-identifier">msgid</span> = <span class="ruby-identifier">arg1</span>
|
1102
|
+
349: <span class="ruby-identifier">msgid_plural</span> = <span class="ruby-identifier">arg2</span>
|
1103
|
+
350: <span class="ruby-identifier">n</span> = <span class="ruby-identifier">arg3</span>
|
1104
|
+
351: <span class="ruby-identifier">div</span> = <span class="ruby-identifier">arg4</span>
|
1105
|
+
352: <span class="ruby-keyword kw">end</span>
|
1106
|
+
353:
|
1107
|
+
354: <span class="ruby-identifier">cached_key</span> = [<span class="ruby-identifier">bound_target</span>, <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">current</span>, <span class="ruby-identifier">msgid</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\000"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">msgid_plural</span>]
|
1108
|
+
355: <span class="ruby-identifier">msgs</span> = <span class="ruby-keyword kw">nil</span>
|
1109
|
+
356: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@__cached</span>
|
1110
|
+
357: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@__cache_nmsgids</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">cached_key</span>)
|
1111
|
+
358: <span class="ruby-identifier">msgs</span> = <span class="ruby-ivar">@@__cache_nmsgids</span>[<span class="ruby-identifier">cached_key</span>] <span class="ruby-comment cmt"># [msgstr, cond_as_string]</span>
|
1112
|
+
359: <span class="ruby-keyword kw">end</span>
|
1113
|
+
360: <span class="ruby-keyword kw">end</span>
|
1114
|
+
361: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">msgs</span>
|
1115
|
+
362: <span class="ruby-comment cmt"># Use "for"(not "each") to support JRuby 1.1.0.</span>
|
1116
|
+
363: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">target</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">bound_targets</span>(<span class="ruby-keyword kw">self</span>)
|
1117
|
+
364: <span class="ruby-identifier">manager</span> = <span class="ruby-ivar">@@__textdomainmanagers</span>[<span class="ruby-identifier">target</span>]
|
1118
|
+
365: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">textdomain</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">manager</span>.<span class="ruby-identifier">textdomains</span>
|
1119
|
+
366: <span class="ruby-identifier">msgs</span> = <span class="ruby-identifier">textdomain</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">ngettext_data</span>(<span class="ruby-identifier">msgid</span>, <span class="ruby-identifier">msgid_plural</span>)
|
1120
|
+
367: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">msgs</span>
|
1121
|
+
368: <span class="ruby-keyword kw">end</span>
|
1122
|
+
369: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">msgs</span>
|
1123
|
+
370: <span class="ruby-keyword kw">end</span>
|
1124
|
+
371: <span class="ruby-identifier">msgs</span> = [[<span class="ruby-identifier">msgid</span>, <span class="ruby-identifier">msgid_plural</span>], <span class="ruby-value str">"n != 1"</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">msgs</span>
|
1125
|
+
372: <span class="ruby-ivar">@@__cache_nmsgids</span>[<span class="ruby-identifier">cached_key</span>] = <span class="ruby-identifier">msgs</span>
|
1126
|
+
373: <span class="ruby-keyword kw">end</span>
|
1127
|
+
374: <span class="ruby-identifier">msgstrs</span> = <span class="ruby-identifier">msgs</span>[<span class="ruby-value">0</span>]
|
1128
|
+
375: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">div</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">msgstrs</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">msgid</span>
|
1129
|
+
376: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">index</span> = <span class="ruby-identifier">msgstrs</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">rindex</span>(<span class="ruby-identifier">div</span>)
|
1130
|
+
377: <span class="ruby-identifier">msgstrs</span>[<span class="ruby-value">0</span>] = <span class="ruby-identifier">msgstrs</span>[<span class="ruby-value">0</span>][(<span class="ruby-identifier">index</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)<span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
|
1131
|
+
378: <span class="ruby-keyword kw">end</span>
|
1132
|
+
379: <span class="ruby-keyword kw">end</span>
|
1133
|
+
380: <span class="ruby-identifier">plural</span> = <span class="ruby-identifier">eval</span>(<span class="ruby-identifier">msgs</span>[<span class="ruby-value">1</span>])
|
1134
|
+
381: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">plural</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Numeric</span>)
|
1135
|
+
382: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">msgstrs</span>[<span class="ruby-identifier">plural</span>]
|
1136
|
+
383: <span class="ruby-keyword kw">else</span>
|
1137
|
+
384: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">plural</span> <span class="ruby-value">? </span><span class="ruby-identifier">msgstrs</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">msgstrs</span>[<span class="ruby-value">0</span>]
|
1138
|
+
385: <span class="ruby-keyword kw">end</span>
|
1139
|
+
386: <span class="ruby-identifier">ret</span>
|
1140
|
+
387: <span class="ruby-keyword kw">end</span>
|
1141
|
+
</pre>
|
1142
|
+
</div>
|
1143
|
+
</div>
|
1144
|
+
</div>
|
1145
|
+
|
1146
|
+
<div id="method-M000045" class="method-detail">
|
1147
|
+
<a name="M000045"></a>
|
1148
|
+
|
1149
|
+
<div class="method-heading">
|
1150
|
+
<a href="#M000045" class="method-signature">
|
1151
|
+
<span class="method-name">output_charset</span><span class="method-args">()</span>
|
1152
|
+
</a>
|
1153
|
+
</div>
|
1154
|
+
|
1155
|
+
<div class="method-description">
|
1156
|
+
<p>
|
1157
|
+
Gets the current <a href="GetText.html#M000045">output_charset</a> which is
|
1158
|
+
set using <a href="GetText.html#M000043">GetText.set_output_charset</a>.
|
1159
|
+
</p>
|
1160
|
+
<ul>
|
1161
|
+
<li>Returns: <a href="GetText.html#M000045">output_charset</a>.
|
1162
|
+
|
1163
|
+
</li>
|
1164
|
+
</ul>
|
1165
|
+
<p><a class="source-toggle" href="#"
|
1166
|
+
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
|
1167
|
+
<div class="method-source-code" id="M000045-source">
|
1168
|
+
<pre>
|
1169
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 478</span>
|
1170
|
+
478: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">output_charset</span>
|
1171
|
+
479: <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">output_charset</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">locale</span>.<span class="ruby-identifier">charset</span>
|
1172
|
+
480: <span class="ruby-keyword kw">end</span>
|
1173
|
+
</pre>
|
1174
|
+
</div>
|
1175
|
+
</div>
|
1176
|
+
</div>
|
1177
|
+
|
1178
|
+
<div id="method-M000044" class="method-detail">
|
1179
|
+
<a name="M000044"></a>
|
1180
|
+
|
1181
|
+
<div class="method-heading">
|
1182
|
+
<a href="#M000044" class="method-signature">
|
1183
|
+
<span class="method-name">output_charset=</span><span class="method-args">(charset)</span>
|
1184
|
+
</a>
|
1185
|
+
</div>
|
1186
|
+
|
1187
|
+
<div class="method-description">
|
1188
|
+
<p>
|
1189
|
+
Same as <a href="GetText.html#M000043">GetText.set_output_charset</a>
|
1190
|
+
</p>
|
1191
|
+
<ul>
|
1192
|
+
<li>charset: an <a href="GetText.html#M000045">output_charset</a>
|
1193
|
+
|
1194
|
+
</li>
|
1195
|
+
<li>Returns: charset
|
1196
|
+
|
1197
|
+
</li>
|
1198
|
+
</ul>
|
1199
|
+
<p><a class="source-toggle" href="#"
|
1200
|
+
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
|
1201
|
+
<div class="method-source-code" id="M000044-source">
|
1202
|
+
<pre>
|
1203
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 472</span>
|
1204
|
+
472: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">output_charset=</span>(<span class="ruby-identifier">charset</span>)
|
1205
|
+
473: <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">output_charset</span> = <span class="ruby-identifier">charset</span>
|
1206
|
+
474: <span class="ruby-keyword kw">end</span>
|
1207
|
+
</pre>
|
1208
|
+
</div>
|
1209
|
+
</div>
|
1210
|
+
</div>
|
1211
|
+
|
1212
|
+
<div id="method-M000021" class="method-detail">
|
1213
|
+
<a name="M000021"></a>
|
1214
|
+
|
1215
|
+
<div class="method-heading">
|
1216
|
+
<a href="#M000021" class="method-signature">
|
1217
|
+
<span class="method-name">rgettext</span><span class="method-args">(targetfiles = nil, out = STDOUT)</span>
|
1218
|
+
</a>
|
1219
|
+
</div>
|
1220
|
+
|
1221
|
+
<div class="method-description">
|
1222
|
+
<p>
|
1223
|
+
Creates a po-file from targetfiles(ruby-script-files, ActiveRecord, .rhtml
|
1224
|
+
files, glade-2 XML files), then output the result to out. If no parameter
|
1225
|
+
is set, it behaves same as command line tools(rgettet).
|
1226
|
+
</p>
|
1227
|
+
<p>
|
1228
|
+
This function is a part of GetText.create_pofiles. Usually you don‘t
|
1229
|
+
need to call this function directly.
|
1230
|
+
</p>
|
1231
|
+
<p>
|
1232
|
+
<b>Note</b> for ActiveRecord, you need to run your database server and
|
1233
|
+
configure the config/database.xml correctly before execute this function.
|
1234
|
+
</p>
|
1235
|
+
<ul>
|
1236
|
+
<li>targetfiles: An Array of po-files or nil.
|
1237
|
+
|
1238
|
+
</li>
|
1239
|
+
<li>out: output IO or output path.
|
1240
|
+
|
1241
|
+
</li>
|
1242
|
+
<li>Returns: self
|
1243
|
+
|
1244
|
+
</li>
|
1245
|
+
</ul>
|
1246
|
+
<p><a class="source-toggle" href="#"
|
1247
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
1248
|
+
<div class="method-source-code" id="M000021-source">
|
1249
|
+
<pre>
|
1250
|
+
<span class="ruby-comment cmt"># File lib/gettext/rgettext.rb, line 259</span>
|
1251
|
+
259: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rgettext</span>(<span class="ruby-identifier">targetfiles</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">out</span> = <span class="ruby-constant">STDOUT</span>)
|
1252
|
+
260: <span class="ruby-constant">RGetText</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">targetfiles</span>, <span class="ruby-identifier">out</span>)
|
1253
|
+
261: <span class="ruby-keyword kw">self</span>
|
1254
|
+
262: <span class="ruby-keyword kw">end</span>
|
1255
|
+
</pre>
|
1256
|
+
</div>
|
1257
|
+
</div>
|
1258
|
+
</div>
|
1259
|
+
|
1260
|
+
<div id="method-M000022" class="method-detail">
|
1261
|
+
<a name="M000022"></a>
|
1262
|
+
|
1263
|
+
<div class="method-heading">
|
1264
|
+
<a href="#M000022" class="method-signature">
|
1265
|
+
<span class="method-name">rmsgfmt</span><span class="method-args">(targetfile = nil, output_path = nil)</span>
|
1266
|
+
</a>
|
1267
|
+
</div>
|
1268
|
+
|
1269
|
+
<div class="method-description">
|
1270
|
+
<p>
|
1271
|
+
Creates a mo-file from a targetfile(po-file), then output the result to
|
1272
|
+
out. If no parameter is set, it behaves same as command line tools(<a
|
1273
|
+
href="GetText.html#M000022">rmsgfmt</a>).
|
1274
|
+
</p>
|
1275
|
+
<ul>
|
1276
|
+
<li>targetfile: An Array of po-files or nil.
|
1277
|
+
|
1278
|
+
</li>
|
1279
|
+
<li>output_path: output path.
|
1280
|
+
|
1281
|
+
</li>
|
1282
|
+
<li>Returns: the <a href="MOFile.html">MOFile</a> object.
|
1283
|
+
|
1284
|
+
</li>
|
1285
|
+
</ul>
|
1286
|
+
<p><a class="source-toggle" href="#"
|
1287
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
1288
|
+
<div class="method-source-code" id="M000022-source">
|
1289
|
+
<pre>
|
1290
|
+
<span class="ruby-comment cmt"># File lib/gettext/rmsgfmt.rb, line 79</span>
|
1291
|
+
79: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rmsgfmt</span>(<span class="ruby-identifier">targetfile</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">output_path</span> = <span class="ruby-keyword kw">nil</span>)
|
1292
|
+
80: <span class="ruby-constant">RMsgfmt</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">targetfile</span>, <span class="ruby-identifier">output_path</span>)
|
1293
|
+
81: <span class="ruby-keyword kw">end</span>
|
1294
|
+
</pre>
|
1295
|
+
</div>
|
1296
|
+
</div>
|
1297
|
+
</div>
|
1298
|
+
|
1299
|
+
<div id="method-M000026" class="method-detail">
|
1300
|
+
<a name="M000026"></a>
|
1301
|
+
|
1302
|
+
<div class="method-heading">
|
1303
|
+
<a href="#M000026" class="method-signature">
|
1304
|
+
<span class="method-name">rmsgmerge</span><span class="method-args">(reference = nil, definition = nil, out = STDOUT)</span>
|
1305
|
+
</a>
|
1306
|
+
</div>
|
1307
|
+
|
1308
|
+
<div class="method-description">
|
1309
|
+
<p>
|
1310
|
+
Experimental
|
1311
|
+
</p>
|
1312
|
+
<p><a class="source-toggle" href="#"
|
1313
|
+
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
1314
|
+
<div class="method-source-code" id="M000026-source">
|
1315
|
+
<pre>
|
1316
|
+
<span class="ruby-comment cmt"># File lib/gettext/rmsgmerge.rb, line 489</span>
|
1317
|
+
489: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rmsgmerge</span>(<span class="ruby-identifier">reference</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">definition</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">out</span> = <span class="ruby-constant">STDOUT</span>)
|
1318
|
+
490: <span class="ruby-constant">RMsgMerge</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">reference</span>, <span class="ruby-identifier">definition</span>, <span class="ruby-identifier">out</span>)
|
1319
|
+
491: <span class="ruby-keyword kw">end</span>
|
1320
|
+
</pre>
|
1321
|
+
</div>
|
1322
|
+
</div>
|
1323
|
+
</div>
|
1324
|
+
|
1325
|
+
<div id="method-M000052" class="method-detail">
|
1326
|
+
<a name="M000052"></a>
|
1327
|
+
|
1328
|
+
<div class="method-heading">
|
1329
|
+
<span class="method-name">s_</span><span class="method-args">(msgid, div = '|')</span>
|
1330
|
+
</div>
|
1331
|
+
|
1332
|
+
<div class="method-description">
|
1333
|
+
<p>
|
1334
|
+
Alias for <a href="GetText.html#M000035">sgettext</a>
|
1335
|
+
</p>
|
1336
|
+
</div>
|
1337
|
+
</div>
|
1338
|
+
|
1339
|
+
<div id="method-M000023" class="method-detail">
|
1340
|
+
<a name="M000023"></a>
|
1341
|
+
|
1342
|
+
<div class="method-heading">
|
1343
|
+
<a href="#M000023" class="method-signature">
|
1344
|
+
<span class="method-name">set_cgi</span><span class="method-args">(cgi_)</span>
|
1345
|
+
</a>
|
1346
|
+
</div>
|
1347
|
+
|
1348
|
+
<div class="method-description">
|
1349
|
+
<p>
|
1350
|
+
Sets a CGI object.
|
1351
|
+
</p>
|
1352
|
+
<ul>
|
1353
|
+
<li>cgi_: CGI object
|
1354
|
+
|
1355
|
+
</li>
|
1356
|
+
<li>Returns: self
|
1357
|
+
|
1358
|
+
</li>
|
1359
|
+
</ul>
|
1360
|
+
<p><a class="source-toggle" href="#"
|
1361
|
+
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
1362
|
+
<div class="method-source-code" id="M000023-source">
|
1363
|
+
<pre>
|
1364
|
+
<span class="ruby-comment cmt"># File lib/gettext/cgi.rb, line 22</span>
|
1365
|
+
22: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_cgi</span>(<span class="ruby-identifier">cgi_</span>)
|
1366
|
+
23: <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">set_cgi</span>(<span class="ruby-identifier">cgi_</span>)
|
1367
|
+
24: <span class="ruby-keyword kw">end</span>
|
1368
|
+
</pre>
|
1369
|
+
</div>
|
1370
|
+
</div>
|
1371
|
+
</div>
|
1372
|
+
|
1373
|
+
<div id="method-M000040" class="method-detail">
|
1374
|
+
<a name="M000040"></a>
|
1375
|
+
|
1376
|
+
<div class="method-heading">
|
1377
|
+
<a href="#M000040" class="method-signature">
|
1378
|
+
<span class="method-name">set_locale</span><span class="method-args">(locale, this_target_only = false)</span>
|
1379
|
+
</a>
|
1380
|
+
</div>
|
1381
|
+
|
1382
|
+
<div class="method-description">
|
1383
|
+
<p>
|
1384
|
+
Sets the current <a href="GetText.html#M000046">locale</a> to the current
|
1385
|
+
class/module
|
1386
|
+
</p>
|
1387
|
+
<p>
|
1388
|
+
Notice that you shouldn‘t use this for your own Libraries.
|
1389
|
+
</p>
|
1390
|
+
<ul>
|
1391
|
+
<li><a href="GetText.html#M000046">locale</a>: a <a
|
1392
|
+
href="GetText.html#M000046">locale</a> string or <a
|
1393
|
+
href="Locale/Object.html">Locale::Object</a>.
|
1394
|
+
|
1395
|
+
</li>
|
1396
|
+
<li>this_target_only: true if you want to change the current class/module only.
|
1397
|
+
|
1398
|
+
</li>
|
1399
|
+
</ul>
|
1400
|
+
<p>
|
1401
|
+
Otherwise, this changes the <a href="GetText.html#M000046">locale</a> of
|
1402
|
+
the current class/module and its ancestors. Default is false.
|
1403
|
+
</p>
|
1404
|
+
<ul>
|
1405
|
+
<li>Returns: self
|
1406
|
+
|
1407
|
+
</li>
|
1408
|
+
</ul>
|
1409
|
+
<p><a class="source-toggle" href="#"
|
1410
|
+
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
1411
|
+
<div class="method-source-code" id="M000040-source">
|
1412
|
+
<pre>
|
1413
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 397</span>
|
1414
|
+
397: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_locale</span>(<span class="ruby-identifier">locale</span>, <span class="ruby-identifier">this_target_only</span> = <span class="ruby-keyword kw">false</span>)
|
1415
|
+
398: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
1416
|
+
399: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">locale</span>
|
1417
|
+
400: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">locale</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Locale</span><span class="ruby-operator">::</span><span class="ruby-constant">Object</span>
|
1418
|
+
401: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">locale</span>
|
1419
|
+
402: <span class="ruby-keyword kw">else</span>
|
1420
|
+
403: <span class="ruby-identifier">ret</span> = <span class="ruby-constant">Locale</span><span class="ruby-operator">::</span><span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">locale</span>.<span class="ruby-identifier">to_s</span>)
|
1421
|
+
404: <span class="ruby-keyword kw">end</span>
|
1422
|
+
405: <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">charset</span> = <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">output_charset</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">output_charset</span>
|
1423
|
+
406: <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">ret</span>)
|
1424
|
+
407: <span class="ruby-keyword kw">else</span>
|
1425
|
+
408: <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">set</span>(<span class="ruby-keyword kw">nil</span>)
|
1426
|
+
409: <span class="ruby-identifier">ret</span> = <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">get</span>
|
1427
|
+
410: <span class="ruby-keyword kw">end</span>
|
1428
|
+
411: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">this_target_only</span>
|
1429
|
+
412: <span class="ruby-identifier">manager</span> = <span class="ruby-ivar">@@__textdomainmanagers</span>[<span class="ruby-identifier">bound_target</span>]
|
1430
|
+
413: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">manager</span>
|
1431
|
+
414: <span class="ruby-identifier">manager</span>.<span class="ruby-identifier">set_locale</span>(<span class="ruby-identifier">ret</span>, <span class="ruby-operator">!</span> <span class="ruby-identifier">cached?</span>)
|
1432
|
+
415: <span class="ruby-keyword kw">end</span>
|
1433
|
+
416: <span class="ruby-keyword kw">else</span>
|
1434
|
+
417: <span class="ruby-identifier">each_textdomain</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">textdomain</span><span class="ruby-operator">|</span>
|
1435
|
+
418: <span class="ruby-identifier">textdomain</span>.<span class="ruby-identifier">set_locale</span>(<span class="ruby-identifier">ret</span>, <span class="ruby-operator">!</span> <span class="ruby-identifier">cached?</span>)
|
1436
|
+
419: }
|
1437
|
+
420: <span class="ruby-keyword kw">end</span>
|
1438
|
+
421: <span class="ruby-keyword kw">self</span>
|
1439
|
+
422: <span class="ruby-keyword kw">end</span>
|
1440
|
+
</pre>
|
1441
|
+
</div>
|
1442
|
+
</div>
|
1443
|
+
</div>
|
1444
|
+
|
1445
|
+
<div id="method-M000041" class="method-detail">
|
1446
|
+
<a name="M000041"></a>
|
1447
|
+
|
1448
|
+
<div class="method-heading">
|
1449
|
+
<a href="#M000041" class="method-signature">
|
1450
|
+
<span class="method-name">set_locale_all</span><span class="method-args">(locale)</span>
|
1451
|
+
</a>
|
1452
|
+
</div>
|
1453
|
+
|
1454
|
+
<div class="method-description">
|
1455
|
+
<p>
|
1456
|
+
Sets current <a href="GetText.html#M000046">locale</a> to the all
|
1457
|
+
textdomains.
|
1458
|
+
</p>
|
1459
|
+
<p>
|
1460
|
+
Note that you shouldn‘t use this for your own Libraries.
|
1461
|
+
</p>
|
1462
|
+
<ul>
|
1463
|
+
<li><a href="GetText.html#M000046">locale</a>: a <a
|
1464
|
+
href="GetText.html#M000046">locale</a> string or <a
|
1465
|
+
href="Locale/Object.html">Locale::Object</a>, otherwise nil to use default
|
1466
|
+
<a href="GetText.html#M000046">locale</a>.
|
1467
|
+
|
1468
|
+
</li>
|
1469
|
+
<li>Returns: self
|
1470
|
+
|
1471
|
+
</li>
|
1472
|
+
</ul>
|
1473
|
+
<p><a class="source-toggle" href="#"
|
1474
|
+
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
1475
|
+
<div class="method-source-code" id="M000041-source">
|
1476
|
+
<pre>
|
1477
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 429</span>
|
1478
|
+
429: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_locale_all</span>(<span class="ruby-identifier">locale</span>)
|
1479
|
+
430: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
1480
|
+
431: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">locale</span>
|
1481
|
+
432: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">locale</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Locale</span><span class="ruby-operator">::</span><span class="ruby-constant">Object</span>
|
1482
|
+
433: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">locale</span>
|
1483
|
+
434: <span class="ruby-keyword kw">else</span>
|
1484
|
+
435: <span class="ruby-identifier">ret</span> = <span class="ruby-constant">Locale</span><span class="ruby-operator">::</span><span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">locale</span>.<span class="ruby-identifier">to_s</span>)
|
1485
|
+
436: <span class="ruby-keyword kw">end</span>
|
1486
|
+
437: <span class="ruby-keyword kw">else</span>
|
1487
|
+
438: <span class="ruby-identifier">ret</span> = <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">default</span>
|
1488
|
+
439: <span class="ruby-keyword kw">end</span>
|
1489
|
+
440: <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">charset</span> = <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">output_charset</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">output_charset</span>
|
1490
|
+
441: <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">set_current</span>(<span class="ruby-identifier">ret</span>)
|
1491
|
+
442: <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">each_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">textdomain</span><span class="ruby-operator">|</span>
|
1492
|
+
443: <span class="ruby-identifier">textdomain</span>.<span class="ruby-identifier">set_locale</span>(<span class="ruby-identifier">ret</span>, <span class="ruby-operator">!</span> <span class="ruby-identifier">cached?</span>)
|
1493
|
+
444: }
|
1494
|
+
445: <span class="ruby-keyword kw">self</span>
|
1495
|
+
446: <span class="ruby-keyword kw">end</span>
|
1496
|
+
</pre>
|
1497
|
+
</div>
|
1498
|
+
</div>
|
1499
|
+
</div>
|
1500
|
+
|
1501
|
+
<div id="method-M000043" class="method-detail">
|
1502
|
+
<a name="M000043"></a>
|
1503
|
+
|
1504
|
+
<div class="method-heading">
|
1505
|
+
<a href="#M000043" class="method-signature">
|
1506
|
+
<span class="method-name">set_output_charset</span><span class="method-args">(charset)</span>
|
1507
|
+
</a>
|
1508
|
+
</div>
|
1509
|
+
|
1510
|
+
<div class="method-description">
|
1511
|
+
<p>
|
1512
|
+
Sets charset(<a href="String.html">String</a>) such as "euc-jp",
|
1513
|
+
"sjis", "CP932", "utf-8", … You
|
1514
|
+
shouldn‘t use this in your own Libraries.
|
1515
|
+
</p>
|
1516
|
+
<ul>
|
1517
|
+
<li>charset: an <a href="GetText.html#M000045">output_charset</a>
|
1518
|
+
|
1519
|
+
</li>
|
1520
|
+
<li>Returns: charset
|
1521
|
+
|
1522
|
+
</li>
|
1523
|
+
</ul>
|
1524
|
+
<p><a class="source-toggle" href="#"
|
1525
|
+
onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
|
1526
|
+
<div class="method-source-code" id="M000043-source">
|
1527
|
+
<pre>
|
1528
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 464</span>
|
1529
|
+
464: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_output_charset</span>(<span class="ruby-identifier">charset</span>)
|
1530
|
+
465: <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">output_charset</span> = <span class="ruby-identifier">charset</span>
|
1531
|
+
466: <span class="ruby-keyword kw">self</span>
|
1532
|
+
467: <span class="ruby-keyword kw">end</span>
|
1533
|
+
</pre>
|
1534
|
+
</div>
|
1535
|
+
</div>
|
1536
|
+
</div>
|
1537
|
+
|
1538
|
+
<div id="method-M000049" class="method-detail">
|
1539
|
+
<a name="M000049"></a>
|
1540
|
+
|
1541
|
+
<div class="method-heading">
|
1542
|
+
<span class="method-name">setlocale</span><span class="method-args">(locale)</span>
|
1543
|
+
</div>
|
1544
|
+
|
1545
|
+
<div class="method-description">
|
1546
|
+
<p>
|
1547
|
+
Alias for <a href="GetText.html#M000046">locale</a>=
|
1548
|
+
</p>
|
1549
|
+
</div>
|
1550
|
+
</div>
|
1551
|
+
|
1552
|
+
<div id="method-M000035" class="method-detail">
|
1553
|
+
<a name="M000035"></a>
|
1554
|
+
|
1555
|
+
<div class="method-heading">
|
1556
|
+
<a href="#M000035" class="method-signature">
|
1557
|
+
<span class="method-name">sgettext(msgid, div = '|')<br />
|
1558
|
+
s_(msgid, div = '|')<br />
|
1559
|
+
</span>
|
1560
|
+
</a>
|
1561
|
+
</div>
|
1562
|
+
|
1563
|
+
<div class="method-description">
|
1564
|
+
<p>
|
1565
|
+
Translates msgid, but if there are no localized text, it returns a last
|
1566
|
+
part of msgid separeted "div".
|
1567
|
+
</p>
|
1568
|
+
<ul>
|
1569
|
+
<li>msgid: the message id.
|
1570
|
+
|
1571
|
+
</li>
|
1572
|
+
<li>div: separator or nil.
|
1573
|
+
|
1574
|
+
</li>
|
1575
|
+
<li>Returns: the localized text by msgid. If there are no localized text, it
|
1576
|
+
returns a last part of msgid separeted "div".
|
1577
|
+
|
1578
|
+
</li>
|
1579
|
+
</ul>
|
1580
|
+
<p>
|
1581
|
+
See: <a
|
1582
|
+
href="http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC151">www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC151</a>
|
1583
|
+
</p>
|
1584
|
+
<p><a class="source-toggle" href="#"
|
1585
|
+
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
1586
|
+
<div class="method-source-code" id="M000035-source">
|
1587
|
+
<pre>
|
1588
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 259</span>
|
1589
|
+
259: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sgettext</span>(<span class="ruby-identifier">msgid</span>, <span class="ruby-identifier">div</span> = <span class="ruby-value str">'|'</span>)
|
1590
|
+
260: <span class="ruby-identifier">cached_key</span> = [<span class="ruby-identifier">bound_target</span>, <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">current</span>, <span class="ruby-identifier">msgid</span>]
|
1591
|
+
261: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cached?</span>
|
1592
|
+
262: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@__cache_msgids</span>[<span class="ruby-identifier">cached_key</span>]
|
1593
|
+
263: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@@__cache_msgids</span>[<span class="ruby-identifier">cached_key</span>]
|
1594
|
+
264: <span class="ruby-keyword kw">end</span>
|
1595
|
+
265: <span class="ruby-keyword kw">end</span>
|
1596
|
+
266: <span class="ruby-identifier">msg</span> = <span class="ruby-keyword kw">nil</span>
|
1597
|
+
267:
|
1598
|
+
268: <span class="ruby-comment cmt"># Use "for"(not "each") to support JRuby 1.1.0.</span>
|
1599
|
+
269: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">target</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">bound_targets</span>(<span class="ruby-keyword kw">self</span>)
|
1600
|
+
270: <span class="ruby-identifier">manager</span> = <span class="ruby-ivar">@@__textdomainmanagers</span>[<span class="ruby-identifier">target</span>]
|
1601
|
+
271: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">textdomain</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">manager</span>.<span class="ruby-identifier">textdomains</span>
|
1602
|
+
272: <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">textdomain</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">gettext</span>(<span class="ruby-identifier">msgid</span>)
|
1603
|
+
273: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">msg</span>
|
1604
|
+
274: <span class="ruby-keyword kw">end</span>
|
1605
|
+
275: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">msg</span>
|
1606
|
+
276: <span class="ruby-keyword kw">end</span>
|
1607
|
+
277:
|
1608
|
+
278: <span class="ruby-identifier">msg</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">msgid</span>
|
1609
|
+
279: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">div</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">msg</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">msgid</span>
|
1610
|
+
280: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">index</span> = <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">rindex</span>(<span class="ruby-identifier">div</span>)
|
1611
|
+
281: <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">msg</span>[(<span class="ruby-identifier">index</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)<span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
|
1612
|
+
282: <span class="ruby-keyword kw">end</span>
|
1613
|
+
283: <span class="ruby-keyword kw">end</span>
|
1614
|
+
284: <span class="ruby-ivar">@@__cache_msgids</span>[<span class="ruby-identifier">cached_key</span>] = <span class="ruby-identifier">msg</span>
|
1615
|
+
285: <span class="ruby-keyword kw">end</span>
|
1616
|
+
</pre>
|
1617
|
+
</div>
|
1618
|
+
</div>
|
1619
|
+
</div>
|
1620
|
+
|
1621
|
+
<div id="method-M000032" class="method-detail">
|
1622
|
+
<a name="M000032"></a>
|
1623
|
+
|
1624
|
+
<div class="method-heading">
|
1625
|
+
<a href="#M000032" class="method-signature">
|
1626
|
+
<span class="method-name">textdomain</span><span class="method-args">(domainname)</span>
|
1627
|
+
</a>
|
1628
|
+
</div>
|
1629
|
+
|
1630
|
+
<div class="method-description">
|
1631
|
+
<p>
|
1632
|
+
Binds a existed <a href="GetText.html#M000032">textdomain</a> to your
|
1633
|
+
program. This is the same function with <a
|
1634
|
+
href="GetText.html#M000030">GetText.bindtextdomain</a> but simpler(and
|
1635
|
+
faster) than <a href="GetText.html#M000030">bindtextdomain</a>. Notice that
|
1636
|
+
you need to call <a href="GetText.html#M000030">GetText.bindtextdomain</a>
|
1637
|
+
first. If the domainname hasn‘t bound yet, raises <a
|
1638
|
+
href="GetText/NoboundTextDomainError.html">GetText::NoboundTextDomainError</a>.
|
1639
|
+
</p>
|
1640
|
+
<ul>
|
1641
|
+
<li>domainname: a <a href="GetText.html#M000032">textdomain</a> name.
|
1642
|
+
|
1643
|
+
</li>
|
1644
|
+
<li>Returns: the <a
|
1645
|
+
href="GetText/TextDomainManager.html">GetText::TextDomainManager</a>.
|
1646
|
+
|
1647
|
+
</li>
|
1648
|
+
</ul>
|
1649
|
+
<p><a class="source-toggle" href="#"
|
1650
|
+
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
|
1651
|
+
<div class="method-source-code" id="M000032-source">
|
1652
|
+
<pre>
|
1653
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 125</span>
|
1654
|
+
125: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">textdomain</span>(<span class="ruby-identifier">domainname</span>)
|
1655
|
+
126: <span class="ruby-identifier">domain</span> = <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">textdomain</span>(<span class="ruby-identifier">domainname</span>)
|
1656
|
+
127: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoboundTextDomainError</span>, <span class="ruby-node">"#{domainname} is not bound."</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">domain</span>
|
1657
|
+
128: <span class="ruby-identifier">target_key</span> = <span class="ruby-identifier">bound_target</span>
|
1658
|
+
129: <span class="ruby-identifier">manager</span> = <span class="ruby-ivar">@@__textdomainmanagers</span>[<span class="ruby-identifier">target_key</span>]
|
1659
|
+
130: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">manager</span>
|
1660
|
+
131: <span class="ruby-identifier">manager</span> = <span class="ruby-constant">TextDomainManager</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">target_key</span>, <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">get</span>)
|
1661
|
+
132: <span class="ruby-ivar">@@__textdomainmanagers</span>[<span class="ruby-identifier">target_key</span>] = <span class="ruby-identifier">manager</span>
|
1662
|
+
133: <span class="ruby-keyword kw">end</span>
|
1663
|
+
134: <span class="ruby-identifier">manager</span>.<span class="ruby-identifier">set_locale</span>(<span class="ruby-constant">Locale</span>.<span class="ruby-identifier">get</span>)
|
1664
|
+
135: <span class="ruby-identifier">manager</span>.<span class="ruby-identifier">add_textdomain</span>(<span class="ruby-identifier">domainname</span>)
|
1665
|
+
136: <span class="ruby-identifier">manager</span>
|
1666
|
+
137: <span class="ruby-keyword kw">end</span>
|
1667
|
+
</pre>
|
1668
|
+
</div>
|
1669
|
+
</div>
|
1670
|
+
</div>
|
1671
|
+
|
1672
|
+
<div id="method-M000033" class="method-detail">
|
1673
|
+
<a name="M000033"></a>
|
1674
|
+
|
1675
|
+
<div class="method-heading">
|
1676
|
+
<a href="#M000033" class="method-signature">
|
1677
|
+
<span class="method-name">textdomain_to</span><span class="method-args">(klass, domainname)</span>
|
1678
|
+
</a>
|
1679
|
+
</div>
|
1680
|
+
|
1681
|
+
<div class="method-description">
|
1682
|
+
<p>
|
1683
|
+
Includes <a href="GetText.html">GetText</a> module and bind an exsited <a
|
1684
|
+
href="GetText.html#M000032">textdomain</a> to a class. See <a
|
1685
|
+
href="GetText.html#M000032">textdomain</a> for more detail.
|
1686
|
+
</p>
|
1687
|
+
<ul>
|
1688
|
+
<li>klass: the target ruby class.
|
1689
|
+
|
1690
|
+
</li>
|
1691
|
+
<li>domainname: the <a href="GetText.html#M000032">textdomain</a> name.
|
1692
|
+
|
1693
|
+
</li>
|
1694
|
+
</ul>
|
1695
|
+
<p><a class="source-toggle" href="#"
|
1696
|
+
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
1697
|
+
<div class="method-source-code" id="M000033-source">
|
1698
|
+
<pre>
|
1699
|
+
<span class="ruby-comment cmt"># File lib/gettext.rb, line 143</span>
|
1700
|
+
143: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">textdomain_to</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">domainname</span>)
|
1701
|
+
144: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
1702
|
+
145: <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">module_eval</span> {
|
1703
|
+
146: <span class="ruby-identifier">include</span> <span class="ruby-constant">GetText</span>
|
1704
|
+
147: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">textdomain</span>(<span class="ruby-identifier">domainname</span>)
|
1705
|
+
148: }
|
1706
|
+
149: <span class="ruby-identifier">ret</span>
|
1707
|
+
150: <span class="ruby-keyword kw">end</span>
|
1708
|
+
</pre>
|
1709
|
+
</div>
|
1710
|
+
</div>
|
1711
|
+
</div>
|
1712
|
+
|
1713
|
+
<div id="method-M000020" class="method-detail">
|
1714
|
+
<a name="M000020"></a>
|
1715
|
+
|
1716
|
+
<div class="method-heading">
|
1717
|
+
<a href="#M000020" class="method-signature">
|
1718
|
+
<span class="method-name">update_pofiles</span><span class="method-args">(textdomain, files, app_version, po_root = "po", refpot = "tmp.pot")</span>
|
1719
|
+
</a>
|
1720
|
+
</div>
|
1721
|
+
|
1722
|
+
<div class="method-description">
|
1723
|
+
<p>
|
1724
|
+
At first, this creates the #{po_root}/#{domainname}.pot file using <a
|
1725
|
+
href="GetText.html#M000021">GetText.rgettext</a>. Since 2nd time, this
|
1726
|
+
updates(merges) the #{po_root}/#{domainname}.pot and all of the
|
1727
|
+
#{po_root}/#{lang}/#{domainname}.po files under "po_root" using
|
1728
|
+
"<a href="GetText.html#M000018">msgmerge</a>".
|
1729
|
+
</p>
|
1730
|
+
<p>
|
1731
|
+
<b>Note</b> "<a href="GetText.html#M000018">msgmerge</a>" tool is
|
1732
|
+
included in GNU <a href="GetText.html">GetText</a>. So you need to install
|
1733
|
+
GNU <a href="GetText.html">GetText</a>.
|
1734
|
+
</p>
|
1735
|
+
<p>
|
1736
|
+
See <HOWTO maintain po/mo files(<a
|
1737
|
+
href="http://www.yotabanana.com/hiki/ruby-gettext-howto-manage.html">www.yotabanana.com/hiki/ruby-gettext-howto-manage.html</a>)>
|
1738
|
+
for more detals.
|
1739
|
+
</p>
|
1740
|
+
<ul>
|
1741
|
+
<li>domainname: the <a href="GetText.html#M000032">textdomain</a> name.
|
1742
|
+
|
1743
|
+
</li>
|
1744
|
+
<li>targetfiles: An Array of target files or nil (See <a
|
1745
|
+
href="GetText.html#M000021">GetText.rgettext</a> for more details).
|
1746
|
+
|
1747
|
+
</li>
|
1748
|
+
<li>app_version: the application information which appears
|
1749
|
+
"Project-Id-Version: #{app_version}" in the pot/po-files.
|
1750
|
+
|
1751
|
+
</li>
|
1752
|
+
<li>po_root: the root directory of po-files.
|
1753
|
+
|
1754
|
+
</li>
|
1755
|
+
<li>refpot: set the temporary file name. You shouldn‘t use this(It will
|
1756
|
+
be removed).
|
1757
|
+
|
1758
|
+
</li>
|
1759
|
+
</ul>
|
1760
|
+
<pre>
|
1761
|
+
(e.g.) GetText.update_pofiles("myapp", Dir.glob("lib/*.rb"), "myapp 1.0.0")
|
1762
|
+
</pre>
|
1763
|
+
<p><a class="source-toggle" href="#"
|
1764
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
1765
|
+
<div class="method-source-code" id="M000020-source">
|
1766
|
+
<pre>
|
1767
|
+
<span class="ruby-comment cmt"># File lib/gettext/utils.rb, line 120</span>
|
1768
|
+
120: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_pofiles</span>(<span class="ruby-identifier">textdomain</span>, <span class="ruby-identifier">files</span>, <span class="ruby-identifier">app_version</span>, <span class="ruby-identifier">po_root</span> = <span class="ruby-value str">"po"</span>, <span class="ruby-identifier">refpot</span> = <span class="ruby-value str">"tmp.pot"</span>)
|
1769
|
+
121: <span class="ruby-identifier">rgettext</span>(<span class="ruby-identifier">files</span>, <span class="ruby-identifier">refpot</span>)
|
1770
|
+
122: <span class="ruby-identifier">msgmerge_all</span>(<span class="ruby-identifier">textdomain</span>, <span class="ruby-identifier">app_version</span>, <span class="ruby-identifier">po_root</span>, <span class="ruby-identifier">refpot</span>)
|
1771
|
+
123: <span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">refpot</span>)
|
1772
|
+
124: <span class="ruby-keyword kw">end</span>
|
1773
|
+
</pre>
|
1774
|
+
</div>
|
1775
|
+
</div>
|
1776
|
+
</div>
|
1777
|
+
|
1778
|
+
|
1779
|
+
</div>
|
1780
|
+
|
1781
|
+
|
1782
|
+
</div>
|
1783
|
+
|
1784
|
+
|
1785
|
+
<div id="validator-badges">
|
1786
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
1787
|
+
</div>
|
1788
|
+
|
1789
|
+
</body>
|
1790
|
+
</html>
|