Class | GetText::TextDomain
In: | lib/gettext/runtime/textdomain.rb
Parent: | Object

GetText::TextDomain class manages mo-files of a textdomain.

Usually, you don’t need to use this class directly.

Notice: This class is unstable. APIs will be changed.

### Methods

add_default_locale_path cached= cached? clear new output_charset= translate_singluar_message

### Constants

DEFAULT_PLURAL_CALC | = | Proc.new{|n| n != 1}
DEFAULT_SINGLE_CALC | = | Proc.new{|n| 0}

### Attributes

mofiles | [R] |
name | [R] |
output_charset | [R] |

### Public Class methods

add_default_locale_path(path)

Add default locale path. Usually you should use GetText.add_default_locale_path instead.

- path: a new locale path. (e.g.) “/usr/share/locale/%{lang}/LC_MESSAGES/%{name}.mo” (‘locale’ => “ja_JP“, ‘name’ => “textdomain”)
- Returns: the new DEFAULT_LOCALE_PATHS

cached=(val)

Set to cache the mo-file or not.

- val: true if cached, otherwise false.

cached?()

Cache the mo-file or not. Default is true. If $DEBUG is set then false.

new(name, topdir = nil, output_charset = nil)

Creates a new GetText::TextDomain.

- name: the textdomain name.
- topdir: the locale path (“%{topdir}/%{lang}/LC_MESSAGES/%{name}.mo”) or nil.
- output_charset: output charset.
- Returns: a newly created GetText::TextDomain object.

### Public Instance methods

clear()

Clear cached mofiles.

output_charset=(charset)

Set output_charset.

- charset: output charset.

translate_singluar_message(lang, msgid)

Translates the translated string.

- lang: Locale::Tag::Simple’s subclass.
- msgid: the original message.
- Returns: the translated string or nil.

[Validate]