mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 19:11:07 +00:00
Merge pull request #4971 from wallabag/fix/footer-date-translation
Fix translation of date in the footer using IntlDateFormatter
This commit is contained in:
commit
8869c7a153
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