From ff7ac839437209afdca0e3a9fbd003624c6d19f5 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Tue, 8 Jun 2021 16:44:57 -0700 Subject: [PATCH] fix localization strings with workspace trust/virtual workspaces ref #125786 --- .../contrib/remote/browser/remoteIndicator.ts | 6 +++++- .../browser/workspace.contribution.ts | 21 ++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts b/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts index cd9414e6fa577..a5978ef66222d 100644 --- a/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts +++ b/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts @@ -301,7 +301,11 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr const workspaceLabel = this.getWorkspaceLabel(); if (workspaceLabel) { const toolTip: IMarkdownString = { - value: nls.localize('workspace.tooltip', "Virtual workspace on {0}\n\n[Some features](command:{1}) are not available for resources located on a virtual file system.", workspaceLabel, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID), + value: nls.localize( + 'workspace.tooltip2', + "Virtual workspace on {0}\n\n{1} are not available for resources located on a virtual file system.", + workspaceLabel, + `[${nls.localize('workspace.tooltip2.someFeatures', "Some features")}](command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID})`), isTrusted: true }; this.renderRemoteStatusIndicator(`$(remote) ${truncate(workspaceLabel, RemoteStatusIndicator.REMOTE_STATUS_LABEL_MAX_LENGTH)}`, toolTip); diff --git a/src/vs/workbench/contrib/workspace/browser/workspace.contribution.ts b/src/vs/workbench/contrib/workspace/browser/workspace.contribution.ts index ed873c7a9f791..58599d24c8c18 100644 --- a/src/vs/workbench/contrib/workspace/browser/workspace.contribution.ts +++ b/src/vs/workbench/contrib/workspace/browser/workspace.contribution.ts @@ -51,6 +51,9 @@ const BANNER_RESTRICTED_MODE = 'workbench.banner.restrictedMode'; const STARTUP_PROMPT_SHOWN_KEY = 'workspace.trust.startupPrompt.shown'; const BANNER_RESTRICTED_MODE_DISMISSED_KEY = 'workbench.banner.restrictedMode.dismissed'; +const Button = (title: string, href: string) => `[${title}](${href})`; +const featuresAreDisabledTranslated = localize('status.tooltipUntrustedWindow2.featuresAreDisabled', "features are disabled"); + /* * Trust Request via Service UX handler */ @@ -374,7 +377,11 @@ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchCon ariaLabel = trusted ? localize('status.ariaTrustedWindow', "This window is trusted.") : localize('status.ariaUntrustedWindow', "Restricted Mode: Some features are disabled because this window is not trusted."); toolTip = trusted ? ariaLabel : { - value: localize('status.tooltipUntrustedWindow', "Running in Restricted Mode\n\n\Some [features are disabled](command:{0}) because this [window is not trusted](command:{1}).", LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID, MANAGE_TRUST_COMMAND_ID), + value: localize( + 'status.tooltipUntrustedWindow2', + "Running in Restricted Mode\n\n\Some {0} because this {1}.", + Button(featuresAreDisabledTranslated, `command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`), + Button(localize('status.tooltipUntrustedWindow2.WindowIsNotTrusted', "window is not trusted"), `command:${MANAGE_TRUST_COMMAND_ID}`)), isTrusted: true, supportThemeIcons: true }; @@ -384,7 +391,11 @@ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchCon ariaLabel = trusted ? localize('status.ariaTrustedFolder', "This folder is trusted.") : localize('status.ariaUntrustedFolder', "Restricted Mode: Some features are disabled because this folder is not trusted."); toolTip = trusted ? ariaLabel : { - value: localize('status.tooltipUntrustedFolder', "Running in Restricted Mode\n\n\Some [features are disabled](command:{0}) because this [folder is not trusted](command:{1}).", LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID, MANAGE_TRUST_COMMAND_ID), + value: localize( + 'status.tooltipUntrustedFolder2', + "Running in Restricted Mode\n\n\Some {0} because this {1}.", + Button(featuresAreDisabledTranslated, `command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`), + Button(localize('status.tooltipUntrustedFolder2.FolderNotTrusted', "folder is not trusted"), `command:${MANAGE_TRUST_COMMAND_ID}`)), isTrusted: true, supportThemeIcons: true }; @@ -394,7 +405,11 @@ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchCon ariaLabel = trusted ? localize('status.ariaTrustedWorkspace', "This workspace is trusted.") : localize('status.ariaUntrustedWorkspace', "Restricted Mode: Some features are disabled because this workspace is not trusted."); toolTip = trusted ? ariaLabel : { - value: localize('status.tooltipUntrustedWorkspace', "Running in Restricted Mode\n\n\Some [features are disabled](command:{0}) because this [workspace is not trusted](command:{1}).", LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID, MANAGE_TRUST_COMMAND_ID), + value: localize( + 'status.tooltipUntrustedWorkspace2', + "Running in Restricted Mode\n\n\Some {0} because this {1}.", + Button(featuresAreDisabledTranslated, `command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`), + Button(localize('status.tooltipUntrustedWorkspace2.workspaceNotTrusted', "workspace is not trusted"), `command:${MANAGE_TRUST_COMMAND_ID}`)), isTrusted: true, supportThemeIcons: true };