Skip to content

Commit

Permalink
[BUGFIX] Add space in lockedRecords messages for translated languages
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
josefglatz authored and liayn committed Feb 28, 2018
1 parent 8acdac4 commit c90ead9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions typo3/sysext/backend/Classes/Utility/BackendUtility.php
Expand Up @@ -1156,23 +1156,23 @@ public static function time($value, $withSeconds = true)
* @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;
}
Expand Down
Expand Up @@ -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>
Expand Down

0 comments on commit c90ead9

Please sign in to comment.