Skip to content

Commit 5b39cc2

Browse files
brosuagarvinhicking
authored andcommitted
[TASK] Use of siteLanguage(“locale”) corrected (#1591)
Releases: main, 13.4, 12.4
1 parent e5e1c86 commit 5b39cc2

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Documentation/Conditions/Index.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,13 @@ siteLanguage()
14101410
Returns the language ID as an integer.
14111411

14121412
:typoscript:`siteLanguage("locale")`
1413-
Returns the current locale as a string, for example `en_GB` or `de_DE`.
1413+
Returns the current locale as :php:`\TYPO3\CMS\Core\Localization\Locale`.
1414+
You can call all public methods of the object, for example
1415+
:typoscript:`siteLanguage("locale").getName()` returns `en-GB` or `de-DE`.
1416+
1417+
**Note**: In TYPO3 v12 there was an unintentional breaking change,
1418+
whereby an object and not a string is returned.
1419+
A future TYPO3 release may address implementing a shortcut for this.
14141420

14151421
:typoscript:`siteLanguage("base")`
14161422
Returns the configured base URL as a string.
@@ -1461,8 +1467,8 @@ siteLanguage()
14611467
.. code-block:: typoscript
14621468
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
14631469
1464-
[siteLanguage("locale") == "de_CH"]
1465-
page.10.value = This site has the locale "de_CH"
1470+
[siteLanguage("locale").getName() == "de-CH"]
1471+
page.10.value = This site has the locale "de_CH" or "de_CH.utf8"
14661472
[END]
14671473
14681474
[siteLanguage("title") == "Italy"]

Documentation/PageTsconfig/Rte.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ config.contentsLanguageDirection
289289
RTE.config.contentsLanguageDirection = rtl
290290
291291
# except for the following language:
292-
[siteLanguage("locale") == "en_US"]
292+
[siteLanguage("locale").getName() == "en-US"]
293293
RTE.config.contentsLanguageDirection = ltr
294294
[END]
295295

0 commit comments

Comments
 (0)