PHP Class Kdyby\Translation\Translator

Author: Fabien Potencier ([email protected])
Author: Filip Procházka ([email protected])
Inheritance: extends Symfony\Component\Translation\Translator, implements ITranslator
Afficher le fichier Open project: kdyby/translation Class Usage Examples

Méthodes publiques

Méthode Description
__call ( string $name, array $args ) : mixed Call to undefined method.
__callStatic ( string $name, array $args ) : mixed Call to undefined static method.
__construct ( Kdyby\Translation\IUserLocaleResolver $localeResolver, Symfony\Component\Translation\MessageSelector $selector, CatalogueCompiler $catalogueCompiler, FallbackResolver $fallbackResolver, Kdyby\Translation\IResourceLoader $loader )
__get ( string $name ) : mixed Returns property value. Do not call directly.
__isset ( string $name ) : boolean Is property defined?
__set ( string $name, mixed $value ) : void Sets value of a property. Do not call directly.
__unset ( string $name ) : void Access to undeclared property.
addLoader ( string $format, Symfony\Component\Translation\Loader\LoaderInterface $loader )
addResource ( $format, $resource, $locale, $domain = NULL )
buildWhitelistRegexp ( null | string $whitelist ) : null | string
createTemplateHelpers ( ) : TemplateHelpers
domain ( string $messagePrefix ) : ITranslator
extensionMethod ( $name, null $callback = NULL ) : callable | null Adding method to class.
getAvailableLocales ( ) : array Returns array of locales from given resources
getDefaultLocale ( ) : string
getLocale ( )
getReflection ( ) : ClassType Access to reflection.
injectPanel ( Panel $panel )
injectPsrLogger ( Psr\Log\LoggerInterface $logger = NULL )
setDefaultLocale ( string $locale ) : Translator
setFallbackLocales ( array $locales )
setLocaleWhitelist ( array $whitelist = NULL ) : Translator
trans ( $message, array $parameters = [], $domain = NULL, $locale = NULL )
transChoice ( $message, $number, array $parameters = [], $domain = NULL, $locale = NULL )
translate ( string $message, integer $count = NULL, array $parameters = [], string $domain = NULL, string $locale = NULL ) : string Translates the given string.

Méthodes protégées

Méthode Description
assertValidLocale ( string $locale ) Asserts that the locale is valid, throws an Exception if not.
computeFallbackLocales ( $locale )
getLoaders ( ) : Symfony\Component\Translation\Loader\LoaderInterface[]
loadCatalogue ( $locale )
logMissingTranslation ( string $message, string $domain, string $locale )

Private Methods

Méthode Description
extractMessageDomain ( string $message ) : array

Method Details

__call() public méthode

Call to undefined method.
public __call ( string $name, array $args ) : mixed
$name string
$args array
Résultat mixed

__callStatic() public static méthode

Call to undefined static method.
public static __callStatic ( string $name, array $args ) : mixed
$name string
$args array
Résultat mixed

__construct() public méthode

public __construct ( Kdyby\Translation\IUserLocaleResolver $localeResolver, Symfony\Component\Translation\MessageSelector $selector, CatalogueCompiler $catalogueCompiler, FallbackResolver $fallbackResolver, Kdyby\Translation\IResourceLoader $loader )
$localeResolver Kdyby\Translation\IUserLocaleResolver
$selector Symfony\Component\Translation\MessageSelector The message selector for pluralization
$catalogueCompiler CatalogueCompiler
$fallbackResolver FallbackResolver
$loader Kdyby\Translation\IResourceLoader

__get() public méthode

Returns property value. Do not call directly.
public __get ( string $name ) : mixed
$name string
Résultat mixed

__isset() public méthode

Is property defined?
public __isset ( string $name ) : boolean
$name string
Résultat boolean

__set() public méthode

Sets value of a property. Do not call directly.
public __set ( string $name, mixed $value ) : void
$name string
$value mixed
Résultat void

__unset() public méthode

Access to undeclared property.
public __unset ( string $name ) : void
$name string
Résultat void

addLoader() public méthode

public addLoader ( string $format, Symfony\Component\Translation\Loader\LoaderInterface $loader )
$format string
$loader Symfony\Component\Translation\Loader\LoaderInterface

addResource() public méthode

public addResource ( $format, $resource, $locale, $domain = NULL )

assertValidLocale() protected méthode

Asserts that the locale is valid, throws an Exception if not.
protected assertValidLocale ( string $locale )
$locale string Locale to tests

buildWhitelistRegexp() public static méthode

public static buildWhitelistRegexp ( null | string $whitelist ) : null | string
$whitelist null | string
Résultat null | string

computeFallbackLocales() protected méthode

protected computeFallbackLocales ( $locale )

createTemplateHelpers() public méthode

public createTemplateHelpers ( ) : TemplateHelpers
Résultat TemplateHelpers

domain() public méthode

public domain ( string $messagePrefix ) : ITranslator
$messagePrefix string
Résultat ITranslator

extensionMethod() public static méthode

Adding method to class.
public static extensionMethod ( $name, null $callback = NULL ) : callable | null
$name
$callback null
Résultat callable | null

getAvailableLocales() public méthode

Returns array of locales from given resources
public getAvailableLocales ( ) : array
Résultat array

getDefaultLocale() public méthode

public getDefaultLocale ( ) : string
Résultat string

getLoaders() protected méthode

protected getLoaders ( ) : Symfony\Component\Translation\Loader\LoaderInterface[]
Résultat Symfony\Component\Translation\Loader\LoaderInterface[]

getLocale() public méthode

public getLocale ( )

getReflection() public static méthode

Access to reflection.
public static getReflection ( ) : ClassType
Résultat Nette\Reflection\ClassType

injectPanel() public méthode

public injectPanel ( Panel $panel )
$panel Kdyby\Translation\Diagnostics\Panel

injectPsrLogger() public méthode

public injectPsrLogger ( Psr\Log\LoggerInterface $logger = NULL )
$logger Psr\Log\LoggerInterface

loadCatalogue() protected méthode

protected loadCatalogue ( $locale )

logMissingTranslation() protected méthode

protected logMissingTranslation ( string $message, string $domain, string $locale )
$message string
$domain string
$locale string

setDefaultLocale() public méthode

public setDefaultLocale ( string $locale ) : Translator
$locale string
Résultat Translator

setFallbackLocales() public méthode

public setFallbackLocales ( array $locales )
$locales array

setLocaleWhitelist() public méthode

public setLocaleWhitelist ( array $whitelist = NULL ) : Translator
$whitelist array
Résultat Translator

trans() public méthode

public trans ( $message, array $parameters = [], $domain = NULL, $locale = NULL )
$parameters array

transChoice() public méthode

public transChoice ( $message, $number, array $parameters = [], $domain = NULL, $locale = NULL )
$parameters array

translate() public méthode

Translates the given string.
public translate ( string $message, integer $count = NULL, array $parameters = [], string $domain = NULL, string $locale = NULL ) : string
$message string The message id
$count integer The number to use to find the indice of the message
$parameters array An array of parameters for the message
$domain string The domain for the message
$locale string The locale
Résultat string