Class GetText::TextDomain
In: lib/gettext/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

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. 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

Set to cache the mo-file or not.

  • val: true if cached, otherwise false.

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

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 cached mofiles.

Set output_charset.

  • charset: output charset.

Translates the translated string.

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

[Validate]