mirror of
https://github.com/Microsoft/vscode
synced 2024-07-04 16:58:49 +00:00
parent
09f6753adc
commit
8a37410ce2
|
@ -138,8 +138,16 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule {
|
||||||
return {
|
return {
|
||||||
['Literal']: (node: any) => collectDoubleQuotedStrings(node),
|
['Literal']: (node: any) => collectDoubleQuotedStrings(node),
|
||||||
['ExpressionStatement[directive] Literal:exit']: (node: any) => doubleQuotedStringLiterals.delete(node),
|
['ExpressionStatement[directive] Literal:exit']: (node: any) => doubleQuotedStringLiterals.delete(node),
|
||||||
|
|
||||||
|
// localize(...)
|
||||||
['CallExpression[callee.type="MemberExpression"][callee.object.name="nls"][callee.property.name="localize"]:exit']: (node: any) => visitLocalizeCall(node),
|
['CallExpression[callee.type="MemberExpression"][callee.object.name="nls"][callee.property.name="localize"]:exit']: (node: any) => visitLocalizeCall(node),
|
||||||
|
|
||||||
|
// vscode.l10n.t(...)
|
||||||
['CallExpression[callee.type="MemberExpression"][callee.object.property.name="l10n"][callee.property.name="t"]:exit']: (node: any) => visitL10NCall(node),
|
['CallExpression[callee.type="MemberExpression"][callee.object.property.name="l10n"][callee.property.name="t"]:exit']: (node: any) => visitL10NCall(node),
|
||||||
|
|
||||||
|
// l10n.t(...)
|
||||||
|
['CallExpression[callee.object.name="l10n"][callee.property.name="t"]:exit']: (node: any) => visitL10NCall(node),
|
||||||
|
|
||||||
['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node: any) => visitLocalizeCall(node),
|
['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node: any) => visitLocalizeCall(node),
|
||||||
['Program:exit']: reportBadStringsAndBadKeys,
|
['Program:exit']: reportBadStringsAndBadKeys,
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,8 +28,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jsonc-parser": "^2.2.1",
|
"jsonc-parser": "^2.2.1",
|
||||||
"markdown-it": "^12.3.2",
|
"markdown-it": "^12.3.2",
|
||||||
"parse5": "^3.0.2",
|
"parse5": "^3.0.2"
|
||||||
"vscode-nls": "^5.2.0"
|
|
||||||
},
|
},
|
||||||
"contributes": {
|
"contributes": {
|
||||||
"jsonValidation": [
|
"jsonValidation": [
|
||||||
|
|
|
@ -6,13 +6,11 @@
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { URL } from 'url';
|
import { URL } from 'url';
|
||||||
import * as nls from 'vscode-nls';
|
|
||||||
const localize = nls.loadMessageBundle();
|
|
||||||
|
|
||||||
import { parseTree, findNodeAtLocation, Node as JsonNode, getNodeValue } from 'jsonc-parser';
|
import { parseTree, findNodeAtLocation, Node as JsonNode, getNodeValue } from 'jsonc-parser';
|
||||||
import * as MarkdownItType from 'markdown-it';
|
import * as MarkdownItType from 'markdown-it';
|
||||||
|
|
||||||
import { languages, workspace, Disposable, TextDocument, Uri, Diagnostic, Range, DiagnosticSeverity, Position, env } from 'vscode';
|
import { languages, workspace, Disposable, TextDocument, Uri, Diagnostic, Range, DiagnosticSeverity, Position, env, l10n } from 'vscode';
|
||||||
|
|
||||||
const product = JSON.parse(fs.readFileSync(path.join(env.appRoot, 'product.json'), { encoding: 'utf-8' }));
|
const product = JSON.parse(fs.readFileSync(path.join(env.appRoot, 'product.json'), { encoding: 'utf-8' }));
|
||||||
const allowedBadgeProviders: string[] = (product.extensionAllowedBadgeProviders || []).map((s: string) => s.toLowerCase());
|
const allowedBadgeProviders: string[] = (product.extensionAllowedBadgeProviders || []).map((s: string) => s.toLowerCase());
|
||||||
|
@ -23,14 +21,14 @@ function isTrustedSVGSource(uri: Uri): boolean {
|
||||||
return allowedBadgeProviders.includes(uri.authority.toLowerCase()) || allowedBadgeProvidersRegex.some(r => r.test(uri.toString()));
|
return allowedBadgeProviders.includes(uri.authority.toLowerCase()) || allowedBadgeProvidersRegex.some(r => r.test(uri.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
const httpsRequired = localize('httpsRequired', "Images must use the HTTPS protocol.");
|
const httpsRequired = l10n.t("Images must use the HTTPS protocol.");
|
||||||
const svgsNotValid = localize('svgsNotValid', "SVGs are not a valid image source.");
|
const svgsNotValid = l10n.t("SVGs are not a valid image source.");
|
||||||
const embeddedSvgsNotValid = localize('embeddedSvgsNotValid', "Embedded SVGs are not a valid image source.");
|
const embeddedSvgsNotValid = l10n.t("Embedded SVGs are not a valid image source.");
|
||||||
const dataUrlsNotValid = localize('dataUrlsNotValid', "Data URLs are not a valid image source.");
|
const dataUrlsNotValid = l10n.t("Data URLs are not a valid image source.");
|
||||||
const relativeUrlRequiresHttpsRepository = localize('relativeUrlRequiresHttpsRepository', "Relative image URLs require a repository with HTTPS protocol to be specified in the package.json.");
|
const relativeUrlRequiresHttpsRepository = l10n.t("Relative image URLs require a repository with HTTPS protocol to be specified in the package.json.");
|
||||||
const relativeIconUrlRequiresHttpsRepository = localize('relativeIconUrlRequiresHttpsRepository', "An icon requires a repository with HTTPS protocol to be specified in this package.json.");
|
const relativeIconUrlRequiresHttpsRepository = l10n.t("An icon requires a repository with HTTPS protocol to be specified in this package.json.");
|
||||||
const relativeBadgeUrlRequiresHttpsRepository = localize('relativeBadgeUrlRequiresHttpsRepository', "Relative badge URLs require a repository with HTTPS protocol to be specified in this package.json.");
|
const relativeBadgeUrlRequiresHttpsRepository = l10n.t("Relative badge URLs require a repository with HTTPS protocol to be specified in this package.json.");
|
||||||
const apiProposalNotListed = localize('apiProposalNotListed', "This proposal cannot be used because for this extension the product defines a fixed set of API proposals. You can test your extension but before publishing you MUST reach out to the VS Code team.");
|
const apiProposalNotListed = l10n.t("This proposal cannot be used because for this extension the product defines a fixed set of API proposals. You can test your extension but before publishing you MUST reach out to the VS Code team.");
|
||||||
|
|
||||||
enum Context {
|
enum Context {
|
||||||
ICON,
|
ICON,
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
|
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { getLocation, Location } from 'jsonc-parser';
|
import { getLocation, Location } from 'jsonc-parser';
|
||||||
import * as nls from 'vscode-nls';
|
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
|
||||||
|
|
||||||
export class PackageDocument {
|
export class PackageDocument {
|
||||||
|
|
||||||
|
@ -40,8 +38,8 @@ export class PackageDocument {
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.resolve([this.newSnippetCompletionItem({
|
return Promise.resolve([this.newSnippetCompletionItem({
|
||||||
label: localize('languageSpecificEditorSettings', "Language specific editor settings"),
|
label: vscode.l10n.t("Language specific editor settings"),
|
||||||
documentation: localize('languageSpecificEditorSettingsDescription', "Override editor settings for language"),
|
documentation: vscode.l10n.t("Override editor settings for language"),
|
||||||
snippet,
|
snippet,
|
||||||
range
|
range
|
||||||
})]);
|
})]);
|
||||||
|
|
|
@ -66,8 +66,3 @@ uc.micro@^1.0.1, uc.micro@^1.0.5:
|
||||||
version "1.0.6"
|
version "1.0.6"
|
||||||
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac"
|
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac"
|
||||||
integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==
|
integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==
|
||||||
|
|
||||||
vscode-nls@^5.2.0:
|
|
||||||
version "5.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.2.0.tgz#3cb6893dd9bd695244d8a024bdf746eea665cc3f"
|
|
||||||
integrity sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng==
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user