fix date translations

This commit is contained in:
Xu 2023-11-23 14:30:46 +01:00 committed by Igor Scheller
parent fd56966435
commit fec2f17bea
35 changed files with 103 additions and 99 deletions

View File

@ -280,7 +280,7 @@ function shift_delete_controller()
error(sprintf(
__('Do you want to delete the shift %s from %s to %s?'),
$shift->shiftType->name,
$shift->start->format(__('Y-m-d H:i')),
$shift->start->format(__('general.datetime')),
$shift->end->format(__('H:i'))
), true),
form([

View File

@ -32,7 +32,7 @@ function dateWithEventDay(string $day): string
{
$date = Carbon::createFromFormat('Y-m-d', $day);
$dayOfEvent = DayOfEvent::get($date);
$dateFormatted = $date->format(__('Y-m-d'));
$dateFormatted = $date->format(__('general.date'));
if (!config('enable_show_day_of_event') || is_null($dayOfEvent)) {
return $dateFormatted;

View File

@ -45,8 +45,8 @@ class Shift
$title,
$type,
$location->name,
$start->format(__('Y-m-d H:i')),
$end->format(__('Y-m-d H:i'))
$start->format(__('general.datetime')),
$end->format(__('general.datetime'))
);
$workLog->save();

View File

@ -36,8 +36,8 @@ function mail_shift_change(Shift $old_shift, Shift $new_shift)
if ($old_shift->start->timestamp != $new_shift->start->timestamp) {
$message .= sprintf(
__('* Shift Start changed from %s to %s'),
$old_shift->start->format(__('Y-m-d H:i')),
$new_shift->start->format(__('Y-m-d H:i'))
$old_shift->start->format(__('general.datetime')),
$new_shift->start->format(__('general.datetime'))
) . "\n";
$noticeable_changes = true;
}
@ -45,8 +45,8 @@ function mail_shift_change(Shift $old_shift, Shift $new_shift)
if ($old_shift->end->timestamp != $new_shift->end->timestamp) {
$message .= sprintf(
__('* Shift End changed from %s to %s'),
$old_shift->end->format(__('Y-m-d H:i')),
$new_shift->end->format(__('Y-m-d H:i'))
$old_shift->end->format(__('general.datetime')),
$new_shift->end->format(__('general.datetime'))
) . "\n";
$noticeable_changes = true;
}
@ -66,7 +66,7 @@ function mail_shift_change(Shift $old_shift, Shift $new_shift)
$message .= $new_shift->shiftType->name . "\n";
$message .= $new_shift->title . "\n";
$message .= $new_shift->start->format(__('Y-m-d H:i')) . ' - ' . $new_shift->end->format(__('H:i')) . "\n";
$message .= $new_shift->start->format(__('general.datetime')) . ' - ' . $new_shift->end->format(__('H:i')) . "\n";
$message .= $new_location->name . "\n\n";
$message .= url('/shifts', ['action' => 'view', 'shift_id' => $new_shift->id]) . "\n";
@ -92,7 +92,7 @@ function mail_shift_assign(User $user, Shift $shift)
$message = __('You have been assigned to a Shift:') . "\n";
$message .= $shift->shiftType->name . "\n";
$message .= $shift->title . "\n";
$message .= $shift->start->format(__('Y-m-d H:i')) . ' - ' . $shift->end->format(__('H:i')) . "\n";
$message .= $shift->start->format(__('general.datetime')) . ' - ' . $shift->end->format(__('H:i')) . "\n";
$message .= $shift->location->name . "\n\n";
$message .= url('/shifts', ['action' => 'view', 'shift_id' => $shift->id]) . "\n";
@ -108,7 +108,7 @@ function mail_shift_removed(User $user, Shift $shift)
$message = __('You have been removed from a Shift:') . "\n";
$message .= $shift->shiftType->name . "\n";
$message .= $shift->title . "\n";
$message .= $shift->start->format(__('Y-m-d H:i')) . ' - ' . $shift->end->format(__('H:i')) . "\n";
$message .= $shift->start->format(__('general.datetime')) . ' - ' . $shift->end->format(__('H:i')) . "\n";
$message .= $shift->location->name . "\n";
engelsystem_email_to_user($user, __('Removed from Shift'), $message, true);

View File

@ -103,10 +103,10 @@ function admin_arrive()
$arrivalDate = $usr->state->arrival_date;
$plannedArrivalDate = $usr->personalData->planned_arrival_date;
$usr['rendered_planned_departure_date'] = $plannedDepartureDate
? $plannedDepartureDate->format(__('Y-m-d'))
? $plannedDepartureDate->format(__('general.date'))
: '-';
$usr['rendered_planned_arrival_date'] = $plannedArrivalDate ? $plannedArrivalDate->format(__('Y-m-d')) : '-';
$usr['rendered_arrival_date'] = $arrivalDate ? $arrivalDate->format(__('Y-m-d')) : '-';
$usr['rendered_planned_arrival_date'] = $plannedArrivalDate ? $plannedArrivalDate->format(__('general.date')) : '-';
$usr['rendered_arrival_date'] = $arrivalDate ? $arrivalDate->format(__('general.date')) : '-';
$usr['arrived'] = icon_bool($usr->state->arrived);
$usr['actions'] = form([
form_hidden('action', $usr->state->arrived ? 'reset' : 'arrived'),
@ -165,7 +165,7 @@ function admin_arrive()
foreach ($arrival_count_at_day as $day => $entry) {
$arrival_sum += $entry['count'];
$arrival_at_day[$day] = [
'day' => $entry['day']->format(__('Y-m-d')),
'day' => $entry['day']->format(__('general.date')),
'count' => $entry['count'],
'sum' => $arrival_sum,
];
@ -176,7 +176,7 @@ function admin_arrive()
foreach ($planned_arrival_count_at_day as $day => $entry) {
$planned_arrival_sum += $entry['count'];
$planned_arrival_at_day[$day] = [
'day' => $entry['day']->format(__('Y-m-d')),
'day' => $entry['day']->format(__('general.date')),
'count' => $entry['count'],
'sum' => $planned_arrival_sum,
];
@ -187,7 +187,7 @@ function admin_arrive()
foreach ($planned_departure_count_at_day as $day => $entry) {
$planned_departure_sum += $entry['count'];
$planned_departure_at_day[$day] = [
'day' => $entry['day']->format(__('Y-m-d')),
'day' => $entry['day']->format(__('general.date')),
'count' => $entry['count'],
'sum' => $planned_departure_sum,
];

View File

@ -319,9 +319,9 @@ function admin_shifts()
$shifts_table_entry = [
'timeslot' =>
icon('clock-history') . ' '
. $start->format(__('Y-m-d H:i'))
. $start->format(__('general.datetime'))
. ' - '
. '<span title="' . $end->format(__('Y-m-d')) . '">'
. '<span title="' . $end->format(__('general.date')) . '">'
. $end->format(__('H:i'))
. '</span>'
. ', ' . round($end->copy()->diffInMinutes($start) / 60, 2) . 'h'

View File

@ -60,7 +60,7 @@ function admin_user()
$html .= '<table>' . "\n";
$html .= ' <tr><td>' . __('general.nick') . '</td><td>' . '<input size="40" name="eNick" value="' . $user_source->name . '" class="form-control" maxlength="24"></td></tr>' . "\n";
$html .= ' <tr><td>' . __('Last login') . '</td><td><p class="help-block">'
. ($user_source->last_login_at ? $user_source->last_login_at->format(__('Y-m-d H:i')) : '-')
. ($user_source->last_login_at ? $user_source->last_login_at->format(__('general.datetime')) : '-')
. '</p></td></tr>' . "\n";
if (config('enable_user_name')) {
$html .= ' <tr><td>' . __('settings.profile.firstname') . '</td><td>' . '<input size="40" name="eName" value="' . $user_source->personalData->last_name . '" class="form-control" maxlength="64"></td></tr>' . "\n";

View File

@ -96,7 +96,7 @@ function user_myshifts()
return ShiftEntry_edit_view(
$shifts_user,
$shift->start->format(__('Y-m-d H:i')) . ', ' . shift_length($shift),
$shift->start->format(__('general.datetime')) . ', ' . shift_length($shift),
$shift->location->name,
$shift->shiftType->name,
$shiftEntry->angelType->name,

View File

@ -21,8 +21,8 @@ function ShiftEntry_delete_view_admin(Shift $shift, AngelType $angeltype, User $
__('Do you want to sign off %s from shift %s from %s to %s as %s?'),
User_Nick_render($signoff_user),
$shift->shiftType->name,
$shift->start->format(__('Y-m-d H:i')),
$shift->end->format(__('Y-m-d H:i')),
$shift->start->format(__('general.datetime')),
$shift->end->format(__('general.datetime')),
$angeltype->name
), true),
form([
@ -49,8 +49,8 @@ function ShiftEntry_delete_view(Shift $shift, AngelType $angeltype, User $signof
info(sprintf(
__('Do you want to sign off from your shift %s from %s to %s as %s?'),
$shift->shiftType->name,
$shift->start->format(__('Y-m-d H:i')),
$shift->end->format(__('Y-m-d H:i')),
$shift->start->format(__('general.datetime')),
$shift->end->format(__('general.datetime')),
$angeltype->name
), true),
@ -90,7 +90,7 @@ function ShiftEntry_create_view_admin(
$signup_user,
$users_select
) {
$start = $shift->start->format(__('Y-m-d H:i'));
$start = $shift->start->format(__('general.datetime'));
return page_with_title(
ShiftEntry_create_title() . ': ' . $shift->shiftType->name
. ' <small title="' . $start . '" data-countdown-ts="' . $shift->start->timestamp . '">%c</small>',
@ -123,7 +123,7 @@ function ShiftEntry_create_view_supporter(
$signup_user,
$users_select
) {
$start = $shift->start->format(__('Y-m-d H:i'));
$start = $shift->start->format(__('general.datetime'));
return page_with_title(
ShiftEntry_create_title() . ': ' . $shift->shiftType->name
. ' <small title="' . $start . '" data-countdown-ts="' . $shift->start->timestamp . '">%c</small>',
@ -152,7 +152,7 @@ function ShiftEntry_create_view_supporter(
*/
function ShiftEntry_create_view_user(Shift $shift, Location $location, AngelType $angeltype, $comment)
{
$start = $shift->start->format(__('Y-m-d H:i'));
$start = $shift->start->format(__('general.datetime'));
return page_with_title(
ShiftEntry_create_title() . ': ' . $shift->shiftType->name
. ' <small title="' . $start . '" data-countdown-ts="' . $shift->start->timestamp . '">%c</small>',

View File

@ -31,7 +31,7 @@ function Shift_view_header(Shift $shift, Location $location)
div('col-sm-3 col-xs-6', [
'<h4>' . __('shifts.start') . '</h4>',
'<p class="lead' . (time() >= $shift->start->timestamp ? ' text-success' : '') . '">',
icon('calendar-event') . $shift->start->format(__('Y-m-d')),
icon('calendar-event') . $shift->start->format(__('general.date')),
'<br />',
icon('clock') . $shift->start->format('H:i'),
'</p>',
@ -39,7 +39,7 @@ function Shift_view_header(Shift $shift, Location $location)
div('col-sm-3 col-xs-6', [
'<h4>' . __('shifts.end') . '</h4>',
'<p class="lead' . (time() >= $shift->end->timestamp ? ' text-success' : '') . '">',
icon('calendar-event') . $shift->end->format(__('Y-m-d')),
icon('calendar-event') . $shift->end->format(__('general.date')),
'<br />',
icon('clock') . $shift->end->format('H:i'),
'</p>',
@ -61,14 +61,14 @@ function Shift_editor_info_render(Shift $shift)
if (!empty($shift->created_by)) {
$info[] = sprintf(
icon('plus-lg') . __('created at %s by %s'),
$shift->created_at->format(__('Y-m-d H:i')),
$shift->created_at->format(__('general.datetime')),
User_Nick_render($shift->createdBy)
);
}
if (!empty($shift->updated_by)) {
$info[] = sprintf(
icon('pencil') . __('edited at %s by %s'),
$shift->updated_at->format(__('Y-m-d H:i')),
$shift->updated_at->format(__('general.datetime')),
User_Nick_render($shift->updatedBy)
);
}
@ -166,7 +166,7 @@ function Shift_view(
if (config('signup_advance_hours') && $shift->start->timestamp > time() + config('signup_advance_hours') * 3600) {
$content[] = info(sprintf(
__('This shift is in the far future and becomes available for signup at %s.'),
date(__('Y-m-d H:i'), $shift->start->timestamp - config('signup_advance_hours') * 3600)
date(__('general.datetime'), $shift->start->timestamp - config('signup_advance_hours') * 3600)
), true);
}
@ -202,7 +202,7 @@ function Shift_view(
$content[] = Shift_editor_info_render($shift);
}
$start = $shift->start->format(__('Y-m-d H:i'));
$start = $shift->start->format(__('general.datetime'));
$link = button(url('/user-shifts'), icon('chevron-left'), 'btn-sm');
return page_with_title(

View File

@ -110,10 +110,10 @@ function Users_view(
}
}
$u['arrival_date'] = $user->personalData->planned_arrival_date
? $user->personalData->planned_arrival_date->format(__('Y-m-d')) : '';
? $user->personalData->planned_arrival_date->format(__('general.date')) : '';
$u['departure_date'] = $user->personalData->planned_departure_date
? $user->personalData->planned_departure_date->format(__('Y-m-d')) : '';
$u['last_login_at'] = $user->last_login_at ? $user->last_login_at->format(__('m/d/Y h:i a')) : '';
? $user->personalData->planned_departure_date->format(__('general.date')) : '';
$u['last_login_at'] = $user->last_login_at ? $user->last_login_at->format(__('general.datetime')) : '';
$u['actions'] = table_buttons([
button_icon(url('/admin-user', ['id' => $user->id]), 'pencil', 'btn-sm'),
]);
@ -216,8 +216,8 @@ function User_shift_state_render($user)
$start = $nextShiftEntry->shift->start;
$end = $nextShiftEntry->shift->end;
$startFormat = $start->format(__('Y-m-d H:i'));
$endFormat = $end->format(__('Y-m-d H:i'));
$startFormat = $start->format(__('general.datetime'));
$endFormat = $end->format(__('general.datetime'));
$startTimestamp = $start->timestamp;
$endTimestamp = $end->timestamp;
@ -259,7 +259,7 @@ function User_last_shift_render($user)
$lastShiftEntry = $last_shifts->first();
$end = $lastShiftEntry->shift->end;
return '<span title="' . $end->format(__('Y-m-d H:i')) . '" data-countdown-ts="' . $end->timestamp . '">'
return '<span title="' . $end->format(__('general.datetime')) . '" data-countdown-ts="' . $end->timestamp . '">'
. __('Shift ended %c')
. '</span>';
}
@ -308,7 +308,7 @@ function User_view_myshift(Shift $shift, $user_source, $its_me)
$myshift = [
'date' => icon('calendar-event')
. $shift->start->format(__('Y-m-d')) . '<br>'
. $shift->start->format(__('general.date')) . '<br>'
. icon('clock-history') . $shift->start->format('H:i')
. ' - '
. $shift->end->format(__('H:i')),
@ -448,7 +448,7 @@ function User_view_worklog(Worklog $worklog, $admin_user_worklog_privilege)
}
return [
'date' => icon('calendar-event') . date(__('Y-m-d'), $worklog->worked_at->timestamp),
'date' => icon('calendar-event') . date(__('general.date'), $worklog->worked_at->timestamp),
'duration' => sprintf('%.2f', $worklog->hours) . ' h',
'location' => '',
'shift_info' => __('Work log entry'),
@ -456,7 +456,7 @@ function User_view_worklog(Worklog $worklog, $admin_user_worklog_privilege)
. sprintf(
__('Added by %s at %s'),
User_Nick_render($worklog->creator),
$worklog->created_at->format(__('Y-m-d H:i'))
$worklog->created_at->format(__('general.datetime'))
),
'actions' => $actions,
];
@ -726,7 +726,7 @@ function User_view_state_admin($freeloader, $user_source)
$state[] = '<span class="text-success">' . icon('house')
. sprintf(
__('Arrived at %s'),
$user_source->state->arrival_date ? $user_source->state->arrival_date->format(__('Y-m-d')) : ''
$user_source->state->arrival_date ? $user_source->state->arrival_date->format(__('general.date')) : ''
)
. '</span>';
@ -743,7 +743,7 @@ function User_view_state_admin($freeloader, $user_source)
$state[] = '<span class="text-danger">'
. ($arrivalDate ? sprintf(
__('Not arrived (Planned: %s)'),
$arrivalDate->format(__('Y-m-d'))
$arrivalDate->format(__('general.date'))
) : __('Not arrived'))
. '</span>';
}

View File

@ -55,7 +55,7 @@ msgstr "Autorisierung ist abgelaufen"
msgid "The provided CSRF token is invalid or has expired"
msgstr "Das angegebene CSRF Token ist ungültig oder abgelaufen"
msgid "Y-m-d"
msgid "general.date"
msgstr "d.m.Y"
msgid "%1$s, from %2$s to %3$s"
@ -486,9 +486,6 @@ msgstr ""
"Dein %s-Konto wurde gelöscht. Wenn Du dazu Fragen hast, kontaktiere bitte "
"den Himmel."
msgid "m/d/Y h:i a"
msgstr "d.m.Y H:i"
msgid "Active angels"
msgstr "Aktive Engel"
@ -760,12 +757,9 @@ msgstr "Aktiv erzwingen"
msgid "Edit user"
msgstr "User bearbeiten"
msgid "Y-m-d H:i"
msgid "general.datetime"
msgstr "d.m.Y H:i"
msgid "Y-m-d H:i:s"
msgstr "d.m.Y H:i:s"
msgid "Key changed."
msgstr "Key geändert."

View File

@ -672,6 +672,12 @@ msgstr "Please enter a mobile number in your settings!"
msgid "confirmation.delete"
msgstr "Do you really want to delete it?"
msgid "general.datetime"
msgstr "Y-m-d H:i"
msgid "general.date"
msgstr "Y-m-d"
msgid "general.id"
msgstr "ID"

View File

@ -47,7 +47,7 @@
{%- endif %}
<tr>
<td class="table-{{ td_type }}">{{ entry.created_at.format(__('Y-m-d H:i')) }}</td>
<td class="table-{{ td_type }}">{{ entry.created_at.format(__('general.datetime')) }}</td>
<td class="table-{{ td_type }}">
<span class="badge bg-{{ type }}">{{ entry.level|capitalize }}</span> <!-- //todo bs5 -->
</td>

View File

@ -10,7 +10,7 @@
{% block row_content %}
{% if schedule and schedule.updated_at %}
<div class="col-md-12">
<p>{{ __('schedule.last_update', [schedule.updated_at.format(__('Y-m-d H:i'))]) }}</p>
<p>{{ __('schedule.last_update', [schedule.updated_at.format(__('general.datetime'))]) }}</p>
</div>
{% endif %}

View File

@ -67,7 +67,7 @@
<tbody>
{% for shift in shifts %}
<tr>
<td>{{ shift.date.format(__('Y-m-d H:i')) }} - {{ shift.endDate.format(__('H:i')) }}</td>
<td>{{ shift.date.format(__('general.datetime')) }} - {{ shift.endDate.format(__('H:i')) }}</td>
<td>{{ shift.type }}</td>
<td>{{ shift.title }}{% if shift.subtitle %}<br><small>{{ shift.subtitle }}</small>{% endif %}</td>
<td>{{ shift.room.name }}</td>

View File

@ -43,10 +43,10 @@
{% endif %}
</td>
<td>{{ shift.count }}</td>
<td>{{ shift.start.format(__('Y-m-d H:i')) }}</td>
<td>{{ shift.end.format(__('Y-m-d H:i')) }}</td>
<td>{{ shift.start.format(__('general.datetime')) }}</td>
<td>{{ shift.end.format(__('general.datetime')) }}</td>
<td>{{ m.user(shift.createdBy) }}</td>
<td>{{ shift.created_at.format(__('Y-m-d H:i')) }}</td>
<td>{{ shift.created_at.format(__('general.datetime')) }}</td>
<td>
<form method="post" class="ps-1">
{{ csrf() }}

View File

@ -7,7 +7,7 @@
{% block message %}
{{ name }}
{{ title }}
{{ start.format(__('Y-m-d H:i')) }} - {{ end.format(__('Y-m-d H:i')) }}
{{ start.format(__('general.datetime')) }} - {{ end.format(__('general.datetime')) }}
{{ location.name }}
{% if start <= date() and not freeloaded %}

View File

@ -8,8 +8,8 @@
{% if config('event_start') and config('event_end') %}
{{ __('%1$s, from %2$s to %3$s', [
config('name'),
config('event_start').format(__('Y-m-d')),
config('event_end').format(__('Y-m-d'))
config('event_start').format(__('general.date')),
config('event_end').format(__('general.date'))
]) }}
{%- if config('enable_show_day_of_event') and day_of_event is defined -%}
, {{ __('event.day', [day_of_event]) }}
@ -17,7 +17,7 @@
{% elseif config('event_start') %}
{{ __('%1$s, starting %2$s', [
config('name'),
config('event_start').format(__('Y-m-d'))
config('event_start').format(__('general.date'))
]) }}
{%- if config('enable_show_day_of_event') and day_of_event is defined -%}
, {{ __('event.day', [day_of_event]) }}
@ -27,8 +27,8 @@
{% endif %} <br>
{% elseif config('event_start') and config('event_end') %}
{{ __('Event from %1$s to %2$s', [
config('event_start').format(__('Y-m-d')),
config('event_end').format(__('Y-m-d'))
config('event_start').format(__('general.date')),
config('event_end').format(__('general.date'))
]) }}
{%- if config('enable_show_day_of_event') and day_of_event is defined -%}
, {{ __('event.day', [day_of_event]) }}

View File

@ -476,20 +476,20 @@ Por scientie, musica, sport etc, litot Europa usa li sam vocabular.</code></pre>
<div class="col">
<h4>Countdowns</h4>
<ul>
<li title="{{ timestamp30s.format(__('Y-m-d H:i')) }}" data-countdown-ts="{{ timestamp30s.getTimestamp() }}">30s: %c</li>
<li title="{{ timestamp30m.format(__('Y-m-d H:i')) }}" data-countdown-ts="{{ timestamp30m.getTimestamp() }}">30m: %c</li>
<li title="{{ timestamp59m.format(__('Y-m-d H:i')) }}" data-countdown-ts="{{ timestamp59m.getTimestamp() }}">59m: %c</li>
<li title="{{ timestamp1h.format(__('Y-m-d H:i')) }}" data-countdown-ts="{{ timestamp1h.getTimestamp() }}">1h: %c</li>
<li title="{{ timestamp1h30m.format(__('Y-m-d H:i')) }}" data-countdown-ts="{{ timestamp1h30m.getTimestamp() }}">1h 30m: %c</li>
<li title="{{ timestamp1h31m.format(__('Y-m-d H:i')) }}" data-countdown-ts="{{ timestamp1h31m.getTimestamp() }}">1h 31m: %c</li>
<li title="{{ timestamp2h.format(__('Y-m-d H:i')) }}" data-countdown-ts="{{ timestamp2h.getTimestamp() }}">2h: %c</li>
<li title="{{ timestamp2d.format(__('Y-m-d H:i')) }}" data-countdown-ts="{{ timestamp2d.getTimestamp() }}">2d: %c</li>
<li title="{{ timestamp3m.format(__('Y-m-d H:i')) }}" data-countdown-ts="{{ timestamp3m.getTimestamp() }}">3m: %c</li>
<li title="{{ timestamp22y.format(__('Y-m-d H:i')) }}" data-countdown-ts="{{ timestamp22y.getTimestamp() }}">22y: %c</li>
<li title="{{ timestamp30s.format(__('general.datetime')) }}" data-countdown-ts="{{ timestamp30s.getTimestamp() }}">30s: %c</li>
<li title="{{ timestamp30m.format(__('general.datetime')) }}" data-countdown-ts="{{ timestamp30m.getTimestamp() }}">30m: %c</li>
<li title="{{ timestamp59m.format(__('general.datetime')) }}" data-countdown-ts="{{ timestamp59m.getTimestamp() }}">59m: %c</li>
<li title="{{ timestamp1h.format(__('general.datetime')) }}" data-countdown-ts="{{ timestamp1h.getTimestamp() }}">1h: %c</li>
<li title="{{ timestamp1h30m.format(__('general.datetime')) }}" data-countdown-ts="{{ timestamp1h30m.getTimestamp() }}">1h 30m: %c</li>
<li title="{{ timestamp1h31m.format(__('general.datetime')) }}" data-countdown-ts="{{ timestamp1h31m.getTimestamp() }}">1h 31m: %c</li>
<li title="{{ timestamp2h.format(__('general.datetime')) }}" data-countdown-ts="{{ timestamp2h.getTimestamp() }}">2h: %c</li>
<li title="{{ timestamp2d.format(__('general.datetime')) }}" data-countdown-ts="{{ timestamp2d.getTimestamp() }}">2d: %c</li>
<li title="{{ timestamp3m.format(__('general.datetime')) }}" data-countdown-ts="{{ timestamp3m.getTimestamp() }}">3m: %c</li>
<li title="{{ timestamp22y.format(__('general.datetime')) }}" data-countdown-ts="{{ timestamp22y.getTimestamp() }}">22y: %c</li>
</ul>
<ul>
<li title="{{ timestamp30mago.format(__('Y-m-d H:i')) }}" data-countdown-ts="{{ timestamp30mago.getTimestamp() }}">30m ago: %c</li>
<li title="{{ timestamp45mago.format(__('Y-m-d H:i')) }}" data-countdown-ts="{{ timestamp45mago.getTimestamp() }}">45m ago: %c</li>
<li title="{{ timestamp30mago.format(__('general.datetime')) }}" data-countdown-ts="{{ timestamp30mago.getTimestamp() }}">30m ago: %c</li>
<li title="{{ timestamp45mago.format(__('general.datetime')) }}" data-countdown-ts="{{ timestamp45mago.getTimestamp() }}">45m ago: %c</li>
</ul>
</div>
</div>

View File

@ -17,12 +17,12 @@
<div class="row">
<div class="col-md-6">
<p>
{{ m.icon('clock') }} {{ faq.updated_at.format(__('Y-m-d H:i')) }}
{{ m.icon('clock') }} {{ faq.updated_at.format(__('general.datetime')) }}
{% if faq.updated_at != faq.created_at %}
&emsp;{{ __('form.updated') }}
<br>
{{ m.icon('clock') }} {{ faq.created_at.format(__('Y-m-d H:i')) }}
{{ m.icon('clock') }} {{ faq.created_at.format(__('general.datetime')) }}
{% endif %}
</p>
</div>

View File

@ -51,7 +51,7 @@
<div class="card-footer {% if theme.type =='light' %}bg-light{% else %}bg-dark{% endif %} d-flex align-items-center">
<div class="me-3">
{{ m.icon('clock') }} {{ item.updated_at.format(__('Y-m-d H:i')) }}
{{ m.icon('clock') }} {{ item.updated_at.format(__('general.datetime')) }}
</div>
{% if has_permission_to('faq.edit') %}

View File

@ -21,8 +21,8 @@
{% if date > date() %}
<div class="col-sm-3 text-center d-none d-sm-block">
<h4>{{ name }}</h4>
<div class="h2 text-body" title="{{ date.format(__('Y-m-d H:i')) }}" data-countdown-ts="{{ date.getTimestamp() }}">%c</div>
<small>{{ date.format(__('Y-m-d')) }}</small>
<div class="h2 text-body" title="{{ date.format(__('general.datetime')) }}" data-countdown-ts="{{ date.getTimestamp() }}">%c</div>
<small>{{ date.format(__('general.date')) }}</small>
</div>
{% endif %}
{% endfor %}

View File

@ -25,7 +25,7 @@
<p class="card-text">{{ msg.text | nl2br }}</p>
</div>
<div class="card-footer d-flex justify-content-end align-items-center fw-light">
<small class="opacity-75">{{ msg.created_at.format(__('Y-m-d H:i')) }}</small>
<small class="opacity-75">{{ msg.created_at.format(__('general.datetime')) }}</small>
{% if own_message %}
<form action="{{ url('/messages/' ~ other_user.id ~ '/' ~ msg.id) }}"
enctype="multipart/form-data" method="post" class="ms-2"

View File

@ -51,7 +51,7 @@
</a>
</td>
<td>
{{ c.latest_message.created_at.format(__('Y-m-d H:i')) }}
{{ c.latest_message.created_at.format(__('general.datetime')) }}
</td>
</tr>
{% endfor %}

View File

@ -17,12 +17,12 @@
<div class="row">
<div class="col-md-6">
<p>
{{ m.icon('clock') }} {{ news.updated_at.format(__('Y-m-d H:i')) }}
{{ m.icon('clock') }} {{ news.updated_at.format(__('general.datetime')) }}
{% if news.updated_at != news.created_at %}
&emsp;{{ __('news.updated') }}
<br>
{{ m.icon('clock') }} {{ news.created_at.format(__('Y-m-d H:i')) }}
{{ m.icon('clock') }} {{ news.created_at.format(__('general.datetime')) }}
{% endif %}
&emsp;{{ m.user(news.user) }}

View File

@ -23,7 +23,7 @@
<div class="card-footer {% if theme.type =='light' %}bg-light{% else %}bg-dark{% endif %} text-muted d-flex align-items-center">
<div class="me-3">
{{ m.icon('clock') }}
{{ comment.created_at.format(__('Y-m-d H:i')) }}
{{ comment.created_at.format(__('general.datetime')) }}
</div>
{{ m.user(comment.user, {'pronoun': true}) }}

View File

@ -71,13 +71,13 @@
<div class="d-flex flex-column flex-md-row align-items-md-center gap-3">
{% if news.updated_at != news.created_at and not is_overview %}
<div>
{{ m.icon('clock') }} {{ news.updated_at.format(__('Y-m-d H:i')) }}
{{ m.icon('clock') }} {{ news.updated_at.format(__('general.datetime')) }}
{{ __('news.updated') }}
</div>
{% endif %}
<div>
{{ m.icon('clock') }} {{ news.created_at.format(__('Y-m-d H:i')) }}
{{ m.icon('clock') }} {{ news.created_at.format(__('general.datetime')) }}
</div>
<div class="text-truncate">

View File

@ -17,12 +17,12 @@
<div class="row">
<div class="col-md-6">
<p>
{{ m.icon('clock') }} {{ question.updated_at.format(__('Y-m-d H:i')) }}
{{ m.icon('clock') }} {{ question.updated_at.format(__('general.datetime')) }}
{% if question.updated_at != question.created_at %}
&emsp;{{ __('form.updated') }}
<br>
{{ m.icon('clock') }} {{ question.created_at.format(__('Y-m-d H:i')) }}
{{ m.icon('clock') }} {{ question.created_at.format(__('general.datetime')) }}
{% endif %}
</p>
</div>

View File

@ -37,7 +37,7 @@
<div class="card-footer {% if theme.type =='light' %}bg-light{% else %}bg-dark{% endif %} d-flex align-items-center">
<div class="me-3">
{{ m.icon('clock') }} {{ question.created_at.format(__('Y-m-d H:i')) }}
{{ m.icon('clock') }} {{ question.created_at.format(__('general.datetime')) }}
</div>
{% if has_permission_to('question.edit') %}
@ -72,7 +72,7 @@
</div>
<div class="card-footer bg-dark d-flex align-items-center {{ m.type_text_class() }}">
<div class="me-3">
{{ m.icon('clock') }} {{ question.updated_at.format(__('Y-m-d H:i')) }}
{{ m.icon('clock') }} {{ question.updated_at.format(__('general.datetime')) }}
</div>
{{ m.user(question.answerer, {'pronoun': true}) }}
</div>

View File

@ -33,7 +33,7 @@
<td>
<pre>{{ session.id[:15] }}&hellip;</pre>
</td>
<td>{{ session.last_activity.format(__('Y-m-d H:i:s')) }}</td>
<td>{{ session.last_activity.format(__('general.datetime')) }}</td>
<td>
{% if session.id != current_session %}
<form action="" enctype="multipart/form-data" method="post">

View File

@ -54,7 +54,7 @@ class DesignController extends BaseController
for ($i = 1; $i <= 600; $i++) {
$dateKey = $date->format('Y-m-d');
$formattedDisplayDate = $date->format(__('Y-m-d'));
$formattedDisplayDate = $date->format(__('general.date'));
$dateSelectOptions[$dateKey] = $formattedDisplayDate;
$date = $date->addDay();
}

View File

@ -29,7 +29,7 @@ class BarChart
$groupLabels[$groupKey] = $groupKey;
if ($date) {
$groupLabels[$groupKey] = $date->format(__('Y-m-d'));
$groupLabels[$groupKey] = $date->format(__('general.date'));
}
foreach ($rowLabels as $rowKey => $rowName) {

View File

@ -37,7 +37,7 @@ class BarChartTest extends TestCase
{
parent::setUp();
$this->rendererMock = $this->mockRenderer(false);
$this->mockTranslator();
$this->mockTranslator(fn(string $key, array $replace = []) => $key == 'general.date' ? 'Y-m-d' : $key);
}
public function provideRenderTestData(): Generator

View File

@ -61,7 +61,7 @@ abstract class TestCase extends PHPUnitTestCase
/**
* @return Translator&MockObject
*/
protected function mockTranslator(bool $mockImplementation = true): Translator
protected function mockTranslator(bool|callable $mockImplementation = true): Translator
{
$translator = $this->getMockBuilder(Translator::class)
->disableOriginalConstructor()
@ -70,7 +70,11 @@ abstract class TestCase extends PHPUnitTestCase
if ($mockImplementation) {
$translator->method('translate')
->willReturnCallback(fn(string $key, array $replace = []) => $key);
->willReturnCallback(
is_callable($mockImplementation)
? $mockImplementation
: fn(string $key, array $replace = []) => $key
);
}
$this->app->instance('translator', $translator);