js: Use templates for non-translatable strings

This reverts commit 9d941f8202 and replaces all additional
instances of .format() that have been added since.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2160>
This commit is contained in:
Florian Müllner
2022-02-07 15:14:06 +01:00
committed by Marge Bot
parent 29dfde5a4a
commit a1dd1b25d8
51 changed files with 254 additions and 261 deletions

View File

@ -16,7 +16,7 @@ var SHOW_WEEKDATE_KEY = 'show-weekdate';
var MESSAGE_ICON_SIZE = -1; // pick up from CSS
var NC_ = (context, str) => '%s\u0004%s'.format(context, str);
var NC_ = (context, str) => `${context}\u0004${str}`;
function sameYear(dateA, dateB) {
return dateA.getYear() == dateB.getYear();
@ -104,26 +104,26 @@ var EventSourceBase = GObject.registerClass({
Signals: { 'changed': {} },
}, class EventSourceBase extends GObject.Object {
get isLoading() {
throw new GObject.NotImplementedError('isLoading in %s'.format(this.constructor.name));
throw new GObject.NotImplementedError(`isLoading in ${this.constructor.name}`);
}
get hasCalendars() {
throw new GObject.NotImplementedError('hasCalendars in %s'.format(this.constructor.name));
throw new GObject.NotImplementedError(`hasCalendars in ${this.constructor.name}`);
}
destroy() {
}
requestRange(_begin, _end) {
throw new GObject.NotImplementedError('requestRange in %s'.format(this.constructor.name));
throw new GObject.NotImplementedError(`requestRange in ${this.constructor.name}`);
}
getEvents(_begin, _end) {
throw new GObject.NotImplementedError('getEvents in %s'.format(this.constructor.name));
throw new GObject.NotImplementedError(`getEvents in ${this.constructor.name}`);
}
hasEvents(_day) {
throw new GObject.NotImplementedError('hasEvents in %s'.format(this.constructor.name));
throw new GObject.NotImplementedError(`hasEvents in ${this.constructor.name}`);
}
});
@ -222,7 +222,7 @@ class DBusEventSource extends EventSourceBase {
// about the HasCalendars property and would cause an exception trying
// to read it)
if (!e.matches(Gio.DBusError, Gio.DBusError.TIMED_OUT)) {
log('Error loading calendars: %s'.format(e.message));
log(`Error loading calendars: ${e.message}`);
return;
}
}
@ -390,7 +390,7 @@ var Calendar = GObject.registerClass({
this._weekStart = Shell.util_get_week_start();
this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.calendar' });
this._settings.connect('changed::%s'.format(SHOW_WEEKDATE_KEY), this._onSettingsChange.bind(this));
this._settings.connect(`changed::${SHOW_WEEKDATE_KEY}`, this._onSettingsChange.bind(this));
this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY);
/**
@ -664,13 +664,13 @@ var Calendar = GObject.registerClass({
// Hack used in lieu of border-collapse - see gnome-shell.css
if (row == 2)
styleClass = 'calendar-day-top %s'.format(styleClass);
styleClass = `calendar-day-top ${styleClass}`;
let leftMost = rtl
? iter.getDay() == (this._weekStart + 6) % 7
: iter.getDay() == this._weekStart;
if (leftMost)
styleClass = 'calendar-day-left %s'.format(styleClass);
styleClass = `calendar-day-left ${styleClass}`;
if (sameDay(now, iter))
styleClass += ' calendar-today';
@ -1029,7 +1029,7 @@ class CalendarMessageList extends St.Widget {
for (let prop of ['visible', 'empty', 'can-clear']) {
connectionsIds.push(
section.connect('notify::%s'.format(prop), this._sync.bind(this)));
section.connect(`notify::${prop}`, this._sync.bind(this)));
}
connectionsIds.push(section.connect('message-focused', (_s, messageActor) => {
Util.ensureActorVisibleInScrollView(this._scrollView, messageActor);