mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-27 18:10:28 +00:00
Fix translation of date in the footer using IntlDateFormatter
Fixes #2476 Fixes #2870 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
parent
07e249ee57
commit
ebda18636c
1 changed files with 3 additions and 2 deletions
|
@ -158,10 +158,11 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
|
|||
$nbDays = (int) $interval->format('%a') ?: 1;
|
||||
|
||||
// force setlocale for date translation
|
||||
setlocale(\LC_TIME, strtolower($user->getConfig()->getLanguage()) . '_' . strtoupper(strtolower($user->getConfig()->getLanguage())));
|
||||
$locale = strtolower($user->getConfig()->getLanguage()) . '_' . strtoupper(strtolower($user->getConfig()->getLanguage()));
|
||||
$intlDateFormatter = new \IntlDateFormatter($locale, \IntlDateFormatter::LONG, \IntlDateFormatter::NONE);
|
||||
|
||||
return $this->translator->trans('footer.stats', [
|
||||
'%user_creation%' => strftime('%e %B %Y', $user->getCreatedAt()->getTimestamp()),
|
||||
'%user_creation%' => $intlDateFormatter->format($user->getCreatedAt()),
|
||||
'%nb_archives%' => $nbArchives,
|
||||
'%per_day%' => round($nbArchives / $nbDays, 2),
|
||||
]);
|
||||
|
|
Loading…
Reference in a new issue