calendar: Make month and month-year formats translatable

Don't try to figure out the month-year order from gtk+.
Provide the format for the translators.  This is easier
and more versatile.

https://bugzilla.gnome.org/show_bug.cgi?id=781329
This commit is contained in:
Rafal Luzynski 2017-04-14 22:30:12 +02:00
parent 5f6aace8aa
commit 9dbe10889b

View File

@ -7,7 +7,6 @@ const Gtk = imports.gi.Gtk;
const Lang = imports.lang; const Lang = imports.lang;
const St = imports.gi.St; const St = imports.gi.St;
const Signals = imports.signals; const Signals = imports.signals;
const Gettext_gtk30 = imports.gettext.domain('gtk30');
const Shell = imports.gi.Shell; const Shell = imports.gi.Shell;
const Main = imports.ui.main; const Main = imports.ui.main;
@ -22,8 +21,6 @@ var ELLIPSIS_CHAR = '\u2026';
var MESSAGE_ICON_SIZE = -1; // pick up from CSS var MESSAGE_ICON_SIZE = -1; // pick up from CSS
// alias to prevent xgettext from picking up strings translated in GTK+
const gtk30_ = Gettext_gtk30.gettext;
var NC_ = function(context, str) { return context + '\u0004' + str; }; var NC_ = function(context, str) { return context + '\u0004' + str; };
function sameYear(dateA, dateB) { function sameYear(dateA, dateB) {
@ -376,20 +373,18 @@ var Calendar = new Lang.Class({
this._settings.connect('changed::' + SHOW_WEEKDATE_KEY, Lang.bind(this, this._onSettingsChange)); this._settings.connect('changed::' + SHOW_WEEKDATE_KEY, Lang.bind(this, this._onSettingsChange));
this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY); this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY);
// Find the ordering for month/year in the calendar heading /**
this._headerFormatWithoutYear = '%B'; * Translators: The header displaying just the month name
switch (gtk30_('calendar:MY')) { * standalone, when this is a month of the current year.
case 'calendar:MY': */
this._headerFormat = '%B %Y'; this._headerFormatWithoutYear = _('%B');
break; /**
case 'calendar:YM': * Translators: The header displaying the month name and the year
this._headerFormat = '%Y %B'; * number, when this is a month of a different year. You can
break; * reorder the format specifiers or add other modifications
default: * according to the requirements of your language.
log('Translation of "calendar:MY" in GTK+ is not correct'); */
this._headerFormat = '%B %Y'; this._headerFormat = _('%B %Y');
break;
}
// Start off with the current date // Start off with the current date
this._selectedDate = new Date(); this._selectedDate = new Date();