LocalizationTrait
Table of Contents
Properties
- $locale : string|null
- $requestedLocale : string|null
- The language that was requested to be rendered.
Methods
- getLocale() : string
- getRequestedLocale() : string
- Get the requested locale.
- setLocale() : $this
- setRequestedLocale() : $this
- Set the requested locale.
- validateExtra_localization() : mixed
Properties
$locale
protected
string|null
$locale
Tags
$requestedLocale
The language that was requested to be rendered.
protected
string|null
$requestedLocale
This may not be the rendered locale - as the requested language might be available. This is primarily for extensions to use in custom workflow messages.
The use-case is a bit like this:
- Your organization serves many similar locales (eg es_MX+es_CR+es_HN or en_GB+en_US+en_NZ).
- You want to write one message (es_MX) for several locales (es_MX+es_CR+es_HN)
- You want to include some conditional content that adapts the recipient's requested locale (es_CR) -- even though the template was stored as es_MX. For example your front end website has more nuanced translations than your workflow messages and you wish to redirect the user to a page on your website.
Tags
Methods
getLocale()
public
getLocale() : string
Return values
stringgetRequestedLocale()
Get the requested locale.
public
getRequestedLocale() : string
This may differ from the rendered locale (e.g. if a translation is not available). It is not used in core but extensions may leverage this information.
Return values
stringsetLocale()
public
setLocale(string|null $locale) : $this
Parameters
- $locale : string|null
Return values
$thissetRequestedLocale()
Set the requested locale.
public
setRequestedLocale(string|null $requestedLocale) : $this
Parameters
- $requestedLocale : string|null
Return values
$thisvalidateExtra_localization()
protected
validateExtra_localization(mixed &$errors) : mixed
Parameters
- $errors : mixed