PHP Класс RainLab\Translate\Classes\Translator

Автор: Alexey Bobkov, Samuel Georges
Наследование: use trait October\Rain\Support\Traits\Singleton
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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.

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
getSessionLocale ( )
setSessionLocale ( $locale )

Описание методов

getCurrentPathInLocale() публичный Метод

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
Результат string

getDefaultLocale() публичный Метод

Returns the default locale as set by the application.
public getDefaultLocale ( ) : string
Результат string

getLocale() публичный Метод

Returns the active locale set by this instance.
public getLocale ( boolean $fromSession = false ) : string
$fromSession boolean Look in the session.
Результат string

getPathInLocale() публичный Метод

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
Результат string

getSessionLocale() защищенный Метод

protected getSessionLocale ( )

init() публичный Метод

Initialize the singleton
public init ( ) : void
Результат void

isConfigured() публичный Метод

Check if this plugin is installed and the database is available, stores the result in the session for efficiency.
public isConfigured ( ) : boolean
Результат boolean

loadLocaleFromRequest() публичный Метод

Sets the locale based on the first URI segment.
public loadLocaleFromRequest ( ) : boolean
Результат boolean

loadLocaleFromSession() публичный Метод

Looks at the session storage to find a locale.
public loadLocaleFromSession ( ) : boolean
Результат boolean

setLocale() публичный Метод

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.
Результат boolean Returns true if the locale exists and is set.

setSessionLocale() защищенный Метод

protected setSessionLocale ( $locale )

Описание свойств

$activeLocale защищенное свойство

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

$defaultLocale защищенное свойство

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

$isConfigured защищенное свойство

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