Skip to content

Commit

Permalink
Make L10N->l provide weekdayName
Browse files Browse the repository at this point in the history
Signed-off-by: Georg Ehrke <[email protected]>
  • Loading branch information
georgehrke committed Nov 3, 2017
1 parent 43147ae commit e111da7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/private/L10N/L10N.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ public function l($type, $data = null, $options = array()) {
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;
}
Expand Down
5 changes: 5 additions & 0 deletions tests/lib/L10N/L10nTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,9 @@ public function testServiceGetLanguageCode() {
$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']));
}
}

0 comments on commit e111da7

Please sign in to comment.