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:
Florian Müllner
2014-10-16 14:38:13 +02:00
parent 2f5a226bc2
commit eb3fc7815e
6 changed files with 51 additions and 16 deletions

View File

@ -129,7 +129,7 @@ const DateMenuButton = new Lang.Class({
/* Translators: This is the date format to use when the calendar popup is
* shown - it is shown just below the time in the shell (e.g. "Tue 9:29 AM").
*/
let dateFormat = _("%A %B %e, %Y");
let dateFormat = Shell.util_translate_time_string ("%A %B %e, %Y");
this._date.set_label(now.toLocaleFormat(dateFormat));
}
}));