1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Module: GetText</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script language="JavaScript" type="text/javascript">
// <![CDATA[
function toggleSource( id )
{
var elem
var link
if( document.getElementById )
{
elem = document.getElementById( id )
link = document.getElementById( "l_" + id )
}
else if ( document.all )
{
elem = eval( "document.all." + id )
link = eval( "document.all.l_" + id )
}
else
return false;
if( elem.style.display == "block" )
{
elem.style.display = "none"
link.innerHTML = "show source"
}
else
{
elem.style.display = "block"
link.innerHTML = "hide source"
}
}
function openCode( url )
{
window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
}
// ]]>
</script>
</head>
<body>
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
<td class="file-title"><span class="file-title-prefix">Module</span><br />GetText</td>
<td align="right">
<table cellspacing=0 cellpadding=2>
<tr valign="top">
<td>In:</td>
<td>
<a href="../files/lib/gettext/rmsgmerge_rb.html">lib/gettext/rmsgmerge.rb</a>
<a href="../files/lib/gettext/poparser_rb.html">lib/gettext/poparser.rb</a>
<a href="../files/lib/gettext/textdomainmanager_rb.html">lib/gettext/textdomainmanager.rb</a>
<a href="../files/lib/gettext/container_rb.html">lib/gettext/container.rb</a>
<a href="../files/lib/gettext/textdomain_rb.html">lib/gettext/textdomain.rb</a>
<a href="../files/lib/gettext/rgettext_rb.html">lib/gettext/rgettext.rb</a>
<a href="../files/lib/gettext/parser/activerecord_rb.html">lib/gettext/parser/activerecord.rb</a>
<a href="../files/lib/gettext/parser/glade_rb.html">lib/gettext/parser/glade.rb</a>
<a href="../files/lib/gettext/parser/ruby_rb.html">lib/gettext/parser/ruby.rb</a>
<a href="../files/lib/gettext/parser/erb_rb.html">lib/gettext/parser/erb.rb</a>
<a href="../files/lib/gettext/utils_rb.html">lib/gettext/utils.rb</a>
<a href="../files/lib/gettext/version_rb.html">lib/gettext/version.rb</a>
<a href="../files/lib/gettext/rmsgfmt_rb.html">lib/gettext/rmsgfmt.rb</a>
<a href="../files/lib/gettext/rails_rb.html">lib/gettext/rails.rb</a>
<a href="../files/lib/gettext/cgi_rb.html">lib/gettext/cgi.rb</a>
<a href="../files/lib/gettext/erb_rb.html">lib/gettext/erb.rb</a>
<a href="../files/lib/gettext_rb.html">lib/gettext.rb</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- banner header -->
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<ul>
<li><a href="#M000030">N_</a></li>
<li><a href="#M000031">Nn_</a></li>
<li><a href="#M000043">_</a></li>
<li><a href="#M000040">add_default_locale_path</a></li>
<li><a href="#M000026">bindtextdomain</a></li>
<li><a href="#M000025">cgi</a></li>
<li><a href="#M000024">cgi=</a></li>
<li><a href="#M000020">create_mofiles</a></li>
<li><a href="#M000041">current_textdomain_info</a></li>
<li><a href="#M000028">gettext</a></li>
<li><a href="#M000039">locale</a></li>
<li><a href="#M000035">locale=</a></li>
<li><a href="#M000019">msgmerge</a></li>
<li><a href="#M000044">n_</a></li>
<li><a href="#M000029">ngettext</a></li>
<li><a href="#M000038">output_charset</a></li>
<li><a href="#M000037">output_charset=</a></li>
<li><a href="#M000018">rgettext</a></li>
<li><a href="#M000022">rmsgfmt</a></li>
<li><a href="#M000017">rmsgmerge</a></li>
<li><a href="#M000045">s_</a></li>
<li><a href="#M000023">set_cgi</a></li>
<li><a href="#M000033">set_locale</a></li>
<li><a href="#M000034">set_locale_all</a></li>
<li><a href="#M000036">set_output_charset</a></li>
<li><a href="#M000042">setlocale</a></li>
<li><a href="#M000032">sgettext</a></li>
<li><a href="#M000027">textdomain</a></li>
<li><a href="#M000021">update_pofiles</a></li>
</ul>
<div class="sectiontitle">Classes and Modules</div>
Module <a href="GetText/ActiveRecordParser.html" class="link">GetText::ActiveRecordParser</a><br />
Module <a href="GetText/ErbContainer.html" class="link">GetText::ErbContainer</a><br />
Module <a href="GetText/ErbParser.html" class="link">GetText::ErbParser</a><br />
Module <a href="GetText/GetText.html" class="link">GetText::GetText</a><br />
Module <a href="GetText/GladeParser.html" class="link">GetText::GladeParser</a><br />
Module <a href="GetText/Rails.html" class="link">GetText::Rails</a><br />
Module <a href="GetText/RubyParser.html" class="link">GetText::RubyParser</a><br />
Class <a href="GetText/NoboundTextDomainError.html" class="link">GetText::NoboundTextDomainError</a><br />
Class <a href="GetText/PoParser.html" class="link">GetText::PoParser</a><br />
Class <a href="GetText/TextDomain.html" class="link">GetText::TextDomain</a><br />
Class <a href="GetText/TextDomainManager.html" class="link">GetText::TextDomainManager</a><br />
<div class="sectiontitle">Constants</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class="attr-name">VERSION</td>
<td>=</td>
<td class="attr-value">"1.7.0"</td>
</tr>
</table>
<div class="sectiontitle">Public Instance methods</div>
<div class="method">
<div class="title">
<a name="M000030"></a><b>N_</b>(msgid)
[ <a href="javascript:openCode('GetText.src/M000030.html')">source</a> ]
</div>
<div class="description">
<p>
This function does nothing. But it is required in order to recognize the
msgid by rgettext.
</p>
<ul>
<li>msgid: the message id.
</li>
<li>Returns: msgid.
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000031"></a><b>Nn_</b>(msgid, msgid_plural)
[ <a href="javascript:openCode('GetText.src/M000031.html')">source</a> ]
</div>
<div class="description">
<p>
This is same function as <a href="GetText.html#M000030">N_</a> but for
ngettext.
</p>
<ul>
<li>msgid: the message id.
</li>
<li>msgid_plural: the plural message id.
</li>
<li>Returns: msgid.
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000043"></a><b>_</b>(msgid)
</div>
<div class="description">
<p>
Alias for <a href="GetText.html#M000028">gettext</a>
</p>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000040"></a><b>add_default_locale_path</b>(path)
[ <a href="javascript:openCode('GetText.src/M000040.html')">source</a> ]
</div>
<div class="description">
<p>
Add default locale path.
</p>
<ul>
<li>path: a new locale path. (e.g.)
"/usr/share/locale/%{locale}/LC_MESSAGES/%{name}.mo"
(‘locale’ => "ja_JP", ‘name’ =>
"textdomain")
</li>
<li>Returns: the new DEFAULT_LOCALE_PATHS
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000026"></a><b>bindtextdomain(domainname, options = {})<br />
</b>
[ <a href="javascript:openCode('GetText.src/M000026.html')">source</a> ]
</div>
<div class="description">
<p>
Bind a textdomain(%{path}/%{locale}/LC_MESSAGES/%{domainname}.mo) to your
program. Normally, the texdomain scope becomes a ruby-script-file. So you
need to call this function each ruby-script-files. On the other hand, if
you call this function under GetText::Container (gettext/container,
gettext/erb, gettext/rails), the textdomain scope becomes a Class/Module.
</p>
<ul>
<li>domainname: the textdomain name.
</li>
<li>options: options as an Hash.
<ul>
<li>:path - the path to the mo-files. When the value is nil, it will search
default paths such as /usr/share/locale, /usr/local/share/locale)
</li>
<li>:locale - the locale string such as "ja_JP.UTF-8". Generally, you
should use <a href="GetText.html#M000033">GetText.set_locale</a> instead.
The value is searched order by: the value of this value > System default
language.
</li>
<li>:charset - output charset. This affect the current textdomain only.
Generally, you should use <a
href="GetText.html#M000036">GetText.set_output_charset</a> instead. The
value is searched order by: the value of Locale.set_output_charset >
ENV["OUTPUT_CHARSET"] > this value > System default
charset.
</li>
</ul>
</li>
<li>Returns: the <a href="GetText/TextDomain.html">GetText::TextDomain</a>.
</li>
</ul>
<p>
Note: Don‘t use locale_, charset argument(not in options). They are
remained for backward compatibility.
</p>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000025"></a><b>cgi</b>()
[ <a href="javascript:openCode('GetText.src/M000025.html')">source</a> ]
</div>
<div class="description">
<p>
Gets the CGI object. If it is nil, returns new CGI object.
</p>
<ul>
<li>Returns: the CGI object
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000024"></a><b>cgi=</b>(cgi_)
[ <a href="javascript:openCode('GetText.src/M000024.html')">source</a> ]
</div>
<div class="description">
<p>
Same as <a href="GetText.html#M000023">GetText.set_cgi</a>.
</p>
<ul>
<li>cgi_: CGI object
</li>
<li>Returns: cgi_
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000020"></a><b>create_mofiles</b>(verbose = false, podir = "./po", targetdir = "./data/locale", targetpath_rule = "%s/LC_MESSAGES")
[ <a href="javascript:openCode('GetText.src/M000020.html')">source</a> ]
</div>
<div class="description">
<p>
Creates mo-files using #{po_root}/#{lang}/*.po an put them to
#{targetdir}/#{targetpath_rule}/.
</p>
<p>
This is a convenience function of <a
href="GetText.html#M000022">GetText.rmsgfmt</a> for plural target files.
</p>
<ul>
<li>verbose: true if verbose mode, otherwise false
</li>
<li>po_root: the root directory of po-files.
</li>
<li>targetdir: the target root directory where the mo-files are stored.
</li>
<li>targetpath_rule: the target directory for each mo-files. "%s"
becomes "#{lang}" under po_root.
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000041"></a><b>current_textdomain_info</b>(options = {})
[ <a href="javascript:openCode('GetText.src/M000041.html')">source</a> ]
</div>
<div class="description">
<p>
Show the current textdomain information. This function is for debugging.
</p>
<ul>
<li>options: options as a Hash.
<ul>
<li>:with_messages - show informations with messages of the current mo file.
Default is false.
</li>
<li>:out - An output target. Default is STDOUT.
</li>
<li>:with_paths - show the load paths for mo-files.
</li>
</ul>
</li>
<li>Returns: localized text by msgid. If there are not binded mo-file, it will
return msgid.
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000028"></a><b>gettext(msgid)<br />
_(msgid)<br />
</b>
[ <a href="javascript:openCode('GetText.src/M000028.html')">source</a> ]
</div>
<div class="description">
<p>
Translates msgid and return the message.
</p>
<ul>
<li>msgid: the message id.
</li>
<li>Returns: localized text by msgid. If there are not binded mo-file, it will
return msgid.
</li>
</ul>
</div>
<div class="aka">
This method is also aliased as
<a href="GetText.html#M000043">_</a>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000039"></a><b>locale</b>()
[ <a href="javascript:openCode('GetText.src/M000039.html')">source</a> ]
</div>
<div class="description">
<p>
Gets the current locale.
</p>
<ul>
<li>Returns: a current <a href="Locale/Object.html">Locale::Object</a>
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000035"></a><b>locale=</b>(locale)
[ <a href="javascript:openCode('GetText.src/M000035.html')">source</a> ]
</div>
<div class="description">
<p>
Same as <a href="GetText.html#M000033">GetText.set_locale</a>.
</p>
<ul>
<li>locale: a locale string
</li>
<li>src: internal usage only. You shouldn’t use this.
</li>
<li>Returns: a locale string
</li>
</ul>
</div>
<div class="aka">
This method is also aliased as
<a href="GetText.html#M000042">setlocale</a>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000019"></a><b>msgmerge</b>(defpo, refpo, app_version)
[ <a href="javascript:openCode('GetText.src/M000019.html')">source</a> ]
</div>
<div class="description">
<p>
Merges two Uniforum style .po files together.
</p>
<p>
<b>Note</b> "msgmerge" tool is included in GNU <a
href="GetText.html">GetText</a>. So you need to install GNU <a
href="GetText.html">GetText</a>.
</p>
<p>
The def.po file is an existing PO file with translations which will be
taken over to the newly created file as long as they still match; comments
will be preserved, but extracted comments and file positions will be
discarded.
</p>
<p>
The ref.pot file is the last created PO file with up-to-date source
references but old translations, or a PO Template file (generally created
by rgettext); any translations or comments in the file will be discarded,
however dot comments and file positions will be preserved. Where an exact
match cannot be found, fuzzy matching is used to produce better results.
</p>
<p>
Usually you don’t need to call this function directly. Use <a
href="GetText.html#M000021">GetText.update_pofiles</a> instead.
</p>
<ul>
<li>defpo: a po-file. translations referring to old sources
</li>
<li>refpo: a po-file. references to new sources
</li>
<li>app_version: the application information which appears
"Project-Id-Version: #{app_version}" in the pot/po-files.
</li>
<li>Returns: self
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000044"></a><b>n_</b>(arg1, arg2, arg3 = nil)
</div>
<div class="description">
<p>
Alias for <a href="GetText.html#M000029">ngettext</a>
</p>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000029"></a><b>ngettext(msgid, msgid_plural, n)<br />
ngettext(msgids, n) # msgids = [msgid, msgid_plural]<br />
n_(msgid, msgid_plural, n)<br />
n_(msgids, n) # msgids = [msgid, msgid_plural]<br />
</b>
[ <a href="javascript:openCode('GetText.src/M000029.html')">source</a> ]
</div>
<div class="description">
<p>
The ngettext is similar to the gettext function as it finds the message
catalogs in the same way. But it takes two extra arguments for plural form.
</p>
<ul>
<li>msgid: the singular form.
</li>
<li>msgid_plural: the plural form.
</li>
<li>n: a number used to determine the plural form.
</li>
<li>Returns: the localized text which key is msgid_plural if n is plural(follow
plural-rule) or msgid. "plural-rule" is defined in po-file.
</li>
</ul>
</div>
<div class="aka">
This method is also aliased as
<a href="GetText.html#M000044">n_</a>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000038"></a><b>output_charset</b>()
[ <a href="javascript:openCode('GetText.src/M000038.html')">source</a> ]
</div>
<div class="description">
<p>
Gets the current <a href="GetText.html#M000038">output_charset</a> which is
set using <a href="GetText.html#M000036">GetText.set_output_charset</a>.
</p>
<ul>
<li>Returns: <a href="GetText.html#M000038">output_charset</a>.
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000037"></a><b>output_charset=</b>(charset)
[ <a href="javascript:openCode('GetText.src/M000037.html')">source</a> ]
</div>
<div class="description">
<p>
Same as <a href="GetText.html#M000036">GetText.set_output_charset</a>
</p>
<ul>
<li>charset: an <a href="GetText.html#M000038">output_charset</a>
</li>
<li>Returns: charset
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000018"></a><b>rgettext</b>(targetfiles = nil, out = STDOUT)
[ <a href="javascript:openCode('GetText.src/M000018.html')">source</a> ]
</div>
<div class="description">
<p>
Creates a po-file from targetfiles(ruby-script-files, ActiveRecord, .rhtml
files, glade-2 XML files), then output the result to out. If no parameter
is set, it behaves same as command line tools(rgettet).
</p>
<p>
This function is a part of GetText.create_pofiles. Usually you don’t
need to call this function directly.
</p>
<p>
<b>Note</b> for ActiveRecord, you need to run your database server and
configure the config/database.xml correctly before execute this function.
</p>
<ul>
<li>targetfiles: An Array of po-files or nil.
</li>
<li>out: output IO or output path.
</li>
<li>Returns: self
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000022"></a><b>rmsgfmt</b>(targetfile = nil, output_path = nil)
[ <a href="javascript:openCode('GetText.src/M000022.html')">source</a> ]
</div>
<div class="description">
<p>
Creates a mo-file from a targetfile(po-file), then output the result to
out. If no parameter is set, it behaves same as command line
tools(rmsgfmt).
</p>
<ul>
<li>targetfile: An Array of po-files or nil.
</li>
<li>output_path: output path.
</li>
<li>Returns: the <a href="MOFile.html">MOFile</a> object.
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000017"></a><b>rmsgmerge</b>(reference = nil, definition = nil, out = STDOUT)
[ <a href="javascript:openCode('GetText.src/M000017.html')">source</a> ]
</div>
<div class="description">
<p>
Experimental
</p>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000045"></a><b>s_</b>(msgid, div = '|')
</div>
<div class="description">
<p>
Alias for <a href="GetText.html#M000032">sgettext</a>
</p>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000023"></a><b>set_cgi</b>(cgi_)
[ <a href="javascript:openCode('GetText.src/M000023.html')">source</a> ]
</div>
<div class="description">
<p>
Sets a CGI object.
</p>
<ul>
<li>cgi_: CGI object
</li>
<li>Returns: self
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000033"></a><b>set_locale</b>(locale, this_target_only = false)
[ <a href="javascript:openCode('GetText.src/M000033.html')">source</a> ]
</div>
<div class="description">
<p>
Sets locale to the current class/module
</p>
<p>
Notice that you shouldn’t use this for your own Libraries.
</p>
<ul>
<li>locale: a locale string or <a href="Locale/Object.html">Locale::Object</a>.
</li>
<li>this_target_only: true if you want to change the current class/module only.
</li>
</ul>
<p>
Otherwise, this changes the locale of the current class/module and its
ancestors. Default is false.
</p>
<ul>
<li>Returns: self
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000034"></a><b>set_locale_all</b>(locale)
[ <a href="javascript:openCode('GetText.src/M000034.html')">source</a> ]
</div>
<div class="description">
<p>
Sets locale to the all textdomains.
</p>
<p>
Notice that you shouldn’t use this for your own Libraries.
</p>
<ul>
<li>locale: a locale string or <a href="Locale/Object.html">Locale::Object</a>.
</li>
<li>Returns: self
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000036"></a><b>set_output_charset</b>(charset)
[ <a href="javascript:openCode('GetText.src/M000036.html')">source</a> ]
</div>
<div class="description">
<p>
Sets charset(<a href="String.html">String</a>) such as "euc-jp",
"sjis", "CP932", "utf-8", … You
shouldn’t use this in your own Libraries.
</p>
<ul>
<li>charset: an <a href="GetText.html#M000038">output_charset</a>
</li>
<li>Returns: charset
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000042"></a><b>setlocale</b>(locale)
</div>
<div class="description">
<p>
Alias for <a href="GetText.html#M000035">locale=</a>
</p>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000032"></a><b>sgettext(msgid, div = '|')<br />
s_(msgid, div = '|')<br />
</b>
[ <a href="javascript:openCode('GetText.src/M000032.html')">source</a> ]
</div>
<div class="description">
<p>
Translates msgid, but if there are no localized text, it returns a last
part of msgid separeted "div".
</p>
<ul>
<li>msgid: the message id.
</li>
<li>div: separator or nil.
</li>
<li>Returns: the localized text by msgid. If there are no localized text, it
returns a last part of msgid separeted "div".
</li>
</ul>
<p>
See: <a
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>
</p>
</div>
<div class="aka">
This method is also aliased as
<a href="GetText.html#M000045">s_</a>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000027"></a><b>textdomain</b>(domainname)
[ <a href="javascript:openCode('GetText.src/M000027.html')">source</a> ]
</div>
<div class="description">
<p>
Binds a existed textdomain to your program. This is the same function with
<a href="GetText.html#M000026">GetText.bindtextdomain</a> but simpler than
bindtextdomain. Notice that you need to call <a
href="GetText.html#M000026">GetText.bindtextdomain</a> first. If the
domainname hasn’t bound yet, raises <a
href="GetText/NoboundTextDomainError.html">GetText::NoboundTextDomainError</a>.
</p>
<ul>
<li>domainname: a textdomain name.
</li>
<li>Returns: the <a href="GetText/TextDomain.html">GetText::TextDomain</a>.
</li>
</ul>
</div>
</div>
<div class="method">
<div class="title">
<a name="M000021"></a><b>update_pofiles</b>(textdomain, files, app_version, po_root = "po", refpot = "tmp.pot")
[ <a href="javascript:openCode('GetText.src/M000021.html')">source</a> ]
</div>
<div class="description">
<p>
At first, this creates the #{po_root}/#{domainname}.pot file using <a
href="GetText.html#M000018">GetText.rgettext</a>. Since 2nd time, this
updates(merges) the #{po_root}/#{domainname}.pot and all of the
#{po_root}/#{lang}/#{domainname}.po files under "po_root" using
"msgmerge".
</p>
<p>
<b>Note</b> "msgmerge" tool is included in GNU <a
href="GetText.html">GetText</a>. So you need to install GNU <a
href="GetText.html">GetText</a>.
</p>
<p>
See <HOWTO maintain po/mo files(<a
href="http://www.yotabanana.com/hiki/ruby-gettext-howto-manage.html">www.yotabanana.com/hiki/ruby-gettext-howto-manage.html</a>)>
for more detals.
</p>
<ul>
<li>domainname: the textdomain name.
</li>
<li>targetfiles: An Array of target files or nil (See <a
href="GetText.html#M000018">GetText.rgettext</a> for more details).
</li>
<li>app_version: the application information which appears
"Project-Id-Version: #{app_version}" in the pot/po-files.
</li>
<li>po_root: the root directory of po-files.
</li>
<li>refpot: set the temporary file name. You shouldn’t use this(It will
be removed).
</li>
</ul>
<pre>
(e.g.) GetText.update_pofiles("myapp", Dir.glob("lib/*.rb"), "myapp 1.0.0")
</pre>
</div>
</div>
</div>
</div>
</body>
</html>
|