本文整理汇总了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) {