Adopt l10n for markdown extension (#165448)

For #164438

Also makes our eslint rules understand `vscode.l10n.t(`
This commit is contained in:
Matt Bierner
2022-11-04 01:49:49 -07:00
committed by GitHub
parent e764c5b816
commit cd29f751eb
12 changed files with 62 additions and 78 deletions

View File

@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import * as uri from 'vscode-uri';
import { ILogger } from '../logging';
import { MarkdownItEngine } from '../markdownEngine';
@@ -14,7 +13,6 @@ import { WebviewResourceProvider } from '../util/resources';
import { MarkdownPreviewConfiguration, MarkdownPreviewConfigurationManager } from './previewConfig';
import { ContentSecurityPolicyArbiter, MarkdownPreviewSecurityLevel } from './security';
const localize = nls.loadMessageBundle();
/**
* Strings used inside the markdown preview.
@@ -23,17 +21,11 @@ const localize = nls.loadMessageBundle();
* can be localized using our normal localization process.
*/
const previewStrings = {
cspAlertMessageText: localize(
'preview.securityMessage.text',
'Some content has been disabled in this document'),
cspAlertMessageText: vscode.l10n.t("Some content has been disabled in this document"),
cspAlertMessageTitle: localize(
'preview.securityMessage.title',
'Potentially unsafe or insecure content has been disabled in the Markdown preview. Change the Markdown preview security setting to allow insecure content or enable scripts'),
cspAlertMessageTitle: vscode.l10n.t("Potentially unsafe or insecure content has been disabled in the Markdown preview. Change the Markdown preview security setting to allow insecure content or enable scripts"),
cspAlertMessageLabel: localize(
'preview.securityMessage.label',
'Content Disabled Security Warning')
cspAlertMessageLabel: vscode.l10n.t("Content Disabled Security Warning")
};
export interface MarkdownContentProviderOutput {
@@ -130,7 +122,7 @@ export class MdDocumentRenderer {
public renderFileNotFoundDocument(resource: vscode.Uri): string {
const resourcePath = uri.Utils.basename(resource);
const body = localize('preview.notFound', '{0} cannot be found', resourcePath);
const body = vscode.l10n.t('{0} cannot be found', resourcePath);
return `<!DOCTYPE html>
<html>
<body class="vscode-body">