From c90ead9abd4c7cb218263bbd8f272d4b8e234323 Mon Sep 17 00:00:00 2001 From: Josef Glatz <josefglatz@gmail.com> Date: Wed, 28 Feb 2018 20:03:55 +0100 Subject: [PATCH] [BUGFIX] Add space in lockedRecords messages for translated languages The space between the time amount and time unit must be added directly in the code, as it's not possible to add a leading space character in a localized string on our translation server. - use GeneralUtility::trimExplode() for localized label parameter - add space directly in the code instead of the LLL string Already translated strings must not be adopted. Change-Id: Iefeb1a4ed202a4110535fe62d13ce8691a10a80d Resolves: #84088 Releases: master, 8.7 Reviewed-on: https://review.typo3.org/55948 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de> Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by: Markus Klein <markus.klein@typo3.org> Tested-by: Markus Klein <markus.klein@typo3.org> --- .../backend/Classes/Utility/BackendUtility.php | 12 ++++++------ .../Resources/Private/Language/locallang_core.xlf | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php index bed1d84b3de4..804a70c49a83 100644 --- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php +++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php @@ -1156,23 +1156,23 @@ class BackendUtility * @param string $labels Labels should be something like ' min| hrs| days| yrs| min| hour| day| year'. This value is typically delivered by this function call: $GLOBALS["LANG"]->sL("LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears") * @return string Formatted time */ - public static function calcAge($seconds, $labels = ' min| hrs| days| yrs| min| hour| day| year') + public static function calcAge($seconds, $labels = 'min|hrs|days|yrs|min|hour|day|year') { - $labelArr = explode('|', $labels); + $labelArr = GeneralUtility::trimExplode('|', $labels, true); $absSeconds = abs($seconds); $sign = $seconds < 0 ? -1 : 1; if ($absSeconds < 3600) { $val = round($absSeconds / 60); - $seconds = $sign * $val . ($val == 1 ? $labelArr[4] : $labelArr[0]); + $seconds = $sign * $val . ' ' . ($val == 1 ? $labelArr[4] : $labelArr[0]); } elseif ($absSeconds < 24 * 3600) { $val = round($absSeconds / 3600); - $seconds = $sign * $val . ($val == 1 ? $labelArr[5] : $labelArr[1]); + $seconds = $sign * $val . ' ' . ($val == 1 ? $labelArr[5] : $labelArr[1]); } elseif ($absSeconds < 365 * 24 * 3600) { $val = round($absSeconds / (24 * 3600)); - $seconds = $sign * $val . ($val == 1 ? $labelArr[6] : $labelArr[2]); + $seconds = $sign * $val . ' ' . ($val == 1 ? $labelArr[6] : $labelArr[2]); } else { $val = round($absSeconds / (365 * 24 * 3600)); - $seconds = $sign * $val . ($val == 1 ? $labelArr[7] : $labelArr[3]); + $seconds = $sign * $val . ' ' . ($val == 1 ? $labelArr[7] : $labelArr[3]); } return $seconds; } diff --git a/typo3/sysext/lang/Resources/Private/Language/locallang_core.xlf b/typo3/sysext/lang/Resources/Private/Language/locallang_core.xlf index cde5659fa0ee..faa3ac029281 100644 --- a/typo3/sysext/lang/Resources/Private/Language/locallang_core.xlf +++ b/typo3/sysext/lang/Resources/Private/Language/locallang_core.xlf @@ -158,7 +158,7 @@ Do you want to continue WITHOUT saving?</source> <source>End</source> </trans-unit> <trans-unit id="labels.minutesHoursDaysYears"> - <source> min| hrs| days| yrs| min| hour| day| year</source> + <source>min|hrs|days|yrs|min|hour|day|year</source> </trans-unit> <trans-unit id="labels.menu"> <source>Menu:</source> -- GitLab