Feature: #107105 - Introduce expression for accessing site locale
See forge#107105
Description
A new Symfony ExpressionLanguage expression
locale has been
introduced.
This expression allows integrators and developers to directly access the current site locale, which is provided as a locale object. All public methods of this object are available for use.
For more information, refer to the API documentation: API
Example
Using locale() in TypoScript conditions
[locale().getName() == "en-US"]
page.20.value = bar
[END]
[locale().getCountryCode() == "US"]
page.30.value = foo
[END]
[locale().isRightToLeftLanguageDirection()]
page.40.value = bar
[END]
Copied!
Using locale() in a form variant definition
variants:
- identifier: language-variant-1
condition: 'locale().getName() == "en-US"'
label: 'First name'
Copied!
Impact
Developers can now compare or evaluate the site locale directly in expressions,
without using
site.