Module | GetText::TextDomainManager
In: | lib/gettext/runtime/textdomain_manager.rb

### Methods

bind_to cached= cached? clear_all_textdomains clear_caches output_charset output_charset= textdomain_pool translate_plural_message translate_singluar_message

### Public Instance methods

bind_to(klass, domainname, options = {})

bind textdomain to the class.

cached=(val)

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.

cached?()

Return the cached value.

clear_all_textdomains()

for testing.

clear_caches()

for testing.

output_charset()

Gets the output charset.

output_charset=(charset)

Sets the output charset.The program can have a output charset.

textdomain_pool(domainname)

Find textdomain by name

translate_plural_message(klass, arg1, arg2, arg3 = "|", arg4 = "|")

This function is similar to the get_singluar_message function as it finds the message catalogs in the same way. But it takes two extra arguments for plural form. The msgid parameter must contain the singular form of the string to be converted. It is also used as the key for the search in the catalog. The msgid_plural parameter is the plural form. The parameter n is used to determine the plural form. If no message catalog is found msgid1 is returned if n == 1, otherwise msgid2. And if msgid includes “div”, it returns a last part of msgid separeted “div”.

- msgid: the singular form with “div”. (e.g. “Special|An apple”, “An apple”)
- msgid_plural: the plural form. (e.g. “%{num} Apples”)
- n: a number used to determine the plural form.
- div: the separator. Default is “|”.
- 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.

or

- [msgid, msgid_plural] : msgid and msgid_plural an Array
- n: a number used to determine the plural form.
- div: the separator. Default is “|”.

translate_singluar_message(klass, msgid, div = nil)

Translates msgid, but if there are no localized text, it returns a last part of msgid separeted “div” or whole of the msgid with no “div”.

- msgid: the message id.
- div: separator or nil.
- Returns: the localized text by msgid. If there are no localized text, it returns a last part of msgid separeted “div”.

[Validate]