diff --git a/appservice/src/TunnelProxy.ts b/appservice/src/TunnelProxy.ts index 4e10dda7ba..489835d435 100644 --- a/appservice/src/TunnelProxy.ts +++ b/appservice/src/TunnelProxy.ts @@ -11,6 +11,7 @@ import * as requestP from 'request-promise'; import { IParsedError, parseError } from 'vscode-azureextensionui'; import * as websocket from 'websocket'; import { ext } from './extensionVariables'; +import { localize } from './localize'; import { SiteClient } from './SiteClient'; import { delay } from './utils/delay'; @@ -206,25 +207,25 @@ export class TunnelProxy { } catch (error) { const parsedError: IParsedError = parseError(error); ext.outputChannel.appendLine(`[Tunnel] Checking status, error: ${parsedError.message}`); - throw new Error(`Error getting tunnel status: ${parsedError.errorType}`); + throw new Error(localize('tunnelStatusError', 'Error getting tunnel status: {0}', parsedError.errorType)); } if (tunnelStatus.state === AppState.STARTED) { if ((tunnelStatus.port === 2222 && !this._isSsh) || (tunnelStatus.port !== 2222 && this._isSsh)) { // Tunnel is pointed to default SSH port and still needs time to restart - throw new RetryableTunnelStatusError('App is waiting for restart'); + throw new RetryableTunnelStatusError(); } else if (tunnelStatus.canReachPort) { return; } else { - throw new Error('App is started, but port is unreachable'); + throw new Error(localize('tunnelUnreachable', 'App is started, but port is unreachable')); } } else if (tunnelStatus.state === AppState.STARTING) { - throw new RetryableTunnelStatusError('App is starting'); + throw new RetryableTunnelStatusError(); } else if (tunnelStatus.state === AppState.STOPPED) { await this.startupApp(); - throw new RetryableTunnelStatusError('App is starting from STOPPED state'); + throw new RetryableTunnelStatusError(); } else { - throw new Error(`Unexpected app state: ${tunnelStatus.state}`); + throw new Error(localize('tunnelStatusError', 'Unexpected app state: {0}', tunnelStatus.state)); } } @@ -242,14 +243,14 @@ export class TunnelProxy { return; } catch (error) { if (!(error instanceof RetryableTunnelStatusError)) { - reject(new Error(`Unable to establish connection to application: ${parseError(error).message}`)); + reject(new Error(localize('tunnelFailed', 'Unable to establish connection to application: {0}', parseError(error).message))); return; } // else allow retry } await delay(pollingIntervalMs); } - reject(new Error('Unable to establish connection to application: Timed out')); + reject(new Error(localize('tunnelTimedOut', 'Unable to establish connection to application: Timed out'))); }); } diff --git a/appservice/src/remoteDebug/remoteDebugCommon.ts b/appservice/src/remoteDebug/remoteDebugCommon.ts index 5cbf1d75db..6f4dbc6b75 100644 --- a/appservice/src/remoteDebug/remoteDebugCommon.ts +++ b/appservice/src/remoteDebug/remoteDebugCommon.ts @@ -7,6 +7,7 @@ import { SiteConfigResource } from 'azure-arm-website/lib/models'; import * as vscode from 'vscode'; import { callWithTelemetryAndErrorHandling, DialogResponses, IActionContext } from 'vscode-azureextensionui'; import { ext } from '../extensionVariables'; +import { localize } from '../localize'; import { SiteClient } from '../SiteClient'; export function reportMessage(message: string, progress: vscode.Progress<{}>): void { @@ -17,7 +18,7 @@ export function reportMessage(message: string, progress: vscode.Progress<{}>): v export async function setRemoteDebug(isRemoteDebuggingToBeEnabled: boolean, confirmMessage: string, noopMessage: string | undefined, siteClient: SiteClient, siteConfig: SiteConfigResource, progress?: vscode.Progress<{}>, learnMoreLink?: string): Promise { const state: string | undefined = await siteClient.getState(); if (state && state.toLowerCase() === 'stopped') { - throw new Error('The app must be running, but is currently in state "Stopped". Start the app to continue.'); + throw new Error(localize('remoteDebugStopped', 'The app must be running, but is currently in state "Stopped". Start the app to continue.')); } if (isRemoteDebuggingToBeEnabled !== siteConfig.remoteDebuggingEnabled) { @@ -27,7 +28,7 @@ export async function setRemoteDebug(isRemoteDebuggingToBeEnabled: boolean, conf await ext.ui.showWarningMessage(confirmMessage, { modal: true, learnMoreLink }, confirmButton, DialogResponses.cancel); siteConfig.remoteDebuggingEnabled = isRemoteDebuggingToBeEnabled; if (progress) { - reportMessage('Updating site configuration to set remote debugging...', progress); + reportMessage(localize('remoteDebugUpdate', 'Updating site configuration to set remote debugging...'), progress); } await callWithTelemetryAndErrorHandling('appService.remoteDebugUpdateConfiguration', async (context: IActionContext) => { @@ -37,7 +38,7 @@ export async function setRemoteDebug(isRemoteDebuggingToBeEnabled: boolean, conf }); if (progress) { - reportMessage('Updating site configuration done.', progress); + reportMessage(localize('remoteDebugUpdateDone', 'Updating site configuration done.'), progress); } } else { // Update not needed diff --git a/appservice/src/remoteDebug/startRemoteDebug.ts b/appservice/src/remoteDebug/startRemoteDebug.ts index a2565c5264..fab64fe9e7 100644 --- a/appservice/src/remoteDebug/startRemoteDebug.ts +++ b/appservice/src/remoteDebug/startRemoteDebug.ts @@ -8,6 +8,7 @@ import * as portfinder from 'portfinder'; import * as vscode from 'vscode'; import { callWithTelemetryAndErrorHandling, IActionContext } from 'vscode-azureextensionui'; import { ext } from '../extensionVariables'; +import { localize } from '../localize'; import { SiteClient } from '../SiteClient'; import { TunnelProxy } from '../TunnelProxy'; import { reportMessage, setRemoteDebug } from './remoteDebugCommon'; @@ -18,7 +19,7 @@ let isRemoteDebugging: boolean = false; export async function startRemoteDebug(siteClient: SiteClient, siteConfig: SiteConfigResource): Promise { if (isRemoteDebugging) { - throw new Error('Azure Remote Debugging is currently starting or already started.'); + throw new Error(localize('remoteDebugAlreadyStarted', 'Azure Remote Debugging is currently starting or already started.')); } isRemoteDebugging = true; @@ -36,10 +37,10 @@ async function startRemoteDebugInternal(siteClient: SiteClient, siteConfig: Site // tslint:disable-next-line:no-unsafe-any const localHostPortNumber: number = debugConfig.port; - const confirmEnableMessage: string = 'The configuration will be updated to enable remote debugging. Would you like to continue? This will restart the app.'; + const confirmEnableMessage: string = localize('remoteDebugEnablePrompt', 'The configuration will be updated to enable remote debugging. Would you like to continue? This will restart the app.'); await setRemoteDebug(true, confirmEnableMessage, undefined, siteClient, siteConfig, progress, remoteDebugLink); - reportMessage('Starting tunnel proxy...', progress); + reportMessage(localize('remoteDebugStartingTunnel', 'Starting tunnel proxy...'), progress); const publishCredential: User = await siteClient.getWebAppPublishCredential(); const tunnelProxy: TunnelProxy = new TunnelProxy(localHostPortNumber, siteClient, publishCredential); @@ -49,7 +50,7 @@ async function startRemoteDebugInternal(siteClient: SiteClient, siteConfig: Site await tunnelProxy.startProxy(); }); - reportMessage('Attaching debugger...', progress); + reportMessage(localize('remoteDebugAttaching', 'Attaching debugger...'), progress); await callWithTelemetryAndErrorHandling('appService.remoteDebugAttach', async (attachContext: IActionContext) => { attachContext.errorHandling.suppressDisplay = true; @@ -57,7 +58,7 @@ async function startRemoteDebugInternal(siteClient: SiteClient, siteConfig: Site await vscode.debug.startDebugging(undefined, debugConfig); }); - reportMessage('Attached!', progress); + reportMessage(localize('remoteDebugAttached', 'Attached!'), progress); const terminateDebugListener: vscode.Disposable = vscode.debug.onDidTerminateDebugSession(async (event: vscode.DebugSession) => { if (event.name === debugConfig.name) { @@ -101,11 +102,11 @@ async function getDebugConfiguration(): Promise { // In this case we don't know which folder to use. Show a warning and proceed. // In the future we should allow users to choose a workspace folder to map sources from. // tslint:disable-next-line:no-floating-promises - ext.ui.showWarningMessage('Unable to bind breakpoints from workspace when multiple folders are open. Use "loaded scripts" instead.'); + ext.ui.showWarningMessage(localize('remoteDebugMultipleFolders', 'Unable to bind breakpoints from workspace when multiple folders are open. Use "loaded scripts" instead.'); } } else { // vscode will throw an error if you try to start debugging without any workspace folder open - throw new Error('Please open a workspace folder before attaching a debugger.'); + throw new Error(localize('remoteDebugNoFolders', 'Please open a workspace folder before attaching a debugger.')); } return config;