Make L10N->l provide weekdayName

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
This commit is contained in:
Georg Ehrke 2017-11-03 10:48:04 +01:00
parent 43147aeada
commit e111da777a
No known key found for this signature in database
GPG Key ID: 9D98FD9380A1CB43
2 changed files with 7 additions and 0 deletions

View File

@ -169,6 +169,8 @@ class L10N implements IL10N {
return (string) Calendar::formatDatetime($value, $width, $locale); return (string) Calendar::formatDatetime($value, $width, $locale);
case 'time': case 'time':
return (string) Calendar::formatTime($value, $width, $locale); return (string) Calendar::formatTime($value, $width, $locale);
case 'weekdayName':
return (string) Calendar::getWeekdayName($value, $width, $locale);
default: default:
return false; return false;
} }

View File

@ -164,4 +164,9 @@ class L10nTest extends TestCase {
$l = \OC::$server->getL10N('lib', 'de'); $l = \OC::$server->getL10N('lib', 'de');
$this->assertEquals('de', $l->getLanguageCode()); $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']));
}
} }