From e111da777a735d8ba6c38416f1602cbfea4d3eb8 Mon Sep 17 00:00:00 2001 From: Georg Ehrke <developer@georgehrke.com> Date: Fri, 3 Nov 2017 10:48:04 +0100 Subject: [PATCH] Make L10N->l provide weekdayName Signed-off-by: Georg Ehrke <developer@georgehrke.com> --- lib/private/L10N/L10N.php | 2 ++ tests/lib/L10N/L10nTest.php | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/lib/private/L10N/L10N.php b/lib/private/L10N/L10N.php index 620c99dd1ec..19db04a7cd4 100644 --- a/lib/private/L10N/L10N.php +++ b/lib/private/L10N/L10N.php @@ -169,6 +169,8 @@ class L10N implements IL10N { return (string) Calendar::formatDatetime($value, $width, $locale); case 'time': return (string) Calendar::formatTime($value, $width, $locale); + case 'weekdayName': + return (string) Calendar::getWeekdayName($value, $width, $locale); default: return false; } diff --git a/tests/lib/L10N/L10nTest.php b/tests/lib/L10N/L10nTest.php index 6d662efee23..703aa9e227c 100644 --- a/tests/lib/L10N/L10nTest.php +++ b/tests/lib/L10N/L10nTest.php @@ -164,4 +164,9 @@ class L10nTest extends TestCase { $l = \OC::$server->getL10N('lib', 'de'); $this->assertEquals('de', $l->getLanguageCode()); } + + public function testWeekdayName() { + $l = \OC::$server->getL10N('lib', 'de'); + $this->assertEquals('Mo.', $l->l('weekdayName', new \DateTime('2017-11-6'), ['width' => 'abbreviated'])); + } } -- GitLab