CoolCMS API

LocalizationInitTrait uses trait:short

Table of Contents

Properties

$loc  : string
$localizationContext  : LocalizationContext
$localizationManager  : LocalizationManager

Methods

getLocalizationContext()  : LocalizationContext
fallbackToMainLocalization()  : bool
Whether the presenter may fall back to the main localization for an unknown locale; a regular page may not (404).
initializeLocalization()  : array{string, string}
loadLocalization()  : Localization|null
Returns the localization by `loc` from the URL, or `null` when there is no such locale.
localizationCurrencyKey()  : string|null
Front needs no currency key from the localization; the currency and the display region are filled by {@see CurrencyInitTrait::initializeDisplayRegion()}.

Properties

Methods

fallbackToMainLocalization()

Whether the presenter may fall back to the main localization for an unknown locale; a regular page may not (404).

protected fallbackToMainLocalization() : bool
Return values
bool

initializeLocalization()

private initializeLocalization() : array{string, string}
Return values
array{string, string} —

[default language, default currency]

loadLocalization()

Returns the localization by `loc` from the URL, or `null` when there is no such locale.

private loadLocalization() : Localization|null

IMPORTANT: an unknown locale must return null (a non-null return type would turn a forged prefix such as /xx/ into a TypeError, HTTP 500). BasePresenter::startup() turns null into a 404; the error page takes the main website localization via fallbackToMainLocalization().

Return values
Localization|null

localizationCurrencyKey()

Front needs no currency key from the localization; the currency and the display region are filled by {@see CurrencyInitTrait::initializeDisplayRegion()}.

private localizationCurrencyKey(object $localization) : string|null
Parameters
$localization : object
Return values
string|null
On this page

Search results