Use LC_TIME locale for strftime format string translations
We commonly mark strftime format strings for translation to account for date/time representations without an existing strftime shortcut ("Yesterday %H%p"). As those translations are looked up according to the locale defined by LC_MESSAGES, while the conversion characters themselves are resolved according to LC_TIME, the result can be rather odd when mixing locales ("Den 27. January"). The correct solution would be to install translations for format strings in the LC_TIME catalogue and look them up with dcgettext(), but we don't have the infrastructure to do that easily. Work around this by adding a helper method that looks up a string in LC_MESSAGES using the locale defined by LC_TIME and use that to translate format strings, which has the same result. https://bugzilla.gnome.org/show_bug.cgi?id=738640
This commit is contained in:
@ -16,6 +16,7 @@ const SHOW_WEEKDATE_KEY = 'show-weekdate';
|
||||
|
||||
// alias to prevent xgettext from picking up strings translated in GTK+
|
||||
const gtk30_ = Gettext_gtk30.gettext;
|
||||
const NC_ = function(context, str) { return str; };
|
||||
|
||||
// in org.gnome.desktop.interface
|
||||
const CLOCK_FORMAT_KEY = 'clock-format';
|
||||
@ -792,14 +793,17 @@ const EventsList = new Lang.Class({
|
||||
let dayBegin = _getBeginningOfDay(day);
|
||||
let dayEnd = _getEndOfDay(day);
|
||||
|
||||
let dayString;
|
||||
let dayFormat;
|
||||
let now = new Date();
|
||||
if (_sameYear(day, now))
|
||||
/* Translators: Shown on calendar heading when selected day occurs on current year */
|
||||
dayString = day.toLocaleFormat(C_("calendar heading", "%A, %B %d"));
|
||||
dayFormat = Shell.util_translate_time_string(NC_("calendar heading",
|
||||
"%A, %B %d"));
|
||||
else
|
||||
/* Translators: Shown on calendar heading when selected day occurs on different year */
|
||||
dayString = day.toLocaleFormat(C_("calendar heading", "%A, %B %d, %Y"));
|
||||
dayFormat = Shell.util_translate_time_string(NC_("calendar heading",
|
||||
"%A, %B %d, %Y"));
|
||||
let dayString = day.toLocaleFormat(dayFormat);
|
||||
this._addPeriod(dayString, 0, dayBegin, dayEnd, false, true);
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user