Documentation

Horde_Translation
in package

Horde_Translation is the base class for any translation wrapper classes in libraries that want to utilize the Horde_Translation library for translations.

Tags
author

Jan Schneider jan@horde.org

category

Horde

copyright

2010-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

$_directory  : string
The relative path to the translations for the default gettext handler.
$_domain  : string
The translation domain, e.g. the library name, for the default gettext handler.
$_handlers  : array<string|int, mixed>
The handlers providing the actual translations.
loadHandler()  : mixed
Loads a translation handler class pointing to the library's translations and assigns it to $_handler.
ngettext()  : string
Returns the plural translation of a message.
r()  : string
Allows a gettext string to be defined and recognized as a string by the horde translation utilities, but no translation is actually performed (raw gettext = r()).
setHandler()  : mixed
Assigns a translation handler object to $_handlers.
t()  : string
Returns the translation of a message.

Properties

$_directory

The relative path to the translations for the default gettext handler.

protected static string $_directory

$_domain

The translation domain, e.g. the library name, for the default gettext handler.

protected static string $_domain

$_handlers

The handlers providing the actual translations.

protected static array<string|int, mixed> $_handlers = array()

Methods

loadHandler()

Loads a translation handler class pointing to the library's translations and assigns it to $_handler.

public static loadHandler(string $handlerClass) : mixed
Parameters
$handlerClass : string

The name of a class implementing the Horde_Translation_Handler interface.

Return values
mixed

ngettext()

Returns the plural translation of a message.

public static ngettext(string $singular, string $plural, int $number) : string
Parameters
$singular : string

The singular version to translate.

$plural : string

The plural version to translate.

$number : int

The number that determines singular vs. plural.

Return values
string

The string translation, or the original string if no translation exists.

r()

Allows a gettext string to be defined and recognized as a string by the horde translation utilities, but no translation is actually performed (raw gettext = r()).

public static r(string $message) : string
Parameters
$message : string

The raw string to mark for translation.

Tags
since
2.1.0
Return values
string

The raw string.

setHandler()

Assigns a translation handler object to $_handlers.

public static setHandler(string $domain, Horde_Translation_Handler $handler) : mixed

Type hinting isn't used on purpose. You should extend a custom translation handler passed here from the Horde_Translation interface, but technically it's sufficient if you provide the API of that interface.

Parameters
$domain : string

The translation domain.

$handler : Horde_Translation_Handler

An object implementing the Horde_Translation_Handler interface.

Return values
mixed

t()

Returns the translation of a message.

public static t(mixed $message) : string
Parameters
$message : mixed
Return values
string

The string translation, or the original string if no translation exists.

Search results