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

@ -150,7 +150,7 @@ var MprisPlayer = class MprisPlayer {
// so prefer activating the app via .desktop file if possible
let app = null;
if (this._mprisProxy.DesktopEntry) {
let desktopId = '%s.desktop'.format(this._mprisProxy.DesktopEntry);
let desktopId = `${this._mprisProxy.DesktopEntry}.desktop`;
app = Shell.AppSystem.get_default().lookup_app(desktopId);
}
@ -200,9 +200,9 @@ var MprisPlayer = class MprisPlayer {
if (!Array.isArray(this._trackArtists) ||
!this._trackArtists.every(artist => typeof artist === 'string')) {
if (typeof this._trackArtists !== 'undefined') {
log(('Received faulty track artist metadata from %s; ' +
'expected an array of strings, got %s (%s)').format(
this._busName, this._trackArtists, typeof this._trackArtists));
log(`Received faulty track artist metadata from ${
this._busName}; expected an array of strings, got ${
this._trackArtists} (${typeof this._trackArtists})`);
}
this._trackArtists = [_("Unknown artist")];
}
@ -210,9 +210,9 @@ var MprisPlayer = class MprisPlayer {
this._trackTitle = metadata['xesam:title'];
if (typeof this._trackTitle !== 'string') {
if (typeof this._trackTitle !== 'undefined') {
log(('Received faulty track title metadata from %s; ' +
'expected a string, got %s (%s)').format(
this._busName, this._trackTitle, typeof this._trackTitle));
log(`Received faulty track title metadata from ${
this._busName}; expected a string, got ${
this._trackTitle} (${typeof this._trackTitle})`);
}
this._trackTitle = _("Unknown title");
}
@ -220,9 +220,9 @@ var MprisPlayer = class MprisPlayer {
this._trackCoverUrl = metadata['mpris:artUrl'];
if (typeof this._trackCoverUrl !== 'string') {
if (typeof this._trackCoverUrl !== 'undefined') {
log(('Received faulty track cover art metadata from %s; ' +
'expected a string, got %s (%s)').format(
this._busName, this._trackCoverUrl, typeof this._trackCoverUrl));
log(`Received faulty track cover art metadata from ${
this._busName}; expected a string, got ${
this._trackCoverUrl} (${typeof this._trackCoverUrl})`);
}
this._trackCoverUrl = '';
}