PHP Class RainLab\Translate\Classes\Translator

Author: Alexey Bobkov, Samuel Georges
Inheritance: use trait October\Rain\Support\Traits\Singleton
Afficher le fichier Open project: rainlab/translate-plugin Class Usage Examples

Protected Properties

Свойство Type Description
$activeLocale The locale to use on the front end.
$defaultLocale The default locale if no active is set.
$isConfigured Determine if translate plugin is configured and ready to be used.

Méthodes publiques

Méthode Description
getCurrentPathInLocale ( string $locale = null ) : string Returns the current path prefixed with language code.
getDefaultLocale ( ) : string Returns the default locale as set by the application.
getLocale ( boolean $fromSession = false ) : string Returns the active locale set by this instance.
getPathInLocale ( string $path, string $locale = null ) : string Returns the path prefixed with language code.
init ( ) : void Initialize the singleton
isConfigured ( ) : boolean Check if this plugin is installed and the database is available, stores the result in the session for efficiency.
loadLocaleFromRequest ( ) : boolean Sets the locale based on the first URI segment.
loadLocaleFromSession ( ) : boolean Looks at the session storage to find a locale.
setLocale ( string $locale, boolean $remember = true ) : boolean Changes the locale in the application and optionally stores it in the session.

Méthodes protégées

Méthode Description
getSessionLocale ( )
setSessionLocale ( $locale )

Method Details

getCurrentPathInLocale() public méthode

Returns the current path prefixed with language code.
public getCurrentPathInLocale ( string $locale = null ) : string
$locale string optional language code, default to the system default language
Résultat string

getDefaultLocale() public méthode

Returns the default locale as set by the application.
public getDefaultLocale ( ) : string
Résultat string

getLocale() public méthode

Returns the active locale set by this instance.
public getLocale ( boolean $fromSession = false ) : string
$fromSession boolean Look in the session.
Résultat string

getPathInLocale() public méthode

Returns the path prefixed with language code.
public getPathInLocale ( string $path, string $locale = null ) : string
$path string Path to rewrite
$locale string optional language code, default to the system default language
Résultat string

getSessionLocale() protected méthode

protected getSessionLocale ( )

init() public méthode

Initialize the singleton
public init ( ) : void
Résultat void

isConfigured() public méthode

Check if this plugin is installed and the database is available, stores the result in the session for efficiency.
public isConfigured ( ) : boolean
Résultat boolean

loadLocaleFromRequest() public méthode

Sets the locale based on the first URI segment.
public loadLocaleFromRequest ( ) : boolean
Résultat boolean

loadLocaleFromSession() public méthode

Looks at the session storage to find a locale.
public loadLocaleFromSession ( ) : boolean
Résultat boolean

setLocale() public méthode

Changes the locale in the application and optionally stores it in the session.
public setLocale ( string $locale, boolean $remember = true ) : boolean
$locale string Locale to use
$remember boolean Set to false to not store in the session.
Résultat boolean Returns true if the locale exists and is set.

setSessionLocale() protected méthode

protected setSessionLocale ( $locale )

Property Details

$activeLocale protected_oe property

The locale to use on the front end.
protected $activeLocale

$defaultLocale protected_oe property

The default locale if no active is set.
protected $defaultLocale

$isConfigured protected_oe property

Determine if translate plugin is configured and ready to be used.
protected $isConfigured