Translator
class Translator implements TranslatorInterface, TranslatorBagInterface
Properties
protected MessageCatalogueInterface[] | $catalogues | ||
protected string | $locale |
Methods
No description
Adds a Resource.
Sets the current locale.
Returns the current locale.
Sets the fallback locales.
Gets the fallback locales.
Translates the given message.
Translates the given choice message by choosing a translation according to a number.
Gets the catalogue by locale.
Gets the loaders.
No description
No description
This method is public because it needs to be callable from a closure in PHP 5.3. It should be made protected (or even private, if possible) in 3.0.
No description
Asserts that the locale is valid, throws an Exception if not.
Details
at line 78
__construct(string $locale, MessageSelector $selector = null, string|null $cacheDir = null, bool $debug = false)
at line 86
setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory)
at line 97
addLoader(string $format, LoaderInterface $loader)
Adds a Loader.
at line 112
addResource(string $format, mixed $resource, string $locale, string $domain = null)
Adds a Resource.
at line 132
setLocale(string $locale)
Sets the current locale.
at line 141
string
getLocale()
Returns the current locale.
at line 155
setFallbackLocale(string|array $locales)
deprecated
deprecated
Sets the fallback locale(s).
at line 169
setFallbackLocales(array $locales)
Sets the fallback locales.
at line 186
array
getFallbackLocales()
Gets the fallback locales.
at line 194
string
trans(string $id, array $parameters = array(), string|null $domain = null, string|null $locale = null)
Translates the given message.
at line 206
string
transChoice(string $id, int $number, array $parameters = array(), string|null $domain = null, string|null $locale = null)
Translates the given choice message by choosing a translation according to a number.
at line 230
MessageCatalogueInterface
getCatalogue(string|null $locale = null)
Gets the catalogue by locale.
at line 250
protected array
getLoaders()
Gets the loaders.
at line 264
array[array]
getMessages(string|null $locale = null)
deprecated
deprecated
Collects all messages for the given locale.
at line 280
protected
loadCatalogue(string $locale)
at line 292
protected
initializeCatalogue(string $locale)
at line 338
dumpCatalogue($locale, ConfigCacheInterface $cache)
This method is public because it needs to be callable from a closure in PHP 5.3. It should be made protected (or even private, if possible) in 3.0.
at line 430
protected
computeFallbackLocales($locale)
at line 455
protected
assertValidLocale(string $locale)
Asserts that the locale is valid, throws an Exception if not.