本文整理匯總了PHP中Jenssegers\Date\Date::getTranslator方法的典型用法代碼示例。如果您正苦於以下問題:PHP Date::getTranslator方法的具體用法?PHP Date::getTranslator怎麽用?PHP Date::getTranslator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Jenssegers\Date\Date
的用法示例。
在下文中一共展示了Date::getTranslator方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testGetsAndSetsTranslator
public function testGetsAndSetsTranslator()
{
$translator = new Translator();
$this->assertNotEquals($translator, Date::getTranslator());
Date::setTranslator($translator);
$this->assertEquals($translator, Date::getTranslator());
}
示例2: function
<?php
$translator = \Jenssegers\Date\Date::getTranslator();
$monthKeys = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
$dayKeys = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
$months = [];
foreach ($monthKeys as $key) {
$months[] = $translator->transChoice($key, 0);
}
$days = [];
foreach ($dayKeys as $key) {
$days[] = mb_strtoupper(mb_substr($translator->trans($key), 0, 1));
}
$months = json_encode($months, JSON_UNESCAPED_UNICODE);
$days = json_encode($days, JSON_UNESCAPED_UNICODE);
?>
<script>
$(function () {
$('.ui.calendar.date').each(function (idx, elm) {
elm = $(elm);
var format = elm.data('datepicker-format');
if (!format) {
format = 'YYYY/MM/DD';
}
elm.calendar({
type: 'date',
formatter: {
date: function (date, settings) {