LocalizationInitTrait uses trait:short
Table of Contents
Properties
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
$loc
public
string
$loc
= ''
Attributes
- #[Persistent]
$localizationContext
public
LocalizationContext
$localizationContext
Attributes
- #[Inject]
$localizationManager
public
LocalizationManager
$localizationManager
Attributes
- #[Inject]
Methods
getLocalizationContext()
public
getLocalizationContext() : LocalizationContext
Return values
LocalizationContextfallbackToMainLocalization()
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
boolinitializeLocalization()
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|nulllocalizationCurrencyKey()
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