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

@ -64,7 +64,7 @@ var InputSource = class {
return this.id;
if (engineDesc.variant && engineDesc.variant.length > 0)
return '%s+%s'.format(engineDesc.layout, engineDesc.variant);
return `${engineDesc.layout}+${engineDesc.variant}`;
else
return engineDesc.layout;
}
@ -138,7 +138,7 @@ class InputSourceSwitcher extends SwitcherPopup.SwitcherList {
var InputSourceSettings = class {
constructor() {
if (this.constructor === InputSourceSettings)
throw new TypeError('Cannot instantiate abstract class %s'.format(this.constructor.name));
throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
}
_emitInputSourcesChanged() {
@ -211,7 +211,7 @@ var InputSourceSystemSettings = class extends InputSourceSettings {
null, Gio.DBusCallFlags.NONE, -1, null);
[props] = result.deep_unpack();
} catch (e) {
log('Could not get properties from %s'.format(this._BUS_NAME));
log(`Could not get properties from ${this._BUS_NAME}`);
return;
}
@ -239,7 +239,7 @@ var InputSourceSystemSettings = class extends InputSourceSettings {
for (let i = 0; i < layouts.length && !!layouts[i]; i++) {
let id = layouts[i];
if (variants[i])
id += '+%s'.format(variants[i]);
id += `+${variants[i]}`;
sourcesList.push({ type: INPUT_SOURCE_TYPE_XKB, id });
}
return sourcesList;
@ -261,9 +261,9 @@ var InputSourceSessionSettings = class extends InputSourceSettings {
this._KEY_PER_WINDOW = 'per-window';
this._settings = new Gio.Settings({ schema_id: this._DESKTOP_INPUT_SOURCES_SCHEMA });
this._settings.connect('changed::%s'.format(this._KEY_INPUT_SOURCES), this._emitInputSourcesChanged.bind(this));
this._settings.connect('changed::%s'.format(this._KEY_KEYBOARD_OPTIONS), this._emitKeyboardOptionsChanged.bind(this));
this._settings.connect('changed::%s'.format(this._KEY_PER_WINDOW), this._emitPerWindowChanged.bind(this));
this._settings.connect(`changed::${this._KEY_INPUT_SOURCES}`, this._emitInputSourcesChanged.bind(this));
this._settings.connect(`changed::${this._KEY_KEYBOARD_OPTIONS}`, this._emitKeyboardOptionsChanged.bind(this));
this._settings.connect(`changed::${this._KEY_PER_WINDOW}`, this._emitPerWindowChanged.bind(this));
}
_getSourcesList(key) {
@ -564,7 +564,7 @@ var InputSourceManager = class {
if (textdomain != '')
longName = Gettext.dgettext(textdomain, longName);
exists = true;
displayName = '%s (%s)'.format(language, longName);
displayName = `${language} (${longName})`;
shortName = this._makeEngineShortName(engineDesc);
}
}
@ -1039,7 +1039,7 @@ class InputSourceIndicator extends PanelMenu.Button {
break;
default:
log('IBus property %s has invalid type %d'.format(prop.get_key(), type));
log(`IBus property ${prop.get_key()} has invalid type ${type}`);
continue;
}
@ -1078,7 +1078,7 @@ class InputSourceIndicator extends PanelMenu.Button {
let description = xkbLayout;
if (xkbVariant.length > 0)
description = '%s\t%s'.format(description, xkbVariant);
description = `${description}\t${xkbVariant}`;
Util.spawn(['gkbd-keyboard-display', '-l', description]);
}