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

@ -112,7 +112,7 @@ var AutomountManager = class {
try {
drive.stop_finish(res);
} catch (e) {
log('Unable to stop the drive after drive-eject-button %s'.format(e.toString()));
log(`Unable to stop the drive after drive-eject-button ${e.toString()}`);
}
});
} else if (drive.can_eject()) {
@ -121,7 +121,7 @@ var AutomountManager = class {
try {
drive.eject_with_operation_finish(res);
} catch (e) {
log('Unable to eject the drive after drive-eject-button %s'.format(e.toString()));
log(`Unable to eject the drive after drive-eject-button ${e.toString()}`);
}
});
}
@ -208,7 +208,7 @@ var AutomountManager = class {
}
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED))
log('Unable to mount volume %s: %s'.format(volume.get_name(), e.toString()));
log(`Unable to mount volume ${volume.get_name()}: ${e.toString()}`);
this._closeOperation(volume);
}
}

View File

@ -66,7 +66,7 @@ function startAppForMount(app, mount) {
retval = app.launch(files,
global.create_app_launch_context(0, -1));
} catch (e) {
log('Unable to launch the application %s: %s'.format(app.get_name(), e.toString()));
log(`Unable to launch the application ${app.get_name()}: ${e}`);
}
return retval;
@ -105,7 +105,7 @@ var ContentTypeDiscoverer = class {
try {
contentTypes = mount.guess_content_type_finish(res);
} catch (e) {
log('Unable to guess content types on added mount %s: %s'.format(mount.get_name(), e.toString()));
log(`Unable to guess content types on added mount ${mount.get_name()}: ${e}`);
}
if (contentTypes.length) {

View File

@ -216,7 +216,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
case 'none': // static WEP
secrets.push({
label: _('Key'),
key: 'wep-key%s'.format(wirelessSecuritySetting.wep_tx_keyidx),
key: `wep-key${wirelessSecuritySetting.wep_tx_keyidx}`,
value: wirelessSecuritySetting.get_wep_key(wirelessSecuritySetting.wep_tx_keyidx) || '',
wep_key_type: wirelessSecuritySetting.wep_key_type,
validate: this._validateStaticWep,
@ -239,7 +239,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
this._get8021xSecrets(secrets);
break;
default:
log('Invalid wireless key management: %s'.format(wirelessSecuritySetting.key_mgmt));
log(`Invalid wireless key management: ${wirelessSecuritySetting.key_mgmt}`);
}
}
@ -312,7 +312,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
});
break;
default:
log('Invalid EAP/IEEE802.1x method: %s'.format(ieee8021xSetting.get_eap_method(0)));
log(`Invalid EAP/IEEE802.1x method: ${ieee8021xSetting.get_eap_method(0)}`);
}
}
@ -404,7 +404,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
this._getMobileSecrets(content.secrets, connectionType);
break;
default:
log('Invalid connection type: %s'.format(connectionType));
log(`Invalid connection type: ${connectionType}`);
}
return content;
@ -648,12 +648,12 @@ var VPNRequestHandler = class {
try {
vpnSetting.foreach_data_item((key, value) => {
this._stdin.write('DATA_KEY=%s\n'.format(key), null);
this._stdin.write('DATA_VAL=%s\n\n'.format(value || ''), null);
this._stdin.write(`DATA_KEY=${key}\n`, null);
this._stdin.write(`DATA_VAL=${value || ''}\n\n`, null);
});
vpnSetting.foreach_secret((key, value) => {
this._stdin.write('SECRET_KEY=%s\n'.format(key), null);
this._stdin.write('SECRET_VAL=%s\n\n'.format(value || ''), null);
this._stdin.write(`SECRET_KEY=${key}\n`, null);
this._stdin.write(`SECRET_VAL=${value || ''}\n\n`, null);
});
this._stdin.write('DONE\n\n', null);
} catch (e) {
@ -768,7 +768,7 @@ var NetworkAgent = class {
body = _("A password is required to connect to “%s”.").format(connectionSetting.get_id());
break;
default:
log('Invalid connection type: %s'.format(connectionType));
log(`Invalid connection type: ${connectionType}`);
this._native.respond(requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR);
return;
}
@ -855,7 +855,7 @@ var NetworkAgent = class {
const fileName = plugin.get_auth_dialog();
if (!GLib.file_test(fileName, GLib.FileTest.IS_EXECUTABLE)) {
log('VPN plugin at %s is not executable'.format(fileName));
log(`VPN plugin at ${fileName} is not executable`);
return null;
}

View File

@ -44,7 +44,7 @@ var AuthenticationDialog = GObject.registerClass({
let bodyContent = new Dialog.MessageDialogContent();
if (userNames.length > 1) {
log('polkitAuthenticationAgent: Received %d '.format(userNames.length) +
log(`polkitAuthenticationAgent: Received ${userNames.length} ` +
'identities that can be used for authentication. Only ' +
'considering one.');
}
@ -193,8 +193,8 @@ var AuthenticationDialog = GObject.registerClass({
// We could add retrying if this turns out to be a problem
log('polkitAuthenticationAgent: Failed to show modal dialog. ' +
'Dismissing authentication request for action-id %s '.format(this.actionId) +
'cookie %s'.format(this._cookie));
`Dismissing authentication request for action-id ${this.actionId} ` +
`cookie ${this._cookie}`);
this._emitDone(true);
}
}

View File

@ -114,7 +114,7 @@ var TelepathyComponent = class {
try {
this._client.register();
} catch (e) {
throw new Error('Could not register Telepathy client. Error: %s'.format(e.toString()));
throw new Error(`Could not register Telepathy client. Error: ${e}`);
}
if (!this._client.account_manager.is_prepared(Tp.AccountManager.get_feature_quark_core()))
@ -282,7 +282,7 @@ class TelepathyClient extends Tp.BaseClient {
await dispatchOp.claim_with_async(this);
this._handlingChannels(account, conn, [channel], false);
} catch (err) {
log('Failed to Claim channel: %s'.format(err.toString()));
log(`Failed to claim channel: ${err}`);
}
}
@ -702,7 +702,7 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({
if (message.messageType == Tp.ChannelTextMessageType.ACTION) {
let senderAlias = GLib.markup_escape_text(message.sender, -1);
messageBody = '<i>%s</i> %s'.format(senderAlias, messageBody);
messageBody = `<i>${senderAlias}</i> ${messageBody}`;
styles.push('chat-action');
}