PHP Class RainLab\Translate\Classes\Translator

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

Protected Properties

Property 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.

Public Methods

Method 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.

Protected Methods

Method Description
getSessionLocale ( )
setSessionLocale ( $locale )

Method Details

getCurrentPathInLocale() public method

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
return string

getDefaultLocale() public method

Returns the default locale as set by the application.
public getDefaultLocale ( ) : string
return string

getLocale() public method

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

getPathInLocale() public method

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
return string

getSessionLocale() protected method

protected getSessionLocale ( )

init() public method

Initialize the singleton
public init ( ) : void
return void

isConfigured() public method

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

loadLocaleFromRequest() public method

Sets the locale based on the first URI segment.
public loadLocaleFromRequest ( ) : boolean
return boolean

loadLocaleFromSession() public method

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

setLocale() public method

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.
return boolean Returns true if the locale exists and is set.

setSessionLocale() protected method

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