Class Translation
Provides translation of arbitrary data identified by keys with support for fallback locales.
Translation repositories are divided into domains. A domain is a logical group of translation entries that are used together; for example a client and server repository, or parts in an application that are not used together in a single request. Domains can be used to reduce the memory footprint of language files or separate responsibility onto several translation teams.
The locale designates the language of the repository. It uses the same notion as locales and hence does support different language regions. It is highly recommended to have a default locale for an application for which all language entries are defined. This default locale should be used as a fallback locale to use if an entry for a different locale does not exist.
The translation interface is generic; is can be used to translate different kinds of data. A driver both defines the type of data and storage access, e.g. for translating language entries. The translation driver might itself implement an own driver for the actual storage involved, e.g. XML-based language files.
- Core\Object implements Core\Chainable
- Core\Set implements Core\Accessor
- Core\Translation
Direct known subclasses
Namespace: Core
Package: Core\Translation
Since: 3.1
Requires: PHP 5.3
Version: 1.0
Located at Translation.inc.php
Methods summary
public
|
|
public
|
|
public static
|
|
abstract public
|
#
get( string $domainName = null, string $localeName = null )
Gets the translation engine for a given domain and locale. |
public
|
|
public
|
|
public
boolean
|
#
setDefaultLocaleAccept( string $localeAccept = null, string $default = null )
Automatically sets default locale based on the HTTP "Accept" header. |
Methods inherited from Core\Object
__autocreateFactory()
,
__call()
,
__processParameters()
,
__toString()
,
attachMethod()
,
chain()
,
getValueForKey()
,
getValueForKeyPath()
,
hash()
,
issetValueForKey()
,
setValueForKey()
,
setValueForKeyPath()
,
setValueForUndefinedKey()
,
uuid()
Constants summary
string |
DefaultDomainParameter
Name of default domain to use if not specified. |
#
'default-domain'
|
string |
DefaultLocaleParameter
The default locale to use if the driver fails to automatically determine an active locale. |
#
'default-locale'
|
string |
FallbackLocaleParameter
If the active locale fails, use the provided fallback instead. |
#
'fallback-locale'
|
Constants inherited from Core\Object
AnyParameterType
,
AutochainParameterType
,
AutocreateParameterType
,
BooleanParameterType
,
CharParameterType
,
EnumParameterType
,
IntegerParameterType
,
RealParameterType
,
StringParameterType
,
UserParameterType
Properties summary
protected
array
|
$_v_parameters
Associative array of configuration parameters. |
Magic properties
public read-only
array
|
$parameters
Associative array of configuration parameters. |