\Horde_Translation_Autodetect

The Horde_Translation_Autodetect auto detects the locale directory location for the class implementing it.

Summary

Methods
Properties
Constants
loadHandler()
setHandler()
t()
ngettext()
r()
No public properties found
No constants found
_searchLocaleDirectory()
_getSearchDirectories()
$_domain
$_directory
$_handlers
$_pearDirectory
N/A
No private methods found
No private properties found
N/A

Properties

$_domain

$_domain : string

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

Type

string

$_directory

$_directory : string

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

Type

string

$_handlers

$_handlers : array

The handlers providing the actual translations.

Type

array

$_pearDirectory

$_pearDirectory : string

The absolute PEAR path to the translations for the default gettext handler.

This value is automatically set by PEAR Replace Tasks.

Type

string

Methods

loadHandler()

loadHandler(string  $handlerClass) 

Auto detects the locale directory location.

Parameters

string $handlerClass

The name of a class implementing the Horde_Translation_Handler interface.

setHandler()

setHandler(string  $domain, \Horde_Translation_Handler  $handler) 

Assigns a translation handler object to $_handlers.

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

string $domain

The translation domain.

\Horde_Translation_Handler $handler

An object implementing the Horde_Translation_Handler interface.

t()

t(  $message) : string

Returns the translation of a message.

Parameters

$message

Returns

string —

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

ngettext()

ngettext(string  $singular, string  $plural, integer  $number) : string

Returns the plural translation of a message.

Parameters

string $singular

The singular version to translate.

string $plural

The plural version to translate.

integer $number

The number that determines singular vs. plural.

Returns

string —

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

r()

r(string  $message) : 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()).

Parameters

string $message

The raw string to mark for translation.

Returns

string —

The raw string.

_searchLocaleDirectory()

_searchLocaleDirectory() 

Search for the locale directory for different installations methods (eg: PEAR, Composer).

_getSearchDirectories()

_getSearchDirectories() 

Get potential locations for the locale directory.