diff options
author | Christian Schmidt <github@chsc.dk> | 2019-03-02 19:23:28 +0300 |
---|---|---|
committer | Stefan Giehl <stefan@matomo.org> | 2019-03-02 19:23:28 +0300 |
commit | 17f95c216e966f0f4120cec6c2d7a2d37d81e031 (patch) | |
tree | cf1c669ac1e34274734f9cbed7db1519f71f69d7 /core | |
parent | 0e3c30ba31790bbe2318b46a4e6fc7114b3c4e50 (diff) |
Preserve case for CLDR month/day names (#14015)
Do ucfirst() on formatted date instead.
Diffstat (limited to 'core')
-rw-r--r-- | core/Date.php | 8 | ||||
-rw-r--r-- | core/Period.php | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/core/Date.php b/core/Date.php index 3d1751591a..4c6ba7b6c7 100644 --- a/core/Date.php +++ b/core/Date.php @@ -10,6 +10,7 @@ namespace Piwik; use Exception; +use Piwik\Common; use Piwik\Container\StaticContainer; use Piwik\Intl\Data\Provider\DateTimeFormatProvider; @@ -708,9 +709,10 @@ class Date * The template should contain tags that will be replaced with localized date strings. * * @param string $template eg. `"MMM y"` + * @param bool $ucfirst whether the first letter should be upper-cased * @return string eg. `"Aug 2009"` */ - public function getLocalized($template) + public function getLocalized($template, $ucfirst = true) { $dateTimeFormatProvider = StaticContainer::get('Piwik\Intl\Data\Provider\DateTimeFormatProvider'); @@ -729,6 +731,10 @@ class Date } } + if ($ucfirst) { + $out = Common::mb_strtoupper(mb_substr($out, 0, 1)) . mb_substr($out, 1); + } + return $out; } diff --git a/core/Period.php b/core/Period.php index c9b0c04900..de40ffae65 100644 --- a/core/Period.php +++ b/core/Period.php @@ -366,7 +366,7 @@ abstract class Period list($formatStart, $formatEnd) = $this->explodeFormat($format); $string = $dateStart->getLocalized($formatStart); - $string .= $dateEnd->getLocalized($formatEnd); + $string .= $dateEnd->getLocalized($formatEnd, false); return $string; } |