FileAccess Orion

Translator
in package
implements TranslatorInterface, TranslatorInterface, TranslatorBagInterface

Tags
author

Fabien Potencier fabien@symfony.com

Interfaces, Classes, Traits and Enums

TranslatorInterface
TranslatorInterface.
TranslatorInterface
TranslatorBagInterface
TranslatorBagInterface.

Table of Contents

$catalogues  : array<string|int, MessageCatalogueInterface>
$cacheDir  : string
$cacheVary  : mixed
$configCacheFactory  : ConfigCacheFactoryInterface|null
$debug  : bool
$fallbackLocales  : array<string|int, mixed>
$formatter  : MessageFormatterInterface
$hasIntlFormatter  : mixed
$loaders  : array<string|int, LoaderInterface>
$locale  : string
$parentLocales  : array<string|int, mixed>|null
$resources  : array<string|int, mixed>
__construct()  : mixed
addLoader()  : mixed
Adds a Loader.
addResource()  : mixed
Adds a Resource.
getCatalogue()  : MessageCatalogueInterface
Gets the catalogue by locale.
getLocale()  : string
Returns the current locale.
setConfigCacheFactory()  : mixed
setFallbackLocales()  : mixed
Sets the fallback locales.
setLocale()  : mixed
Sets the current locale.
trans()  : string
Translates the given message.
transChoice()  : string
Translates the given choice message by choosing a translation according to a number.
assertValidLocale()  : mixed
Asserts that the locale is valid, throws an Exception if not.
computeFallbackLocales()  : mixed
getLoaders()  : array<string|int, mixed>
Gets the loaders.
initializeCatalogue()  : mixed
loadCatalogue()  : mixed
dumpCatalogue()  : void
getAllMessages()  : array<string|int, mixed>
getCatalogueCachePath()  : string
getConfigCacheFactory()  : ConfigCacheFactoryInterface
Provides the ConfigCache factory implementation, falling back to a default implementation if necessary.
getFallbackContent()  : string
initializeCacheCatalogue()  : void
loadFallbackCatalogues()  : void

Properties

$fallbackLocales

private array<string|int, mixed> $fallbackLocales = []

$hasIntlFormatter

private mixed $hasIntlFormatter

$parentLocales

private array<string|int, mixed>|null $parentLocales

$resources

private array<string|int, mixed> $resources = []

Methods

__construct()

public __construct(string|null $locale[, MessageFormatterInterface $formatter = null ][, string $cacheDir = null ][, bool $debug = false ][, array<string|int, mixed> $cacheVary = [] ]) : mixed
Parameters
$locale : string|null
$formatter : MessageFormatterInterface = null
$cacheDir : string = null
$debug : bool = false
$cacheVary : array<string|int, mixed> = []
Tags
throws
InvalidArgumentException

If a locale contains invalid characters

Return values
mixed

addLoader()

Adds a Loader.

public addLoader(string $format, LoaderInterface $loader) : mixed
Parameters
$format : string

The name of the loader (@see addResource())

$loader : LoaderInterface
Return values
mixed

addResource()

Adds a Resource.

public addResource(string $format, mixed $resource, string $locale[, string $domain = null ]) : mixed
Parameters
$format : string

The name of the loader (@see addLoader())

$resource : mixed

The resource name

$locale : string

The locale

$domain : string = null

The domain

Tags
throws
InvalidArgumentException

If the locale contains invalid characters

Return values
mixed

getLocale()

Returns the current locale.

public getLocale() : string
Return values
string

The locale

setFallbackLocales()

Sets the fallback locales.

public setFallbackLocales(array<string|int, mixed> $locales) : mixed
Parameters
$locales : array<string|int, mixed>

The fallback locales

Tags
throws
InvalidArgumentException

If a locale contains invalid characters

Return values
mixed

setLocale()

Sets the current locale.

public setLocale(mixed $locale) : mixed
Parameters
$locale : mixed

The locale

Return values
mixed

trans()

Translates the given message.

public trans(mixed $id[, array<string|int, mixed> $parameters = [] ][, mixed $domain = null ][, mixed $locale = null ]) : string
Parameters
$id : mixed

The message id (may also be an object that can be cast to string)

$parameters : array<string|int, mixed> = []

An array of parameters for the message

$domain : mixed = null

The domain for the message or null to use the default

$locale : mixed = null

The locale or null to use the default

Return values
string

The translated string

transChoice()

Translates the given choice message by choosing a translation according to a number.

public transChoice(mixed $id, mixed $number[, array<string|int, mixed> $parameters = [] ][, mixed $domain = null ][, mixed $locale = null ]) : string
Parameters
$id : mixed

The message id (may also be an object that can be cast to string)

$number : mixed

The number to use to find the index of the message

$parameters : array<string|int, mixed> = []

An array of parameters for the message

$domain : mixed = null

The domain for the message or null to use the default

$locale : mixed = null

The locale or null to use the default

Tags
deprecated

since Symfony 4.2, use the trans() method instead with a %count% parameter

Return values
string

The translated string

assertValidLocale()

Asserts that the locale is valid, throws an Exception if not.

protected assertValidLocale(string $locale) : mixed
Parameters
$locale : string

Locale to tests

Tags
throws
InvalidArgumentException

If the locale contains invalid characters

Return values
mixed

computeFallbackLocales()

protected computeFallbackLocales(mixed $locale) : mixed
Parameters
$locale : mixed
Return values
mixed

getLoaders()

Gets the loaders.

protected getLoaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

LoaderInterface[]

initializeCatalogue()

protected initializeCatalogue(string $locale) : mixed
Parameters
$locale : string
Return values
mixed

loadCatalogue()

protected loadCatalogue(string $locale) : mixed
Parameters
$locale : string
Return values
mixed

getCatalogueCachePath()

private getCatalogueCachePath(string $locale) : string
Parameters
$locale : string
Return values
string

initializeCacheCatalogue()

private initializeCacheCatalogue(string $locale) : void
Parameters
$locale : string
Return values
void

loadFallbackCatalogues()

private loadFallbackCatalogues(string $locale) : void
Parameters
$locale : string
Return values
void

Search results