Add context for date/time related translations

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2023-03-04 10:44:22 -03:00
parent 20a246203f
commit d19ebcf9b8
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
3 changed files with 81 additions and 147 deletions

View File

@ -85,6 +85,9 @@ function registerTimePickerTranslations () {
$.timepicker.regional[''].hourText = window.Messages.strCalendarHour;
$.timepicker.regional[''].minuteText = window.Messages.strCalendarMinute;
$.timepicker.regional[''].secondText = window.Messages.strCalendarSecond;
$.timepicker.regional[''].millisecText = window.Messages.strCalendarMillisecond;
$.timepicker.regional[''].microsecText = window.Messages.strCalendarMicrosecond;
$.timepicker.regional[''].timezoneText = window.Messages.strCalendarTimezone;
// eslint-disable-next-line no-underscore-dangle
$.extend($.timepicker._defaults, $.timepicker.regional['']);

View File

@ -714,118 +714,68 @@ final class JavaScriptMessagesController
'strShow' => __('Show'),
'strStructure' => __('Structure'),
/* DateTime Picker */
// l10n: Month name
'strMonthNameJan' => __('January'),
// l10n: Month name
'strMonthNameFeb' => __('February'),
// l10n: Month name
'strMonthNameMar' => __('March'),
// l10n: Month name
'strMonthNameApr' => __('April'),
// l10n: Month name
'strMonthNameMay' => __('May'),
// l10n: Month name
'strMonthNameJun' => __('June'),
// l10n: Month name
'strMonthNameJul' => __('July'),
// l10n: Month name
'strMonthNameAug' => __('August'),
// l10n: Month name
'strMonthNameSep' => __('September'),
// l10n: Month name
'strMonthNameOct' => __('October'),
// l10n: Month name
'strMonthNameNov' => __('November'),
// l10n: Month name
'strMonthNameDec' => __('December'),
/* l10n: Short month name for January */
'strMonthNameJanShort' => __('Jan'),
/* l10n: Short month name for February */
'strMonthNameFebShort' => __('Feb'),
/* l10n: Short month name for March */
'strMonthNameMarShort' => __('Mar'),
/* l10n: Short month name for April */
'strMonthNameAprShort' => __('Apr'),
/* l10n: Short month name for May */
'strMonthNameMayShort' => __('May'),
/* l10n: Short month name for June */
'strMonthNameJunShort' => __('Jun'),
/* l10n: Short month name for July */
'strMonthNameJulShort' => __('Jul'),
/* l10n: Short month name for August */
'strMonthNameAugShort' => __('Aug'),
/* l10n: Short month name for September */
'strMonthNameSepShort' => __('Sep'),
/* l10n: Short month name for October */
'strMonthNameOctShort' => __('Oct'),
/* l10n: Short month name for November */
'strMonthNameNovShort' => __('Nov'),
/* l10n: Short month name for December */
'strMonthNameDecShort' => __('Dec'),
/* l10n: Week day name */
'strDayNameSun' => __('Sunday'),
/* l10n: Week day name */
'strDayNameMon' => __('Monday'),
/* l10n: Week day name */
'strDayNameTue' => __('Tuesday'),
/* l10n: Week day name */
'strDayNameWed' => __('Wednesday'),
/* l10n: Week day name */
'strDayNameThu' => __('Thursday'),
/* l10n: Week day name */
'strDayNameFri' => __('Friday'),
/* l10n: Week day name */
'strDayNameSat' => __('Saturday'),
/* l10n: Short week day name for Sunday */
'strDayNameSunShort' => __('Sun'),
/* l10n: Short week day name for Monday */
'strDayNameMonShort' => __('Mon'),
/* l10n: Short week day name for Tuesday */
'strDayNameTueShort' => __('Tue'),
/* l10n: Short week day name for Wednesday */
'strDayNameWedShort' => __('Wed'),
/* l10n: Short week day name for Thursday */
'strDayNameThuShort' => __('Thu'),
/* l10n: Short week day name for Friday */
'strDayNameFriShort' => __('Fri'),
/* l10n: Short week day name for Saturday */
'strDayNameSatShort' => __('Sat'),
/* l10n: Minimal week day name for Sunday */
'strDayNameSunMin' => __('Su'),
/* l10n: Minimal week day name for Monday */
'strDayNameMonMin' => __('Mo'),
/* l10n: Minimal week day name for Tuesday */
'strDayNameTueMin' => __('Tu'),
/* l10n: Minimal week day name for Wednesday */
'strDayNameWedMin' => __('We'),
/* l10n: Minimal week day name for Thursday */
'strDayNameThuMin' => __('Th'),
/* l10n: Minimal week day name for Friday */
'strDayNameFriMin' => __('Fr'),
/* l10n: Minimal week day name for Saturday */
'strDayNameSatMin' => __('Sa'),
/* l10n: Column header for week of the year in calendar */
'strWeekHeader' => __('Wk'),
// phpcs:ignore Generic.Files.LineLength.TooLong
/* l10n: The month-year order in a calendar. Do not translate! Use either "calendar-month-year" or "calendar-year-month". */
'strMonthAfterYear' => __('calendar-month-year'),
/* l10n: Year suffix for calendar, "none" is empty. */
'strYearSuffix' => __('none'),
/* l10n: A specific point in the day, as shown on a clock. */
'strCalendarTime' => __('Time'),
/* l10n: Period of time. */
'strCalendarHour' => __('Hour'),
/* l10n: Period of time. */
'strCalendarMinute' => __('Minute'),
/* l10n: Period of time. */
'strCalendarSecond' => __('Second'),
'strMonthNameJan' => _pgettext('Month name', 'January'),
'strMonthNameFeb' => _pgettext('Month name', 'February'),
'strMonthNameMar' => _pgettext('Month name', 'March'),
'strMonthNameApr' => _pgettext('Month name', 'April'),
'strMonthNameMay' => _pgettext('Month name', 'May'),
'strMonthNameJun' => _pgettext('Month name', 'June'),
'strMonthNameJul' => _pgettext('Month name', 'July'),
'strMonthNameAug' => _pgettext('Month name', 'August'),
'strMonthNameSep' => _pgettext('Month name', 'September'),
'strMonthNameOct' => _pgettext('Month name', 'October'),
'strMonthNameNov' => _pgettext('Month name', 'November'),
'strMonthNameDec' => _pgettext('Month name', 'December'),
'strMonthNameJanShort' => _pgettext('Short month name for January', 'Jan'),
'strMonthNameFebShort' => _pgettext('Short month name for February', 'Feb'),
'strMonthNameMarShort' => _pgettext('Short month name for March', 'Mar'),
'strMonthNameAprShort' => _pgettext('Short month name for April', 'Apr'),
'strMonthNameMayShort' => _pgettext('Short month name for May', 'May'),
'strMonthNameJunShort' => _pgettext('Short month name for June', 'Jun'),
'strMonthNameJulShort' => _pgettext('Short month name for July', 'Jul'),
'strMonthNameAugShort' => _pgettext('Short month name for August', 'Aug'),
'strMonthNameSepShort' => _pgettext('Short month name for September', 'Sep'),
'strMonthNameOctShort' => _pgettext('Short month name for October', 'Oct'),
'strMonthNameNovShort' => _pgettext('Short month name for November', 'Nov'),
'strMonthNameDecShort' => _pgettext('Short month name for December', 'Dec'),
'strDayNameSun' => _pgettext('Week day name', 'Sunday'),
'strDayNameMon' => _pgettext('Week day name', 'Monday'),
'strDayNameTue' => _pgettext('Week day name', 'Tuesday'),
'strDayNameWed' => _pgettext('Week day name', 'Wednesday'),
'strDayNameThu' => _pgettext('Week day name', 'Thursday'),
'strDayNameFri' => _pgettext('Week day name', 'Friday'),
'strDayNameSat' => _pgettext('Week day name', 'Saturday'),
'strDayNameSunShort' => _pgettext('Short week day name for Sunday', 'Sun'),
'strDayNameMonShort' => _pgettext('Short week day name for Monday', 'Mon'),
'strDayNameTueShort' => _pgettext('Short week day name for Tuesday', 'Tue'),
'strDayNameWedShort' => _pgettext('Short week day name for Wednesday', 'Wed'),
'strDayNameThuShort' => _pgettext('Short week day name for Thursday', 'Thu'),
'strDayNameFriShort' => _pgettext('Short week day name for Friday', 'Fri'),
'strDayNameSatShort' => _pgettext('Short week day name for Saturday', 'Sat'),
'strDayNameSunMin' => _pgettext('Minimal week day name for Sunday', 'Su'),
'strDayNameMonMin' => _pgettext('Minimal week day name for Monday', 'Mo'),
'strDayNameTueMin' => _pgettext('Minimal week day name for Tuesday', 'Tu'),
'strDayNameWedMin' => _pgettext('Minimal week day name for Wednesday', 'We'),
'strDayNameThuMin' => _pgettext('Minimal week day name for Thursday', 'Th'),
'strDayNameFriMin' => _pgettext('Minimal week day name for Friday', 'Fr'),
'strDayNameSatMin' => _pgettext('Minimal week day name for Saturday', 'Sa'),
'strWeekHeader' => _pgettext('Column header for week of the year in calendar', 'Wk'),
/* l10n: DO NOT TRANSLATE! Use either "calendar-month-year" or "calendar-year-month". */
'strMonthAfterYear' => _pgettext('The month-year order in a calendar', 'calendar-month-year'),
'strYearSuffix' => _pgettext('Year suffix for calendar, "none" is empty', 'none'),
'strCalendarTime' => _pgettext('A specific point in the day, as shown on a clock', 'Time'),
'strCalendarHour' => _pgettext('Unit of time', 'Hour'),
'strCalendarMinute' => _pgettext('Unit of time', 'Minute'),
'strCalendarSecond' => _pgettext('Unit of time', 'Second'),
'strCalendarMillisecond' => _pgettext('Unit of time', 'Millisecond'),
'strCalendarMicrosecond' => _pgettext('Unit of time', 'Microsecond'),
'strCalendarTimezone' => _pgettext('The time zone for a time of day', 'Time zone'),
/* l10n: Display text for calendar close link */
'strCalendarClose' => __('Done'),
/* l10n: Previous month. Display text for previous month link in calendar */
'strCalendarPrevious' => __('Prev'),
/* l10n: Next month. Display text for next month link in calendar */
'strCalendarNext' => __('Next'),
/* l10n: Display text for previous month link in calendar */
'strCalendarPrevious' => _pgettext('Previous month', 'Prev'),
/* l10n: Display text for next month link in calendar */
'strCalendarNext' => _pgettext('Next month', 'Next'),
/* l10n: Display text for current month link in calendar */
'strCalendarCurrent' => __('Today'),

View File

@ -618,46 +618,27 @@ class Util
public static function localisedDate($timestamp = -1, $format = ''): string
{
$month = [
/* l10n: Short month name */
__('Jan'),
/* l10n: Short month name */
__('Feb'),
/* l10n: Short month name */
__('Mar'),
/* l10n: Short month name */
__('Apr'),
/* l10n: Short month name */
_pgettext('Short month name', 'May'),
/* l10n: Short month name */
__('Jun'),
/* l10n: Short month name */
__('Jul'),
/* l10n: Short month name */
__('Aug'),
/* l10n: Short month name */
__('Sep'),
/* l10n: Short month name */
__('Oct'),
/* l10n: Short month name */
__('Nov'),
/* l10n: Short month name */
__('Dec'),
_pgettext('Short month name for January', 'Jan'),
_pgettext('Short month name for February', 'Feb'),
_pgettext('Short month name for March', 'Mar'),
_pgettext('Short month name for April', 'Apr'),
_pgettext('Short month name for May', 'May'),
_pgettext('Short month name for June', 'Jun'),
_pgettext('Short month name for July', 'Jul'),
_pgettext('Short month name for August', 'Aug'),
_pgettext('Short month name for September', 'Sep'),
_pgettext('Short month name for October', 'Oct'),
_pgettext('Short month name for November', 'Nov'),
_pgettext('Short month name for December', 'Dec'),
];
$dayOfWeek = [
/* l10n: Short week day name for Sunday */
_pgettext('Short week day name for Sunday', 'Sun'),
/* l10n: Short week day name for Monday */
__('Mon'),
/* l10n: Short week day name for Tuesday */
__('Tue'),
/* l10n: Short week day name for Wednesday */
__('Wed'),
/* l10n: Short week day name for Thursday */
__('Thu'),
/* l10n: Short week day name for Friday */
__('Fri'),
/* l10n: Short week day name for Saturday */
__('Sat'),
_pgettext('Short week day name for Monday', 'Mon'),
_pgettext('Short week day name for Tuesday', 'Tue'),
_pgettext('Short week day name for Wednesday', 'Wed'),
_pgettext('Short week day name for Thursday', 'Thu'),
_pgettext('Short week day name for Friday', 'Fri'),
_pgettext('Short week day name for Saturday', 'Sat'),
];
if ($format == '') {