mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
[css/json/html] move to l10n (#165725)
[css/json/html] move to l10n (for #164438)
This commit is contained in:
committed by
GitHub
parent
59faab44cd
commit
afac9524b6
@@ -3,9 +3,8 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { commands, CompletionItem, CompletionItemKind, ExtensionContext, languages, Position, Range, SnippetString, TextEdit, window, TextDocument, CompletionContext, CancellationToken, ProviderResult, CompletionList, FormattingOptions, workspace } from 'vscode';
|
||||
import { commands, CompletionItem, CompletionItemKind, ExtensionContext, languages, Position, Range, SnippetString, TextEdit, window, TextDocument, CompletionContext, CancellationToken, ProviderResult, CompletionList, FormattingOptions, workspace, l10n } from 'vscode';
|
||||
import { Disposable, LanguageClientOptions, ProvideCompletionItemsSignature, NotificationType, BaseLanguageClient, DocumentRangeFormattingParams, DocumentRangeFormattingRequest } from 'vscode-languageclient';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { getCustomDataSource } from './customData';
|
||||
import { RequestService, serveFileSystemRequests } from './requests';
|
||||
|
||||
@@ -13,8 +12,6 @@ namespace CustomDataChangedNotification {
|
||||
export const type: NotificationType<string[]> = new NotificationType('css/customDataChanged');
|
||||
}
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export type LanguageClientConstructor = (name: string, description: string, clientOptions: LanguageClientOptions) => BaseLanguageClient;
|
||||
|
||||
export interface Runtime {
|
||||
@@ -98,7 +95,7 @@ export async function startClient(context: ExtensionContext, newLanguageClient:
|
||||
};
|
||||
|
||||
// Create the language client and start the client.
|
||||
const client = newLanguageClient('css', localize('cssserver.name', 'CSS Language Server'), clientOptions);
|
||||
const client = newLanguageClient('css', l10n.t('CSS Language Server'), clientOptions);
|
||||
client.registerProposedFeatures();
|
||||
|
||||
await client.start();
|
||||
@@ -132,13 +129,13 @@ export async function startClient(context: ExtensionContext, newLanguageClient:
|
||||
const beginProposal = new CompletionItem('#region', CompletionItemKind.Snippet);
|
||||
beginProposal.range = range; TextEdit.replace(range, '/* #region */');
|
||||
beginProposal.insertText = new SnippetString('/* #region $1*/');
|
||||
beginProposal.documentation = localize('folding.start', 'Folding Region Start');
|
||||
beginProposal.documentation = l10n.t('Folding Region Start');
|
||||
beginProposal.filterText = match[2];
|
||||
beginProposal.sortText = 'za';
|
||||
const endProposal = new CompletionItem('#endregion', CompletionItemKind.Snippet);
|
||||
endProposal.range = range;
|
||||
endProposal.insertText = '/* #endregion */';
|
||||
endProposal.documentation = localize('folding.end', 'Folding Region End');
|
||||
endProposal.documentation = l10n.t('Folding Region End');
|
||||
endProposal.sortText = 'zb';
|
||||
endProposal.filterText = match[2];
|
||||
return [beginProposal, endProposal];
|
||||
@@ -154,7 +151,7 @@ export async function startClient(context: ExtensionContext, newLanguageClient:
|
||||
const textEditor = window.activeTextEditor;
|
||||
if (textEditor && textEditor.document.uri.toString() === uri) {
|
||||
if (textEditor.document.version !== documentVersion) {
|
||||
window.showInformationMessage(`CSS fix is outdated and can't be applied to the document.`);
|
||||
window.showInformationMessage(l10n.t('CSS fix is outdated and can\'t be applied to the document.'));
|
||||
}
|
||||
textEditor.edit(mutator => {
|
||||
for (const edit of edits) {
|
||||
@@ -162,7 +159,7 @@ export async function startClient(context: ExtensionContext, newLanguageClient:
|
||||
}
|
||||
}).then(success => {
|
||||
if (!success) {
|
||||
window.showErrorMessage('Failed to apply CSS fix to the document. Please consider opening an issue with steps to reproduce.');
|
||||
window.showErrorMessage(l10n.t('Failed to apply CSS fix to the document. Please consider opening an issue with steps to reproduce.'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user