Skip to content

Commit d19ebcf

Browse files
committed
Add context for date/time related translations
Signed-off-by: Maurício Meneghini Fauth <[email protected]>
1 parent 20a2462 commit d19ebcf

3 files changed

Lines changed: 81 additions & 147 deletions

File tree

js/src/datetimepicker.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ function registerTimePickerTranslations () {
8585
$.timepicker.regional[''].hourText = window.Messages.strCalendarHour;
8686
$.timepicker.regional[''].minuteText = window.Messages.strCalendarMinute;
8787
$.timepicker.regional[''].secondText = window.Messages.strCalendarSecond;
88+
$.timepicker.regional[''].millisecText = window.Messages.strCalendarMillisecond;
89+
$.timepicker.regional[''].microsecText = window.Messages.strCalendarMicrosecond;
90+
$.timepicker.regional[''].timezoneText = window.Messages.strCalendarTimezone;
8891

8992
// eslint-disable-next-line no-underscore-dangle
9093
$.extend($.timepicker._defaults, $.timepicker.regional['']);

libraries/classes/Controllers/JavaScriptMessagesController.php

Lines changed: 60 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -714,118 +714,68 @@ private function setMessages(): array
714714
'strShow' => __('Show'),
715715
'strStructure' => __('Structure'),
716716

717-
/* DateTime Picker */
718-
// l10n: Month name
719-
'strMonthNameJan' => __('January'),
720-
// l10n: Month name
721-
'strMonthNameFeb' => __('February'),
722-
// l10n: Month name
723-
'strMonthNameMar' => __('March'),
724-
// l10n: Month name
725-
'strMonthNameApr' => __('April'),
726-
// l10n: Month name
727-
'strMonthNameMay' => __('May'),
728-
// l10n: Month name
729-
'strMonthNameJun' => __('June'),
730-
// l10n: Month name
731-
'strMonthNameJul' => __('July'),
732-
// l10n: Month name
733-
'strMonthNameAug' => __('August'),
734-
// l10n: Month name
735-
'strMonthNameSep' => __('September'),
736-
// l10n: Month name
737-
'strMonthNameOct' => __('October'),
738-
// l10n: Month name
739-
'strMonthNameNov' => __('November'),
740-
// l10n: Month name
741-
'strMonthNameDec' => __('December'),
742-
/* l10n: Short month name for January */
743-
'strMonthNameJanShort' => __('Jan'),
744-
/* l10n: Short month name for February */
745-
'strMonthNameFebShort' => __('Feb'),
746-
/* l10n: Short month name for March */
747-
'strMonthNameMarShort' => __('Mar'),
748-
/* l10n: Short month name for April */
749-
'strMonthNameAprShort' => __('Apr'),
750-
/* l10n: Short month name for May */
751-
'strMonthNameMayShort' => __('May'),
752-
/* l10n: Short month name for June */
753-
'strMonthNameJunShort' => __('Jun'),
754-
/* l10n: Short month name for July */
755-
'strMonthNameJulShort' => __('Jul'),
756-
/* l10n: Short month name for August */
757-
'strMonthNameAugShort' => __('Aug'),
758-
/* l10n: Short month name for September */
759-
'strMonthNameSepShort' => __('Sep'),
760-
/* l10n: Short month name for October */
761-
'strMonthNameOctShort' => __('Oct'),
762-
/* l10n: Short month name for November */
763-
'strMonthNameNovShort' => __('Nov'),
764-
/* l10n: Short month name for December */
765-
'strMonthNameDecShort' => __('Dec'),
766-
/* l10n: Week day name */
767-
'strDayNameSun' => __('Sunday'),
768-
/* l10n: Week day name */
769-
'strDayNameMon' => __('Monday'),
770-
/* l10n: Week day name */
771-
'strDayNameTue' => __('Tuesday'),
772-
/* l10n: Week day name */
773-
'strDayNameWed' => __('Wednesday'),
774-
/* l10n: Week day name */
775-
'strDayNameThu' => __('Thursday'),
776-
/* l10n: Week day name */
777-
'strDayNameFri' => __('Friday'),
778-
/* l10n: Week day name */
779-
'strDayNameSat' => __('Saturday'),
780-
/* l10n: Short week day name for Sunday */
781-
'strDayNameSunShort' => __('Sun'),
782-
/* l10n: Short week day name for Monday */
783-
'strDayNameMonShort' => __('Mon'),
784-
/* l10n: Short week day name for Tuesday */
785-
'strDayNameTueShort' => __('Tue'),
786-
/* l10n: Short week day name for Wednesday */
787-
'strDayNameWedShort' => __('Wed'),
788-
/* l10n: Short week day name for Thursday */
789-
'strDayNameThuShort' => __('Thu'),
790-
/* l10n: Short week day name for Friday */
791-
'strDayNameFriShort' => __('Fri'),
792-
/* l10n: Short week day name for Saturday */
793-
'strDayNameSatShort' => __('Sat'),
794-
/* l10n: Minimal week day name for Sunday */
795-
'strDayNameSunMin' => __('Su'),
796-
/* l10n: Minimal week day name for Monday */
797-
'strDayNameMonMin' => __('Mo'),
798-
/* l10n: Minimal week day name for Tuesday */
799-
'strDayNameTueMin' => __('Tu'),
800-
/* l10n: Minimal week day name for Wednesday */
801-
'strDayNameWedMin' => __('We'),
802-
/* l10n: Minimal week day name for Thursday */
803-
'strDayNameThuMin' => __('Th'),
804-
/* l10n: Minimal week day name for Friday */
805-
'strDayNameFriMin' => __('Fr'),
806-
/* l10n: Minimal week day name for Saturday */
807-
'strDayNameSatMin' => __('Sa'),
808-
/* l10n: Column header for week of the year in calendar */
809-
'strWeekHeader' => __('Wk'),
810-
// phpcs:ignore Generic.Files.LineLength.TooLong
811-
/* l10n: The month-year order in a calendar. Do not translate! Use either "calendar-month-year" or "calendar-year-month". */
812-
'strMonthAfterYear' => __('calendar-month-year'),
813-
/* l10n: Year suffix for calendar, "none" is empty. */
814-
'strYearSuffix' => __('none'),
815-
/* l10n: A specific point in the day, as shown on a clock. */
816-
'strCalendarTime' => __('Time'),
817-
/* l10n: Period of time. */
818-
'strCalendarHour' => __('Hour'),
819-
/* l10n: Period of time. */
820-
'strCalendarMinute' => __('Minute'),
821-
/* l10n: Period of time. */
822-
'strCalendarSecond' => __('Second'),
717+
'strMonthNameJan' => _pgettext('Month name', 'January'),
718+
'strMonthNameFeb' => _pgettext('Month name', 'February'),
719+
'strMonthNameMar' => _pgettext('Month name', 'March'),
720+
'strMonthNameApr' => _pgettext('Month name', 'April'),
721+
'strMonthNameMay' => _pgettext('Month name', 'May'),
722+
'strMonthNameJun' => _pgettext('Month name', 'June'),
723+
'strMonthNameJul' => _pgettext('Month name', 'July'),
724+
'strMonthNameAug' => _pgettext('Month name', 'August'),
725+
'strMonthNameSep' => _pgettext('Month name', 'September'),
726+
'strMonthNameOct' => _pgettext('Month name', 'October'),
727+
'strMonthNameNov' => _pgettext('Month name', 'November'),
728+
'strMonthNameDec' => _pgettext('Month name', 'December'),
729+
'strMonthNameJanShort' => _pgettext('Short month name for January', 'Jan'),
730+
'strMonthNameFebShort' => _pgettext('Short month name for February', 'Feb'),
731+
'strMonthNameMarShort' => _pgettext('Short month name for March', 'Mar'),
732+
'strMonthNameAprShort' => _pgettext('Short month name for April', 'Apr'),
733+
'strMonthNameMayShort' => _pgettext('Short month name for May', 'May'),
734+
'strMonthNameJunShort' => _pgettext('Short month name for June', 'Jun'),
735+
'strMonthNameJulShort' => _pgettext('Short month name for July', 'Jul'),
736+
'strMonthNameAugShort' => _pgettext('Short month name for August', 'Aug'),
737+
'strMonthNameSepShort' => _pgettext('Short month name for September', 'Sep'),
738+
'strMonthNameOctShort' => _pgettext('Short month name for October', 'Oct'),
739+
'strMonthNameNovShort' => _pgettext('Short month name for November', 'Nov'),
740+
'strMonthNameDecShort' => _pgettext('Short month name for December', 'Dec'),
741+
'strDayNameSun' => _pgettext('Week day name', 'Sunday'),
742+
'strDayNameMon' => _pgettext('Week day name', 'Monday'),
743+
'strDayNameTue' => _pgettext('Week day name', 'Tuesday'),
744+
'strDayNameWed' => _pgettext('Week day name', 'Wednesday'),
745+
'strDayNameThu' => _pgettext('Week day name', 'Thursday'),
746+
'strDayNameFri' => _pgettext('Week day name', 'Friday'),
747+
'strDayNameSat' => _pgettext('Week day name', 'Saturday'),
748+
'strDayNameSunShort' => _pgettext('Short week day name for Sunday', 'Sun'),
749+
'strDayNameMonShort' => _pgettext('Short week day name for Monday', 'Mon'),
750+
'strDayNameTueShort' => _pgettext('Short week day name for Tuesday', 'Tue'),
751+
'strDayNameWedShort' => _pgettext('Short week day name for Wednesday', 'Wed'),
752+
'strDayNameThuShort' => _pgettext('Short week day name for Thursday', 'Thu'),
753+
'strDayNameFriShort' => _pgettext('Short week day name for Friday', 'Fri'),
754+
'strDayNameSatShort' => _pgettext('Short week day name for Saturday', 'Sat'),
755+
'strDayNameSunMin' => _pgettext('Minimal week day name for Sunday', 'Su'),
756+
'strDayNameMonMin' => _pgettext('Minimal week day name for Monday', 'Mo'),
757+
'strDayNameTueMin' => _pgettext('Minimal week day name for Tuesday', 'Tu'),
758+
'strDayNameWedMin' => _pgettext('Minimal week day name for Wednesday', 'We'),
759+
'strDayNameThuMin' => _pgettext('Minimal week day name for Thursday', 'Th'),
760+
'strDayNameFriMin' => _pgettext('Minimal week day name for Friday', 'Fr'),
761+
'strDayNameSatMin' => _pgettext('Minimal week day name for Saturday', 'Sa'),
762+
'strWeekHeader' => _pgettext('Column header for week of the year in calendar', 'Wk'),
763+
/* l10n: DO NOT TRANSLATE! Use either "calendar-month-year" or "calendar-year-month". */
764+
'strMonthAfterYear' => _pgettext('The month-year order in a calendar', 'calendar-month-year'),
765+
'strYearSuffix' => _pgettext('Year suffix for calendar, "none" is empty', 'none'),
766+
'strCalendarTime' => _pgettext('A specific point in the day, as shown on a clock', 'Time'),
767+
'strCalendarHour' => _pgettext('Unit of time', 'Hour'),
768+
'strCalendarMinute' => _pgettext('Unit of time', 'Minute'),
769+
'strCalendarSecond' => _pgettext('Unit of time', 'Second'),
770+
'strCalendarMillisecond' => _pgettext('Unit of time', 'Millisecond'),
771+
'strCalendarMicrosecond' => _pgettext('Unit of time', 'Microsecond'),
772+
'strCalendarTimezone' => _pgettext('The time zone for a time of day', 'Time zone'),
823773
/* l10n: Display text for calendar close link */
824774
'strCalendarClose' => __('Done'),
825-
/* l10n: Previous month. Display text for previous month link in calendar */
826-
'strCalendarPrevious' => __('Prev'),
827-
/* l10n: Next month. Display text for next month link in calendar */
828-
'strCalendarNext' => __('Next'),
775+
/* l10n: Display text for previous month link in calendar */
776+
'strCalendarPrevious' => _pgettext('Previous month', 'Prev'),
777+
/* l10n: Display text for next month link in calendar */
778+
'strCalendarNext' => _pgettext('Next month', 'Next'),
829779
/* l10n: Display text for current month link in calendar */
830780
'strCalendarCurrent' => __('Today'),
831781

libraries/classes/Util.php

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -618,46 +618,27 @@ public static function extractValueFromFormattedSize(string|int $formattedSize):
618618
public static function localisedDate($timestamp = -1, $format = ''): string
619619
{
620620
$month = [
621-
/* l10n: Short month name */
622-
__('Jan'),
623-
/* l10n: Short month name */
624-
__('Feb'),
625-
/* l10n: Short month name */
626-
__('Mar'),
627-
/* l10n: Short month name */
628-
__('Apr'),
629-
/* l10n: Short month name */
630-
_pgettext('Short month name', 'May'),
631-
/* l10n: Short month name */
632-
__('Jun'),
633-
/* l10n: Short month name */
634-
__('Jul'),
635-
/* l10n: Short month name */
636-
__('Aug'),
637-
/* l10n: Short month name */
638-
__('Sep'),
639-
/* l10n: Short month name */
640-
__('Oct'),
641-
/* l10n: Short month name */
642-
__('Nov'),
643-
/* l10n: Short month name */
644-
__('Dec'),
621+
_pgettext('Short month name for January', 'Jan'),
622+
_pgettext('Short month name for February', 'Feb'),
623+
_pgettext('Short month name for March', 'Mar'),
624+
_pgettext('Short month name for April', 'Apr'),
625+
_pgettext('Short month name for May', 'May'),
626+
_pgettext('Short month name for June', 'Jun'),
627+
_pgettext('Short month name for July', 'Jul'),
628+
_pgettext('Short month name for August', 'Aug'),
629+
_pgettext('Short month name for September', 'Sep'),
630+
_pgettext('Short month name for October', 'Oct'),
631+
_pgettext('Short month name for November', 'Nov'),
632+
_pgettext('Short month name for December', 'Dec'),
645633
];
646634
$dayOfWeek = [
647-
/* l10n: Short week day name for Sunday */
648635
_pgettext('Short week day name for Sunday', 'Sun'),
649-
/* l10n: Short week day name for Monday */
650-
__('Mon'),
651-
/* l10n: Short week day name for Tuesday */
652-
__('Tue'),
653-
/* l10n: Short week day name for Wednesday */
654-
__('Wed'),
655-
/* l10n: Short week day name for Thursday */
656-
__('Thu'),
657-
/* l10n: Short week day name for Friday */
658-
__('Fri'),
659-
/* l10n: Short week day name for Saturday */
660-
__('Sat'),
636+
_pgettext('Short week day name for Monday', 'Mon'),
637+
_pgettext('Short week day name for Tuesday', 'Tue'),
638+
_pgettext('Short week day name for Wednesday', 'Wed'),
639+
_pgettext('Short week day name for Thursday', 'Thu'),
640+
_pgettext('Short week day name for Friday', 'Fri'),
641+
_pgettext('Short week day name for Saturday', 'Sat'),
661642
];
662643

663644
if ($format == '') {

0 commit comments

Comments
 (0)