Improved Locales (#5497)

- Switch Chinese time format to 24-hours - fixes #5496
- Use always 4 chars for year
- Use one `HH` instead of `H`, so we don't have to convert during runtime
- Update all locales
- Allow seeing time and date format in help UI
- Fix RTL in UI
- Show stats about found formats in Locales command
This commit is contained in:
Kevin Papst
2025-05-26 20:59:39 +02:00
committed by GitHub
parent 87168de4f1
commit e69ac6968b
9 changed files with 282 additions and 154 deletions

View File

@@ -10,12 +10,13 @@
namespace App\Configuration;
use App\Entity\User;
use App\Utils\Duration;
final class LocaleService
{
public const DEFAULT_SETTINGS = [
'date' => 'dd.MM.y',
'time' => 'HH:mm',
'time' => 'H:mm',
'rtl' => false,
'translation' => false,
];
@@ -55,10 +56,7 @@ final class LocaleService
}
/**
* Returns the locale specific date format, which should be used in combination with the twig filter "|date".
*
* @param string $locale
* @return string
* Returns the locale-specific date format, which should be used in combination with the twig filter "|date".
*/
public function getDateFormat(string $locale): string
{
@@ -66,10 +64,7 @@ final class LocaleService
}
/**
* Returns the locale specific time format, which should be used in combination with the twig filter "|time".
*
* @param string $locale
* @return string
* Returns the locale-specific time format, which should be used in combination with the twig filter "|time".
*/
public function getTimeFormat(string $locale): string
{
@@ -77,10 +72,7 @@ final class LocaleService
}
/**
* Returns the locale specific datetime format, which should be used in combination with the twig filter "|date".
*
* @param string $locale
* @return string
* Returns the locale-specific datetime format, which should be used in combination with the twig filter "|date".
*/
public function getDateTimeFormat(string $locale): string
{
@@ -89,13 +81,10 @@ final class LocaleService
/**
* Returns the format used in the "|duration" twig filter to display a Timesheet duration.
*
* @param string $locale
* @return string
*/
public function getDurationFormat(string $locale): string
{
return '%h:%m';
return Duration::FORMAT_DEFAULT;
}
public function isRightToLeft(string $locale): bool