deferred class GNU_GET_TEXT
Summary
Direct parents
Inherit list: NUMBER_GET_TEXT, TERMINAL_GET_TEXT
Insert list: SINGLETON
Class invariant
Overview
Features
{}
{ANY}
{FILTER_GET_TEXT}
{ANY}
{ANY}
{ANY}
{ANY}
{ANY}
{}
{}
{ANY}
  • text_domain: STRING
    The default text domain (namespace in which messages are looked up)
{}
  • init
    Initialise with default values.
{ANY}
  • is_equal (other: GNU_GET_TEXT): BOOLEAN
    Is other attached to an object considered equal to current object?
{}
init_in_default_directory
effective procedure
{}
Initialise with default values.
Message catalogs will be looked for in /usr/local/share/locale/locale/LC_MESSAGES/domain_name.mo
init_in_current_working_directory
effective procedure
{}
Initialise with default values.
Message catalogs will be looked for in ./locale/LC_MESSAGES/domain_name.mo
translation (message: STRING): STRING
effective function
{ANY}
Translation of message into current locale
The translation is looked up in the default text domain.
See also: set_message_locale
require
    • message.is_ascii
    • is_text_domain_set
    • is_message_locale_set
    • is_text_domain_set_up(text_domain)
    • message.is_ascii
    • is_text_domain_set
    • is_message_locale_set
    • is_text_domain_set_up(text_domain)
ensure
  • Result.is_equal(domain_translation(text_domain, message))
number_translation (message_1: STRING, message_other: STRING, n: INTEGER_32): STRING
effective function
{ANY}
require
  • message_1.is_ascii
  • n >= 0
  • is_text_domain_set
  • is_message_locale_set
  • is_text_domain_set_up(text_domain)
ensure
  • Result.is_equal(domain_number_translation(text_domain, message_1, message_other, n))
domain_translation (domain_name: STRING, message: STRING): STRING
effective function
Translation of message into current locale
The translation is looked up in the text domain domain_name.
See also: set_message_locale
require
    • message.is_ascii
    • is_message_locale_set
    • is_text_domain_set_up(domain_name)
    • message.is_ascii
    • is_message_locale_set
    • is_text_domain_set_up(domain_name)
ensure
  • Result.is_equal(domain_number_translation(domain_name, message, message, 1))
domain_number_translation (domain_name: STRING, message_1: STRING, message_other: STRING, n: INTEGER_32): STRING
effective function
require
  • message_1.is_ascii
  • n >= 0
  • is_message_locale_set
  • is_text_domain_set_up(domain_name)
register_domain (domain_name: STRING)
effective procedure
Used by a FILTER_GET_TEXT to let the filtered GET_TEXT know that it will use the text domain domain_name.
set_environment_variable (variable: STRING, value: STRING)
effective procedure
{ANY}
Try to assign the value to the system environment variable (like SYSTEM.set_environment_variable).
Changes to language variables (such as LANGUAGE, LC_xxx, LANG) immediately affect the language of xxx_translation functions (unlike SYSTEM.set_environment_variable).
require
  • variable /= Void
  • value /= Void
set_message_locale (locale_name: STRING)
effective procedure
{ANY}
Set the locale (roughly, the language) in which the program should output messages.
The locale_name should have the following form:
  language[_territory][.codeset]
The territory field is usually a country name
For instance, en_US would be a typical locale_name.
require
  • not locale_name.is_empty
ensure
  • message_locale.is_equal(locale_name)
set_default_message_locale
effective procedure
{ANY}
Try to read the default locale in the environment (environment variable, register, ...)
message_locale: STRING
effective function
{ANY}
The locale (roughly, the language) in which the program should output messages.
is_message_locale_set: BOOLEAN
effective function
{ANY}
ensure
  • Result = message_locale /= Void
set_text_domain
effective procedure
{ANY}
is_text_domain_set: BOOLEAN
effective function
{ANY}
Was a default text domain set?
ensure
  • Result implies not text_domain.is_empty
bind_text_domain (domain_name: STRING, dir_name: STRING)
effective procedure
{ANY}
The message catalog for domain domain_name will be looked for in directory dir_name.
require
  • domain_name /= Void
  • dir_name /= Void
ensure
text_domain_binding (domain_name: STRING): STRING
effective function
{ANY}
In which directory will the message catalog for domain domain_name be looked for?
require
  • domain_name /= Void
is_text_domain_bound (domain_name: STRING): BOOLEAN
effective function
{ANY}
require
  • domain_name /= Void
ensure
bind_text_domain_code_set (domain_name: STRING, code_set: STRING)
effective procedure
{ANY}
require
  • domain_name /= Void
  • code_set /= Void
ensure
text_domain_code_set (domain_name: STRING): STRING
effective function
{ANY}
The encoding of the Result of xxx_translation
require
    • domain_name /= Void
    • domain_name /= Void
is_text_domain_set_up (domain_name: STRING): BOOLEAN
effective function
{ANY}
Is Current ready to translate messages from domain domain_name?
The precise way of setting up a domain varies between implementations but will typically involve loading a message catalog.
require
    • domain_name /= Void
    • domain_name /= Void
ensure
  • Result
notify_change
effective procedure
{}
lc_messages: INTEGER_32
{}
lc_all: INTEGER_32
{}
basic_textdomain (domain_name: POINTER): POINTER
{}
basic_gettext (msgid: POINTER): POINTER
{}
basic_dgettext (domain_name: POINTER, msgid: POINTER): POINTER
{}
basic_bind_textdomain_codeset (domainname: POINTER, codeset: POINTER): POINTER
{}
basic_ngettext (msgid1: POINTER, msgid2: POINTER, n: INTEGER_32): POINTER
{}
basic_dngettext (domain: POINTER, msgid1: POINTER, msgid2: POINTER, n: INTEGER_32): POINTER
{}
basic_bindtextdomain (domain_name: POINTER, dir_name: POINTER): POINTER
{}
basic_setlocale (category: INTEGER_32, locale: POINTER): POINTER
{}
default_message_catalog_directory: STRING
writable attribute
{}
text_domain: STRING
deferred function
{ANY}
The default text domain (namespace in which messages are looked up)
init
effective procedure
{}
Initialise with default values.
is_equal (other: GNU_GET_TEXT): BOOLEAN
effective function
{ANY}
Is other attached to an object considered equal to current object?
require
  • other /= Void
ensure
  • commutative: generating_type = other.generating_type implies Result = other.is_equal(Current)
is_real_singleton: BOOLEAN
effective function
{}
ensure
  • assertion_check_only: Result
singleton_memory_pool: HASHED_DICTIONARY[POINTER, STRING]
once function
{}
This pool is unique in the whole system.
A memory is kept for each singleton type (type, not class) in the system.
current_is_not_an_expanded_type: BOOLEAN
effective function
{}
Check that the dynamic type of the SINGLETON is not an expanded type.