|
Erebot
latest
A modular IRC bot for PHP 5.3+
|
Interface to provide internationalization. More...
Inheritance diagram for Erebot\IntlInterface:Public Member Functions | |
| _ ($message) | |
| getLocale ($category) | |
| gettext ($message) | |
| setLocale ($category, $candidates) | |
Static Public Member Functions | |
| static | categoryToName ($category) |
| static | nameToCategory ($name) |
Public Attributes | |
| const | LC_ADDRESS = 9 |
| Address formats and location information. | |
| const | LC_ALL = 6 |
| Overrides the value for all the other LC_* constants. | |
| const | LC_COLLATE = 3 |
| Collation order. | |
| const | LC_CTYPE = 0 |
| Character classification and case conversion. | |
| const | LC_IDENTIFICATION = 12 |
| Metadata about the locale information. | |
| const | LC_MEASUREMENT = 11 |
| Measurement units (Metric or Other). | |
| const | LC_MESSAGES = 5 |
| const | LC_MONETARY = 4 |
| Monetary formats. | |
| const | LC_NAME = 8 |
| Name formats. | |
| const | LC_NUMERIC = 1 |
| Non-monetary numeric formats. | |
| const | LC_PAPER = 7 |
| Paper size. | |
| const | LC_TELEPHONE = 10 |
| Telephone number formats. | |
| const | LC_TIME = 2 |
| Date and time formats. | |
Interface to provide internationalization.
This interface provides the necessary methods to provide internationalization of the messages the bot emits through logging or exceptions.
Definition at line 31 of file IntlInterface.php.
| Erebot\IntlInterface::_ | ( | $message | ) |
Translates the given message using the translations for the current component.
| string | $message | The original message to translate, in US English. |
| string | The message, translated into the selected locale. |
Implemented in Erebot\Intl.
|
static |
Returns the name associated with a given category.
| opaque | $category | One of the constants defined in Erebot::IntlInterface, eg. Erebot::IntlInterface::LC_MESSAGES. |
| string | The name of that category (eg. "LC_MESSAGES"). |
Implemented in Erebot\Intl.
| Erebot\IntlInterface::getLocale | ( | $category | ) |
Returns the target locale of this translator in canonical form for a given catergory.
| opaque | $category | One of the constants defined in Erebot::IntlInterface indicating the category we're interested in querying. For the most basic usage, you should pass Erebot::IntlInterface::LC_MESSAGES as the category. |
| string | The canonical form of the target locale for this translator. |
Implemented in Erebot\Intl.
| Erebot\IntlInterface::gettext | ( | $message | ) |
Translates the given message using the translations for the current component.
| string | $message | The original message to translate, in US English. |
| string | The message, translated into the selected locale. |
Implemented in Erebot\Intl.
|
static |
Returns the value of the category matching the given name.
| string | $name | A category name, such as "LC_MESSAGES". |
| opaque | The corresponding category, returned as one of the constants in Erebot::IntlInterface, eg. Erebot::IntlInterface::LC_MESSAGES. |
Implemented in Erebot\Intl.
| Erebot\IntlInterface::setLocale | ( | $category, | |
| $candidates | |||
| ) |
Sets the target locale of this translator for a given catergory.
| opaque | $category | One of the constants defined in Erebot::IntlInterface indicating the category we're interested in setting. For the most basic usage, you should pass Erebot::IntlInterface::LC_MESSAGES as the category. |
| array | $candidates | Array of locales that can be used. The candidate locales will be reviewed in order and the first one to match a locale available to the bot will be used as the effective locale. |
| string | The locale effectively in use after this method has been called, in its canonical form. |
Implemented in Erebot\Intl.
| const Erebot\IntlInterface::LC_MESSAGES = 5 |
Formats of informative and diagnostic messages and interfactive responses.
Definition at line 52 of file IntlInterface.php.
Referenced by Erebot\Config\Proxy\getTranslator(), Erebot\Config\Main\getTranslator(), and Erebot\Styling\Variables\DurationVariable\render().