BOM_UTF8 | = | [0xef, 0xbb, 0xbf].pack("c3") |
VERSION | = | "1.93.0" |
This function does nothing. But it is required in order to recognize the msgid by rgettext.
Add default locale path.
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.
Note: Don‘t use locale_, charset argument(not in options). They are remained for backward compatibility.
Includes GetText module and bind a textdomain to a class.
Set the value whether cache messages or not. true to cache messages, otherwise false.
Default is true. If $DEBUG is false, messages are not checked even if this value is true.
Creates mo-files using #{po_root}/#{lang}/*.po an put them to #{targetdir}/#{targetpath_rule}/.
This is a convenience function of GetText.rmsgfmt for plural target files.
Show the current textdomain information. This function is for debugging.
Translates msgid and return the message. This doesn‘t make a copy of the message.
You need to use String#dup if you want to modify the return value with destructive functions.
(e.g.1) _("Hello ").dup << "world"
But e.g.1 should be rewrite to:
(e.g.2) _("Hello %{val}") % {:val => "world"}
Because the translator may want to change the position of "world".
Merges two Uniforum style .po files together.
Note This function requires "msgmerge" tool included in GNU GetText. So you need to install GNU GetText.
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.
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.
Usually you don‘t need to call this function directly. Use GetText.update_pofiles instead.
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.
The npgettext is similar to the nsgettext function.
e.g.) np_("Special", "An apple", "%{num} Apples", num) == ns_("Special|An apple", "%{num} Apples", num)
The nsgettext is similar to the ngettext. But if there are no localized text, it returns a last part of msgid separeted "div".
Gets the current output_charset which is set using GetText.set_output_charset.
Same as GetText.set_output_charset
Translates msgid with msgctxt. This methods is similer with s_().
e.g.) p_("File", "New") == s_("File|New") p_("File", "Open") == s_("File|Open")
See: www.gnu.org/software/autoconf/manual/gettext/Contexts.html
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).
This function is a part of GetText.create_pofiles. Usually you don‘t need to call this function directly.
Note for ActiveRecord, you need to run your database server and configure the config/database.xml correctly before execute this function.
Sets the current locale to the current class/module
Notice that you shouldn‘t use this for your own Libraries.
Otherwise, this changes the locale of the current class/module and its ancestors. Default is false.
Sets current locale to the all textdomains.
Note that you shouldn‘t use this for your own Libraries.
Sets charset(String) such as "euc-jp", "sjis", "CP932", "utf-8", … You shouldn‘t use this in your own Libraries.
Translates msgid, but if there are no localized text, it returns a last part of msgid separeted "div".
See: www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC151
Binds a existed textdomain to your program. This is the same function with GetText.bindtextdomain but simpler(and faster) than bindtextdomain. Notice that you need to call GetText.bindtextdomain first. If the domainname hasn‘t bound yet, raises GetText::NoboundTextDomainError.
Includes GetText module and bind an exsited textdomain to a class. See textdomain for more detail.
At first, this creates the #{po_root}/#{domainname}.pot file using GetText.rgettext. 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".
Note "msgmerge" tool is included in GNU GetText. So you need to install GNU GetText.
See <HOWTO maintain po/mo files(www.yotabanana.com/hiki/ruby-gettext-howto-manage.html)> for more detals.
(e.g.) GetText.update_pofiles("myapp", Dir.glob("lib/*.rb"), "myapp 1.0.0")