Documentation

Autodetect extends AbstractTranslation
in package

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

Tags
author

Jan Schneider jan@horde.org

category

Horde

copyright

2010-2017 Horde LLC

license

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

since
2.2.0

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.
$pearDirectory  : string
The absolute PEAR path to the translations for the default gettext handler.
loadHandler()  : void
Auto detects the locale directory location.
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()  : void
Assigns a translation handler object to $handlers.
t()  : string
Returns the translation of a message.
getSearchDirectories()  : array<string|int, string>
Get potential locations for the locale directory.
searchLocaleDirectory()  : null|string
Search for the locale directory for different installations methods (eg: PEAR, Composer).

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 = []

$pearDirectory

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

protected static string $pearDirectory

This value is automatically set by PEAR Replace Tasks.

Methods

loadHandler()

Auto detects the locale directory location.

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

The name of a class implementing the Handler interface.

Return values
void

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, Handler $handler) : void

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 : Handler

An object implementing the Horde_Translation_Handler interface.

Return values
void

t()

Returns the translation of a message.

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

The string to translate.

Return values
string

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

getSearchDirectories()

Get potential locations for the locale directory.

protected static getSearchDirectories() : array<string|int, string>
Return values
array<string|int, string>

List of directories

searchLocaleDirectory()

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

protected static searchLocaleDirectory() : null|string
Return values
null|string

The directory if found, or null when no valid directory is found

Search results