Moves usages of vscode-nls to l10n API (#511)
* Moves usages of vscode-nls to l10n API Since we're trying to get off vscode-nls completely. * no more webpack loader * remove last nls references
This commit is contained in:
Родитель
714ad17af8
Коммит
8e70e72b52
|
@ -22,8 +22,7 @@ extends:
|
|||
template: azure-pipelines/extension/stable.yml@templates
|
||||
parameters:
|
||||
publishExtension: ${{ parameters.publishExtension }}
|
||||
locTsConfigs: $(Build.SourcesDirectory)/tsconfig.json
|
||||
locBundleDestination: '$(Build.SourcesDirectory)/out'
|
||||
l10nSourcePaths: ./src
|
||||
buildSteps:
|
||||
- script: yarn install --frozen-lockfile
|
||||
displayName: Install dependencies
|
||||
|
|
|
@ -22,8 +22,7 @@ resources:
|
|||
extends:
|
||||
template: azure-pipelines/extension/pre-release.yml@templates
|
||||
parameters:
|
||||
locTsConfigs: $(Build.SourcesDirectory)/tsconfig.json
|
||||
locBundleDestination: '$(Build.SourcesDirectory)/out'
|
||||
l10nSourcePaths: ./src
|
||||
buildSteps:
|
||||
- script: yarn install --frozen-lockfile
|
||||
displayName: Install dependencies
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
}
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.71.0"
|
||||
"vscode": "^1.74.0"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/microsoft/vscode-livepreview/issues"
|
||||
|
@ -40,6 +40,7 @@
|
|||
"onWebviewPanel:browserPreview",
|
||||
"onTaskType:Live Preview"
|
||||
],
|
||||
"l10n": "./l10n",
|
||||
"main": "./out/extension.js",
|
||||
"contributes": {
|
||||
"commands": [
|
||||
|
@ -307,7 +308,7 @@
|
|||
"@types/mocha": "^9.0.0",
|
||||
"@types/node": "^18.7.18",
|
||||
"@types/sinon": "7.0.11",
|
||||
"@types/vscode": "^1.71.0",
|
||||
"@types/vscode": "^1.74.0",
|
||||
"@types/ws": "^8.5.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.37.0",
|
||||
"@typescript-eslint/parser": "^5.37.0",
|
||||
|
@ -323,7 +324,6 @@
|
|||
"sinon": "9.0.0",
|
||||
"ts-loader": "^9.3.1",
|
||||
"typescript": "^4.8.3",
|
||||
"vscode-nls-dev": "^4.0.3",
|
||||
"webpack": "^5.76.0",
|
||||
"webpack-cli": "^4.10.0"
|
||||
},
|
||||
|
@ -334,7 +334,6 @@
|
|||
"open": "^8.4.0",
|
||||
"url": "^0.11.0",
|
||||
"vscode-extension-telemetry": "^0.4.5",
|
||||
"vscode-nls": "^5.2.0",
|
||||
"ws": "^8.8.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,11 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import { DEFAULT_HOST } from '../utils/constants';
|
||||
import { PathUtil } from '../utils/pathUtil';
|
||||
import { SETTINGS_SECTION_ID } from '../utils/settingsUtil';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
/**
|
||||
* @description the information that gets fired to emitter listeners on connection
|
||||
*/
|
||||
|
@ -133,8 +130,7 @@ export class Connection extends Disposable {
|
|||
public resetHostToDefault(): void {
|
||||
if (this.host != DEFAULT_HOST) {
|
||||
vscode.window.showErrorMessage(
|
||||
localize(
|
||||
'ipCannotConnect',
|
||||
vscode.l10n.t(
|
||||
'The IP address "{0}" cannot be used to host the server. Using default IP {1}.',
|
||||
this.host,
|
||||
DEFAULT_HOST
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
import { isIPv4 } from 'net';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { DEFAULT_HOST } from '../utils/constants';
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import { PathUtil } from '../utils/pathUtil';
|
||||
|
@ -15,7 +14,6 @@ import { Connection, ConnectionInfo } from './connection';
|
|||
/**
|
||||
* @description keeps track of all of the Connection objects and the info needed to create them (ie: initial ports).
|
||||
*/
|
||||
const localize = nls.loadMessageBundle();
|
||||
export class ConnectionManager extends Disposable {
|
||||
private _initHttpPort: number;
|
||||
private _initWSPort: number;
|
||||
|
@ -43,8 +41,7 @@ export class ConnectionManager extends Disposable {
|
|||
this._initHost = DEFAULT_HOST;
|
||||
} else if (vscode.env.remoteName && this._initHost != DEFAULT_HOST) {
|
||||
vscode.window.showErrorMessage(
|
||||
localize(
|
||||
'hostCannotConnect',
|
||||
vscode.l10n.t(
|
||||
'Cannot use the host "{0}" when using a remote connection. Using default {1}.',
|
||||
this._initHost,
|
||||
DEFAULT_HOST
|
||||
|
@ -155,8 +152,7 @@ export class ConnectionManager extends Disposable {
|
|||
|
||||
private _showIncorrectHostFormatError(host: string): void {
|
||||
vscode.window.showErrorMessage(
|
||||
localize(
|
||||
'ipAddressIncorrectFormat',
|
||||
vscode.l10n.t(
|
||||
'The local IP address "{0}" is not formatted correctly. Using default {1}.',
|
||||
host,
|
||||
DEFAULT_HOST
|
||||
|
|
|
@ -13,14 +13,11 @@ import { WebviewComm } from './webviewComm';
|
|||
import { FormatDateTime } from '../utils/utils';
|
||||
import { SettingUtil } from '../utils/settingsUtil';
|
||||
import * as path from 'path';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { URL } from 'url';
|
||||
import { Connection } from '../connectionInfo/connection';
|
||||
import { IOpenFileOptions } from '../manager';
|
||||
import { ExternalBrowserUtils } from '../utils/externalBrowserUtils';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
/**
|
||||
* @description the embedded preview object, containing the webview panel showing the preview.
|
||||
*/
|
||||
|
@ -240,8 +237,7 @@ export class BrowserPreview extends Disposable {
|
|||
private async _handleOpenBrowser(givenURL: string): Promise<void> {
|
||||
vscode.window
|
||||
.showInformationMessage(
|
||||
localize(
|
||||
'unsupportedLink',
|
||||
vscode.l10n.t(
|
||||
'Externally hosted links are not supported in the embedded preview. Do you want to open {0} in an external browser?',
|
||||
givenURL
|
||||
),
|
||||
|
|
|
@ -17,12 +17,9 @@ import { PathUtil } from '../utils/pathUtil';
|
|||
import { BrowserPreview } from './browserPreview';
|
||||
import { Connection } from '../connectionInfo/connection';
|
||||
import { EndpointManager } from '../infoManagers/endpointManager';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { IOpenFileOptions } from '../manager';
|
||||
import { ExternalBrowserUtils } from '../utils/externalBrowserUtils';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
/**
|
||||
* PreviewManager` is a singleton that handles the logic of opening the embedded preview.
|
||||
*/
|
||||
|
@ -152,10 +149,7 @@ export class PreviewManager extends Disposable {
|
|||
) {
|
||||
vscode.window
|
||||
.showWarningMessage(
|
||||
localize(
|
||||
'notPartOfWorkspace',
|
||||
'Previewing a file that is not a child of the server root. To see fully correct relative file links, please open a workspace at the project root or consider changing your server root settings for Live Preview.'
|
||||
),
|
||||
vscode.l10n.t('Previewing a file that is not a child of the server root. To see fully correct relative file links, please open a workspace at the project root or consider changing your server root settings for Live Preview.'),
|
||||
DONT_SHOW_AGAIN
|
||||
)
|
||||
.then(async (selection: vscode.MessageItem | undefined) => {
|
||||
|
|
|
@ -5,17 +5,13 @@
|
|||
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { ConnectionManager } from '../connectionInfo/connectionManager';
|
||||
import { INIT_PANEL_TITLE } from '../utils/constants';
|
||||
import { NavEditCommands, PageHistory } from './pageHistoryTracker';
|
||||
import { isFileInjectable } from '../utils/utils';
|
||||
import { PathUtil } from '../utils/pathUtil';
|
||||
import { Connection } from '../connectionInfo/connection';
|
||||
import { randomBytes } from 'crypto';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
/**
|
||||
* @description the object responsible for communicating messages to the webview.
|
||||
*/
|
||||
|
@ -202,16 +198,16 @@ export class WebviewComm extends Disposable {
|
|||
// Use a nonce to only allow specific scripts to be run
|
||||
const nonce = randomBytes(16).toString('base64');
|
||||
|
||||
const back = localize('back', 'Back');
|
||||
const forward = localize('forward', 'Forward');
|
||||
const reload = localize('reload', 'Reload');
|
||||
const more = localize('more', 'More Browser Actions');
|
||||
const find_prev = localize('findPrev', 'Previous');
|
||||
const find_next = localize('findNext', 'Next');
|
||||
const find_x = localize('findX', 'Close');
|
||||
const browser_open = localize('browser_open', 'Open in Browser');
|
||||
const find = localize('find', 'Find in Page');
|
||||
const devtools_open = localize('devtoolsOpen', 'Open Devtools Pane');
|
||||
const back = vscode.l10n.t('Back');
|
||||
const forward = vscode.l10n.t('Forward');
|
||||
const reload = vscode.l10n.t('Reload');
|
||||
const more = vscode.l10n.t('More Browser Actions');
|
||||
const find_prev = vscode.l10n.t('Previous');
|
||||
const find_next = vscode.l10n.t('Next');
|
||||
const find_x = vscode.l10n.t('Close');
|
||||
const browser_open = vscode.l10n.t('Open in Browser');
|
||||
const find = vscode.l10n.t('Find in Page');
|
||||
const devtools_open = vscode.l10n.t('Open Devtools Pane');
|
||||
|
||||
return `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import './setupNls';
|
||||
import * as vscode from 'vscode';
|
||||
import TelemetryReporter from 'vscode-extension-telemetry';
|
||||
import { EXTENSION_ID } from './utils/constants';
|
||||
|
|
|
@ -10,7 +10,6 @@ import TelemetryReporter from 'vscode-extension-telemetry';
|
|||
import { ConnectionManager } from './connectionInfo/connectionManager';
|
||||
import { BrowserPreview } from './editorPreview/browserPreview';
|
||||
import { PreviewType, SettingUtil } from './utils/settingsUtil';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { ServerStartedStatus, ServerTaskProvider } from './task/serverTaskProvider';
|
||||
import { EndpointManager } from './infoManagers/endpointManager';
|
||||
import { PreviewManager } from './editorPreview/previewManager';
|
||||
|
@ -20,8 +19,6 @@ import { ServerGrouping } from './server/serverGrouping';
|
|||
import { UpdateListener } from './updateListener';
|
||||
import { URL } from 'url';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export interface IOpenFileOptions {
|
||||
workspace?: vscode.WorkspaceFolder;
|
||||
port?: number;
|
||||
|
@ -343,9 +340,7 @@ export class Manager extends Disposable {
|
|||
const file = vscode.Uri.file(filePath);
|
||||
return this.openPreviewAtFileUri(file, undefined, previewType);
|
||||
} else {
|
||||
vscode.window.showWarningMessage(
|
||||
localize('fileDNE', "The file '{0}' does not exist relative your filesystem root.", filePath)
|
||||
);
|
||||
vscode.window.showWarningMessage(vscode.l10n.t("The file '{0}' does not exist relative your filesystem root.", filePath));
|
||||
return this._openPreviewWithNoTarget();
|
||||
}
|
||||
}
|
||||
|
@ -441,10 +436,7 @@ export class Manager extends Disposable {
|
|||
disposables.push(quickPick);
|
||||
|
||||
quickPick.matchOnDescription = true;
|
||||
quickPick.placeholder = localize(
|
||||
'selectPort',
|
||||
'Select the port that corresponds to the server that you want to stop'
|
||||
);
|
||||
quickPick.placeholder = vscode.l10n.t('Select the port that corresponds to the server that you want to stop');
|
||||
quickPick.items = await this._getServerPicks();
|
||||
|
||||
disposables.push(
|
||||
|
@ -501,9 +493,7 @@ export class Manager extends Disposable {
|
|||
const file = connection.getAppendedURI(link.path);
|
||||
this._openPreview(internal, serverGrouping, file, debug);
|
||||
} catch (e) {
|
||||
vscode.window.showErrorMessage(
|
||||
localize('badURL', 'Tried to open preview on invalid URI')
|
||||
);
|
||||
vscode.window.showErrorMessage(vscode.l10n.t('badURL', 'Tried to open preview on invalid URI'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -733,7 +723,7 @@ export class Manager extends Disposable {
|
|||
|
||||
if (picks.length > 0) {
|
||||
serverPicks.push({
|
||||
label: localize('allServers', 'All Servers'),
|
||||
label: vscode.l10n.t('All Servers'),
|
||||
accept: (): void => this.closeAllServers(),
|
||||
});
|
||||
}
|
||||
|
@ -754,7 +744,7 @@ export class Manager extends Disposable {
|
|||
label: `$(radio-tower) ${connection.httpPort}`,
|
||||
description:
|
||||
grouping.workspace?.name ??
|
||||
localize('nonWorkspaceFiles', 'non-workspace files'),
|
||||
vscode.l10n.t('non-workspace files'),
|
||||
accept: (): void => {
|
||||
grouping.dispose();
|
||||
},
|
||||
|
|
|
@ -8,7 +8,6 @@ import * as http from 'http';
|
|||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as Stream from 'stream';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import { ContentLoader } from './serverUtils/contentLoader';
|
||||
import { INJECTED_ENDPOINT_NAME } from '../utils/constants';
|
||||
|
@ -19,8 +18,6 @@ import { Connection } from '../connectionInfo/connection';
|
|||
import { IServerMsg } from './serverGrouping';
|
||||
import { SETTINGS_SECTION_ID, SettingUtil } from '../utils/settingsUtil';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class HttpServer extends Disposable {
|
||||
private _server?: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
||||
private _contentLoader: ContentLoader;
|
||||
|
@ -146,10 +143,7 @@ export class HttpServer extends Disposable {
|
|||
}
|
||||
} catch (e) {
|
||||
this._unsetDefaultHeaders(); // unset the headers so we don't keep trying to write them
|
||||
vscode.window.showErrorMessage(localize(
|
||||
'httpHeadersError',
|
||||
'Error writing HTTP headers. Please double-check your Live Preview settings.',
|
||||
));
|
||||
vscode.window.showErrorMessage(vscode.l10n.t('Error writing HTTP headers. Please double-check your Live Preview settings.'));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
import * as vscode from 'vscode';
|
||||
import * as net from 'net';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import { WSServer } from './wsServer';
|
||||
import { HttpServer } from './httpServer';
|
||||
|
@ -54,7 +53,6 @@ interface IEmbeddedPreviewArgs {
|
|||
connection: Connection;
|
||||
}
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
export class ServerGrouping extends Disposable {
|
||||
private _pendingLaunchInfo: ILaunchInfo | undefined;
|
||||
private readonly _httpServer: HttpServer;
|
||||
|
@ -314,8 +312,7 @@ export class ServerGrouping extends Disposable {
|
|||
this._isServerOn = true;
|
||||
|
||||
this._showServerStatusMessage(
|
||||
localize(
|
||||
'serverStartedOnPort',
|
||||
vscode.l10n.t(
|
||||
'Server Started on Port {0}',
|
||||
this._connection.httpPort
|
||||
)
|
||||
|
|
|
@ -8,7 +8,6 @@ import * as fs from 'fs';
|
|||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import * as mime from 'mime';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Disposable } from '../../utils/dispose';
|
||||
import {
|
||||
FormatFileSize,
|
||||
|
@ -22,8 +21,6 @@ import { PathUtil } from '../../utils/pathUtil';
|
|||
import { INJECTED_ENDPOINT_NAME } from '../../utils/constants';
|
||||
import { Connection } from '../../connectionInfo/connection';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
/**
|
||||
* @description the response information to give back to the server object
|
||||
*/
|
||||
|
@ -112,10 +109,9 @@ export class ContentLoader extends Disposable {
|
|||
"server.pageDoesNotExist" : {}
|
||||
*/
|
||||
this._reporter.sendTelemetryEvent('server.pageDoesNotExist');
|
||||
const fileNotFound = localize('fileNotFound', 'File not found');
|
||||
const fileNotFound = vscode.l10n.t('File not found');
|
||||
const relativePathFormatted = `<b>"${relativePath}"</b>`;
|
||||
const fileNotFoundMsg = localize(
|
||||
'fileNotFoundMsg',
|
||||
const fileNotFoundMsg = vscode.l10n.t(
|
||||
'The file {0} cannot be found. It may have been moved, edited, or deleted.',
|
||||
relativePathFormatted
|
||||
);
|
||||
|
@ -144,11 +140,8 @@ export class ContentLoader extends Disposable {
|
|||
* @returns {IRespInfo} the response info
|
||||
*/
|
||||
public createNoRootServer(): IRespInfo {
|
||||
const noServerRoot = localize('noServerRoot', 'No Server Root');
|
||||
const noWorkspaceOpen = localize(
|
||||
'noWorkspaceOpen',
|
||||
'This server is not based inside of a workspace, so the index does not direct to anything.'
|
||||
);
|
||||
const noServerRoot = vscode.l10n.t('No Server Root');
|
||||
const noWorkspaceOpen = vscode.l10n.t('This server is not based inside of a workspace, so the index does not direct to anything.');
|
||||
const customMsg = `<p>${noWorkspaceOpen}</p>`;
|
||||
const htmlString = `
|
||||
<!DOCTYPE html>
|
||||
|
@ -245,14 +238,10 @@ export class ContentLoader extends Disposable {
|
|||
</tr>\n`)
|
||||
);
|
||||
|
||||
const indexOfTitlePath = localize(
|
||||
'indexOfTitlePath',
|
||||
'Index of {0}',
|
||||
titlePath
|
||||
);
|
||||
const name = localize('name', 'Name');
|
||||
const size = localize('size', 'Size');
|
||||
const dateModified = localize('dateModified', 'Date Modified');
|
||||
const indexOfTitlePath = vscode.l10n.t('Index of {0}', titlePath);
|
||||
const name = vscode.l10n.t('Name');
|
||||
const size = vscode.l10n.t('Size');
|
||||
const dateModified = vscode.l10n.t('Date Modified');
|
||||
const htmlString = `
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Disposable } from '../../utils/dispose';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
/**
|
||||
* @description the status bar handler.
|
||||
* The flow is inspired by status bar in original Live Server extension:
|
||||
|
@ -24,7 +21,7 @@ export class StatusBarNotifier extends Disposable {
|
|||
this._statusBar = this._register(
|
||||
vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100)
|
||||
);
|
||||
this._statusBar.name = localize('livePreviewPorts', 'Live Preview Ports');
|
||||
this._statusBar.name = vscode.l10n.t('Live Preview Ports');
|
||||
this.serverOff();
|
||||
this._on = false;
|
||||
this._ports = new Map<string, number>();
|
||||
|
@ -46,16 +43,12 @@ export class StatusBarNotifier extends Disposable {
|
|||
|
||||
if (this._ports.size === 1) {
|
||||
const port = this._ports.values().next().value;
|
||||
portsLabel = localize('port', 'Port: {0}', port);
|
||||
portsLabel = vscode.l10n.t('Port: {0}', port);
|
||||
} else {
|
||||
if (this._ports.size === 2) {
|
||||
portsLabel = localize(
|
||||
'port',
|
||||
'Ports: {0}',
|
||||
Array.from(this._ports.values()).join(', ')
|
||||
);
|
||||
portsLabel = vscode.l10n.t('Ports: {0}', Array.from(this._ports.values()).join(', '));
|
||||
} else {
|
||||
portsLabel = localize('port', '{0} Ports', this._ports.size);
|
||||
portsLabel = vscode.l10n.t('{0} Ports', this._ports.size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +63,7 @@ export class StatusBarNotifier extends Disposable {
|
|||
`\n\t• ${port} (${
|
||||
workspace
|
||||
? workspace.name
|
||||
: localize('nonWorkspaceFiles', 'non-workspace files')
|
||||
: vscode.l10n.t('non-workspace files')
|
||||
})`
|
||||
);
|
||||
} catch {
|
||||
|
@ -80,18 +73,15 @@ export class StatusBarNotifier extends Disposable {
|
|||
|
||||
portsTooltip =
|
||||
this._ports.size == 1
|
||||
? localize('livePreviewRunningOnPort', 'Live Preview running on port:')
|
||||
: localize(
|
||||
'livePreviewRunningOnPorts',
|
||||
'Live Preview running on ports:'
|
||||
) + ' ';
|
||||
? vscode.l10n.t('Live Preview running on port:')
|
||||
: vscode.l10n.t('Live Preview running on ports:') + ' ';
|
||||
|
||||
portsTooltip += bulletPoints.join('');
|
||||
|
||||
this._statusBar.tooltip = portsTooltip;
|
||||
this._statusBar.text = `$(radio-tower) ${portsLabel}`;
|
||||
this._statusBar.command = {
|
||||
title: localize('openCommandPalette', 'Open Command Palette'),
|
||||
title: vscode.l10n.t('Open Command Palette'),
|
||||
command: 'workbench.action.quickOpen',
|
||||
arguments: ['>Live Preview: '],
|
||||
};
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
nls.config({
|
||||
messageFormat: nls.MessageFormat.bundle,
|
||||
bundleFormat: nls.BundleFormat.standalone,
|
||||
});
|
|
@ -4,7 +4,6 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { URL } from 'url';
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import TelemetryReporter from 'vscode-extension-telemetry';
|
||||
|
@ -16,8 +15,6 @@ import { IOpenFileOptions } from '../manager';
|
|||
import { Connection } from '../connectionInfo/connection';
|
||||
import { escapeRegExp } from '../utils/utils';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
/**
|
||||
* @description the link provider that runs on Live Preview's `Run Server` task
|
||||
*/
|
||||
|
@ -122,8 +119,8 @@ export class serverTaskLinkProvider
|
|||
: partialLinkMatches[i].substring(0, queryIndex);
|
||||
const isDir = link.endsWith('/');
|
||||
const tooltip = isDir
|
||||
? localize('revealFolder', 'Reveal Folder ')
|
||||
: localize('openFile', 'Open File ');
|
||||
? vscode.l10n.t('Reveal Folder ')
|
||||
: vscode.l10n.t('Open File ');
|
||||
const tl = {
|
||||
startIndex: partialLinkMatches.index,
|
||||
length: partialLinkMatches[i].length,
|
||||
|
@ -172,7 +169,7 @@ export class serverTaskLinkProvider
|
|||
const tl = {
|
||||
startIndex: fullURLMatches.index,
|
||||
length: fullURLMatches[i].length,
|
||||
tooltip: localize('openInPreview', 'Open in Preview'),
|
||||
tooltip: vscode.l10n.t('Open in Preview'),
|
||||
data: vscode.Uri.joinPath(hostUri, url.pathname),
|
||||
inEditor: false,
|
||||
};
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import TelemetryReporter from 'vscode-extension-telemetry';
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import {
|
||||
|
@ -16,7 +15,6 @@ import { FormatDateTime } from '../utils/utils';
|
|||
import { ServerStartedStatus } from './serverTaskProvider';
|
||||
import { IServerMsg } from '../server/serverGrouping';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
const CHAR_CODE_CTRL_C = 3;
|
||||
|
||||
/**
|
||||
|
@ -67,15 +65,12 @@ export class ServerTaskTerminal
|
|||
if (this._executeServer) {
|
||||
this.running = true;
|
||||
this._onDidWrite.fire(
|
||||
localize('openingServer', 'Opening Server...') + '\r\n'
|
||||
vscode.l10n.t('Opening Server...') + '\r\n'
|
||||
);
|
||||
this._onRequestToOpenServerEmitter.fire(this._workspace);
|
||||
} else {
|
||||
this._onDidWrite.fire(
|
||||
localize(
|
||||
'serverAlreadyRunning',
|
||||
'Server already running in another task. Closing now.'
|
||||
) + '\r\n'
|
||||
vscode.l10n.t('serverAlreadyRunning','Server already running in another task. Closing now.') + '\r\n'
|
||||
);
|
||||
this.close();
|
||||
}
|
||||
|
@ -94,7 +89,7 @@ export class ServerTaskTerminal
|
|||
public handleInput(data: string): void {
|
||||
if (data.length > 0 && data.charCodeAt(0) == CHAR_CODE_CTRL_C) {
|
||||
this._onDidWrite.fire(
|
||||
localize('serverClosing', 'Closing the server...') + '\r\n'
|
||||
vscode.l10n.t('Closing the server...') + '\r\n'
|
||||
);
|
||||
|
||||
this._onRequestToCloseServerEmitter.fire(this._workspace);
|
||||
|
@ -114,8 +109,7 @@ export class ServerTaskTerminal
|
|||
switch (status) {
|
||||
case ServerStartedStatus.JUST_STARTED: {
|
||||
this._onDidWrite.fire(
|
||||
localize(
|
||||
'startedServer',
|
||||
vscode.l10n.t(
|
||||
'Started Server on {0}',
|
||||
formattedAddress + '\r\n'
|
||||
)
|
||||
|
@ -124,8 +118,7 @@ export class ServerTaskTerminal
|
|||
}
|
||||
case ServerStartedStatus.STARTED_BY_EMBEDDED_PREV: {
|
||||
this._onDidWrite.fire(
|
||||
localize(
|
||||
'serverAlreadyStarted',
|
||||
vscode.l10n.t(
|
||||
'Server already on at {0}',
|
||||
formattedAddress + '\r\n> '
|
||||
)
|
||||
|
@ -134,8 +127,7 @@ export class ServerTaskTerminal
|
|||
}
|
||||
}
|
||||
this._onDidWrite.fire(
|
||||
localize(
|
||||
'ctrlCToCloseServer',
|
||||
vscode.l10n.t(
|
||||
'Type {0} to close the server.',
|
||||
TerminalStyleUtil.ColorTerminalString(
|
||||
`CTRL+C`,
|
||||
|
@ -151,7 +143,7 @@ export class ServerTaskTerminal
|
|||
*/
|
||||
public serverStopped(): void {
|
||||
this._onDidWrite.fire(
|
||||
localize('serverStopped', 'Server stopped. Bye!') + '\n'
|
||||
vscode.l10n.t('Server stopped. Bye!') + '\n'
|
||||
);
|
||||
this.close();
|
||||
}
|
||||
|
@ -161,18 +153,11 @@ export class ServerTaskTerminal
|
|||
*/
|
||||
public serverWillBeStopped(): void {
|
||||
this._onDidWrite.fire(
|
||||
localize(
|
||||
'taskFinished',
|
||||
`This task will finish now, but the server will stay on since you've used the embedded preview recently.`
|
||||
) + '\r\n'
|
||||
vscode.l10n.t(`This task will finish now, but the server will stay on since you've used the embedded preview recently.`) + '\r\n'
|
||||
);
|
||||
this._onDidWrite.fire(
|
||||
TerminalStyleUtil.ColorTerminalString(
|
||||
localize(
|
||||
'runToStopServer',
|
||||
"Run 'Live Preview: Stop Server' in the command palette to close the server and close any previews."
|
||||
) + '\r\n\r\n',
|
||||
|
||||
vscode.l10n.t("Run 'Live Preview: Stop Server' in the command palette to close the server and close any previews.") + '\r\n\r\n',
|
||||
TerminalColor.yellow
|
||||
)
|
||||
);
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export const WS_URL_PLACEHOLDER = '${WS_URL}';
|
||||
export const HTTP_URL_PLACEHOLDER = '${HTTP_URL}';
|
||||
|
@ -14,21 +11,18 @@ export const HTTP_URL_PLACEHOLDER = '${HTTP_URL}';
|
|||
export const INIT_PANEL_TITLE = '/';
|
||||
|
||||
export const DONT_SHOW_AGAIN: vscode.MessageItem = {
|
||||
title: localize('dont show again', "Don't Show Again"),
|
||||
title: vscode.l10n.t("Don't Show Again"),
|
||||
};
|
||||
|
||||
export const OPEN_EXTERNALLY: vscode.MessageItem = {
|
||||
title: localize('open externally', 'Open Externally'),
|
||||
title: vscode.l10n.t('Open Externally'),
|
||||
};
|
||||
|
||||
export const DEFAULT_HOST = '127.0.0.1';
|
||||
|
||||
export const EXTENSION_ID = 'ms-vscode.live-server';
|
||||
|
||||
export const OUTPUT_CHANNEL_NAME = localize(
|
||||
'output channel name',
|
||||
'Embedded Live Preview Console'
|
||||
);
|
||||
export const OUTPUT_CHANNEL_NAME = vscode.l10n.t('Embedded Live Preview Console');
|
||||
|
||||
export const INJECTED_ENDPOINT_NAME = '/___vscode_livepreview_injected_script';
|
||||
|
||||
|
@ -41,6 +35,6 @@ export const UriSchemes: any = {
|
|||
|
||||
export const LIVE_PREVIEW_SERVER_ON = 'LivePreviewServerOn';
|
||||
|
||||
export const TASK_TERMINAL_BASE_NAME = localize('task name', 'Run Server');
|
||||
export const TASK_TERMINAL_BASE_NAME = vscode.l10n.t('Run Server');
|
||||
|
||||
export const DEFAULT_HTTP_HEADERS = { 'Accept-Ranges': 'bytes' };
|
|
@ -37,15 +37,6 @@ const config = {
|
|||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
// vscode-nls-dev loader:
|
||||
// * rewrite nls-calls
|
||||
loader: 'vscode-nls-dev/lib/webpack-loader',
|
||||
options: {
|
||||
// start with this being set to where your package.json is
|
||||
base: __dirname,
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.ts$/,
|
||||
exclude: /node_modules/,
|
||||
|
@ -68,12 +59,7 @@ const config = {
|
|||
],
|
||||
}),
|
||||
new CleanWebpackPlugin({
|
||||
cleanOnceBeforeBuildPatterns: [
|
||||
'*/',
|
||||
'!nls.bundle.*.json',
|
||||
'!nls.metadata.header.json',
|
||||
'!nls.metadata.json'
|
||||
],
|
||||
cleanOnceBeforeBuildPatterns: ['*/'],
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
|
5275
yarn.lock
5275
yarn.lock
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче