PHP Class Symfony\Component\Translation\Translator

Author: Fabien Potencier ([email protected])
Inheritance: implements Symfony\Component\Translation\TranslatorInterface
Show file Open project: pmjones/php-framework-benchmarks Class Usage Examples

Protected Properties

Property Type Description
$catalogues
$locale

Public Methods

Method Description
__construct ( string $locale, Symfony\Component\Translation\MessageSelector $selector ) Constructor.
addLoader ( string $format, Symfony\Component\Translation\Loader\LoaderInterface $loader ) Adds a Loader.
addResource ( string $format, mixed $resource, string $locale, string $domain = 'messages' ) Adds a Resource.
getLocale ( )
setFallbackLocale ( string $locale ) Sets the fallback locale.
setLocale ( $locale )
trans ( $id, array $parameters = [], $domain = 'messages', $locale = null )
transChoice ( $id, $number, array $parameters = [], $domain = 'messages', $locale = null )

Protected Methods

Method Description
loadCatalogue ( $locale )

Private Methods

Method Description
optimizeCatalogue ( $locale )

Method Details

__construct() public method

Constructor.
public __construct ( string $locale, Symfony\Component\Translation\MessageSelector $selector )
$locale string The locale
$selector Symfony\Component\Translation\MessageSelector The message selector for pluralization

addLoader() public method

Adds a Loader.
public addLoader ( string $format, Symfony\Component\Translation\Loader\LoaderInterface $loader )
$format string The name of the loader (@see addResource())
$loader Symfony\Component\Translation\Loader\LoaderInterface A LoaderInterface instance

addResource() public method

Adds a Resource.
public addResource ( string $format, mixed $resource, string $locale, string $domain = 'messages' )
$format string The name of the loader (@see addLoader())
$resource mixed The resource name
$locale string The locale
$domain string The domain

getLocale() public method

public getLocale ( )

loadCatalogue() protected method

protected loadCatalogue ( $locale )

setFallbackLocale() public method

Sets the fallback locale.
public setFallbackLocale ( string $locale )
$locale string The fallback locale

setLocale() public method

public setLocale ( $locale )

trans() public method

public trans ( $id, array $parameters = [], $domain = 'messages', $locale = null )
$parameters array

transChoice() public method

public transChoice ( $id, $number, array $parameters = [], $domain = 'messages', $locale = null )
$parameters array

Property Details

$catalogues protected property

protected $catalogues

$locale protected property

protected $locale