calendar: clean up l10n for time format and labels (close bug #641245)
Add translation context and comments in order to be more helpful to translators. Also mark a couple of strings as translatable.
This commit is contained in:
parent
3653f7c6c1
commit
f3e687eac8
@ -9,6 +9,7 @@ const Pango = imports.gi.Pango;
|
|||||||
const Gettext_gtk30 = imports.gettext.domain('gtk30');
|
const Gettext_gtk30 = imports.gettext.domain('gtk30');
|
||||||
const Gettext = imports.gettext.domain('gnome-shell');
|
const Gettext = imports.gettext.domain('gnome-shell');
|
||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
const C_ = Gettext.pgettext;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
|
|
||||||
@ -58,18 +59,22 @@ function _getEndOfDay(date) {
|
|||||||
function _formatEventTime(event, clockFormat) {
|
function _formatEventTime(event, clockFormat) {
|
||||||
let ret;
|
let ret;
|
||||||
if (event.allDay) {
|
if (event.allDay) {
|
||||||
/* Translators: Shown in calendar event list for all day events */
|
/* Translators: Shown in calendar event list for all day events
|
||||||
ret = _("All Day");
|
* Keep it short, best if you can use less then 10 characters
|
||||||
|
*/
|
||||||
|
ret = C_("event list time", "All Day");
|
||||||
} else {
|
} else {
|
||||||
switch (clockFormat) {
|
switch (clockFormat) {
|
||||||
case '24h':
|
case '24h':
|
||||||
ret = event.date.toLocaleFormat('%H:%M');
|
/* Translators: Shown in calendar event list, if 24h format */
|
||||||
|
ret = event.date.toLocaleFormat(C_("event list time", "%H:%M"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* explicit fall-through */
|
/* explicit fall-through */
|
||||||
case '12h':
|
case '12h':
|
||||||
ret = event.date.toLocaleFormat('%l:%M %p');
|
/* Transators: Shown in calendar event list, if 12h format */
|
||||||
|
ret = event.date.toLocaleFormat(C_("event list time", "%l:%M %p"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,22 +111,22 @@ function _getCalendarDayAbbreviation(dayNumber) {
|
|||||||
let abbreviations = [
|
let abbreviations = [
|
||||||
/* Translators: Calendar grid abbreviation for Sunday.
|
/* Translators: Calendar grid abbreviation for Sunday.
|
||||||
*
|
*
|
||||||
* NOTE: These abbreviations are always shown together and in
|
* NOTE: These grid abbreviations are always shown together
|
||||||
* order, e.g. "S M T W T F S".
|
* and in order, e.g. "S M T W T F S".
|
||||||
*/
|
*/
|
||||||
_("S"),
|
C_("grid sunday", "S"),
|
||||||
/* Translators: Calendar grid abbreviation for Monday */
|
/* Translators: Calendar grid abbreviation for Monday */
|
||||||
_("M"),
|
C_("grid monday", "M"),
|
||||||
/* Translators: Calendar grid abbreviation for Tuesday */
|
/* Translators: Calendar grid abbreviation for Tuesday */
|
||||||
_("T"),
|
C_("grid tuesday", "T"),
|
||||||
/* Translators: Calendar grid abbreviation for Wednesday */
|
/* Translators: Calendar grid abbreviation for Wednesday */
|
||||||
_("W"),
|
C_("grid wednesday", "W"),
|
||||||
/* Translators: Calendar grid abbreviation for Thursday */
|
/* Translators: Calendar grid abbreviation for Thursday */
|
||||||
_("T"),
|
C_("grid thursday", "T"),
|
||||||
/* Translators: Calendar grid abbreviation for Friday */
|
/* Translators: Calendar grid abbreviation for Friday */
|
||||||
_("F"),
|
C_("grid friday", "F"),
|
||||||
/* Translators: Calendar grid abbreviation for Saturday */
|
/* Translators: Calendar grid abbreviation for Saturday */
|
||||||
_("S")
|
C_("grid saturday", "S")
|
||||||
];
|
];
|
||||||
return abbreviations[dayNumber];
|
return abbreviations[dayNumber];
|
||||||
}
|
}
|
||||||
@ -130,23 +135,23 @@ function _getEventDayAbbreviation(dayNumber) {
|
|||||||
let abbreviations = [
|
let abbreviations = [
|
||||||
/* Translators: Event list abbreviation for Sunday.
|
/* Translators: Event list abbreviation for Sunday.
|
||||||
*
|
*
|
||||||
* NOTE: These abbreviations are normally not shown together
|
* NOTE: These list abbreviations are normally not shown together
|
||||||
* so they need to be unique (e.g. Tuesday and Thursday cannot
|
* so they need to be unique (e.g. Tuesday and Thursday cannot
|
||||||
* both be 'T').
|
* both be 'T').
|
||||||
*/
|
*/
|
||||||
_("Su"),
|
C_("list sunday", "Su"),
|
||||||
/* Translators: Event list abbreviation for Monday */
|
/* Translators: Event list abbreviation for Monday */
|
||||||
_("M"),
|
C_("list monday", "M"),
|
||||||
/* Translators: Event list abbreviation for Tuesday */
|
/* Translators: Event list abbreviation for Tuesday */
|
||||||
_("T"),
|
C_("list tuesday", "T"),
|
||||||
/* Translators: Event list abbreviation for Wednesday */
|
/* Translators: Event list abbreviation for Wednesday */
|
||||||
_("W"),
|
C_("list wednesday", "W"),
|
||||||
/* Translators: Event list abbreviation for Thursday */
|
/* Translators: Event list abbreviation for Thursday */
|
||||||
_("Th"),
|
C_("list thursday", "Th"),
|
||||||
/* Translators: Event list abbreviation for Friday */
|
/* Translators: Event list abbreviation for Friday */
|
||||||
_("F"),
|
C_("list friday", "F"),
|
||||||
/* Translators: Event list abbreviation for Saturday */
|
/* Translators: Event list abbreviation for Saturday */
|
||||||
_("S")
|
C_("list saturday", "S")
|
||||||
];
|
];
|
||||||
return abbreviations[dayNumber];
|
return abbreviations[dayNumber];
|
||||||
}
|
}
|
||||||
@ -708,9 +713,11 @@ EventsList.prototype = {
|
|||||||
let dayString;
|
let dayString;
|
||||||
let now = new Date();
|
let now = new Date();
|
||||||
if (_sameYear(day, now))
|
if (_sameYear(day, now))
|
||||||
dayString = day.toLocaleFormat('%A, %B %d');
|
/* Translators: Shown on calendar heading when selected day occurs on current year */
|
||||||
|
dayString = day.toLocaleFormat(C_("calendar heading", "%A, %B %d"));
|
||||||
else
|
else
|
||||||
dayString = day.toLocaleFormat('%A, %B %d, %Y');
|
/* Translators: Shown on calendar heading when selected day occurs on different year */
|
||||||
|
dayString = day.toLocaleFormat(C_("calendar heading", "%A, %B %d, %Y"));
|
||||||
this._addPeriod(dayString, dayBegin, dayEnd, false, true);
|
this._addPeriod(dayString, dayBegin, dayEnd, false, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user