Skip to content

Commit c5ca633

Browse files
grab message from originalMessage as well as localized (microsoft#154989)
grab message from originalMessage
1 parent ec72b66 commit c5ca633

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/vs/platform/extensionManagement/common/extensionsScannerService.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { revive } from 'vs/base/common/marshalling';
3535
import { IExtensionsProfileScannerService, IScannedProfileExtension } from 'vs/platform/extensionManagement/common/extensionsProfileScannerService';
3636
import { IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile';
3737
import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity';
38+
import { ILocalizedString } from 'vs/platform/action/common/action';
3839

3940
export type IScannedExtensionManifest = IRelaxedExtensionManifest & { __metadata?: Metadata };
4041

@@ -793,13 +794,23 @@ class ExtensionsScanner extends Disposable {
793794
if (translated === undefined && originalMessages) {
794795
translated = originalMessages[messageKey];
795796
}
796-
let message: string | undefined = typeof translated === 'string' ? translated : (typeof translated?.message === 'string' ? translated.message : undefined);
797+
let message: string | undefined = typeof translated === 'string' ? translated : translated.message;
797798
if (message !== undefined) {
798799
if (pseudo) {
799800
// FF3B and FF3D is the Unicode zenkaku representation for [ and ]
800801
message = '\uFF3B' + message.replace(/[aouei]/g, '$&$&') + '\uFF3D';
801802
}
802-
obj[key] = command && (key === 'title' || key === 'category') && originalMessages ? { value: message, original: originalMessages[messageKey] } : message;
803+
// This branch returns ILocalizedString's instead of Strings so that the Command Palette can contain both the localized and the original value.
804+
if (command && originalMessages && (key === 'title' || key === 'category')) {
805+
const originalMessage = originalMessages[messageKey];
806+
const localizedString: ILocalizedString = {
807+
value: message,
808+
original: typeof originalMessage === 'string' ? originalMessage : originalMessage?.message
809+
};
810+
obj[key] = localizedString;
811+
} else {
812+
obj[key] = message;
813+
}
803814
} else {
804815
this.logService.warn(this.formatMessage(extensionLocation, localize('missingNLSKey', "Couldn't find message for key {0}.", messageKey)));
805816
}

0 commit comments

Comments
 (0)