Skip to content

Commit 6610004

Browse files
authored
Add support for localization hints in schema files (#8016)
1 parent 5623d1e commit 6610004

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Extension/c_cpp_properties.schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188
"env": {
189189
"type": "object",
190190
"description": "Custom variables that can be reused anywhere in this file using the ${variable} or ${env:variable} syntax.",
191+
"descriptionHint": "The word 'variable' within curly braces should also be translated. The \"env\" should not be translated, and the punctuation (\"${:}\") should be preserved.",
191192
"patternProperties": {
192193
"(?!^workspaceFolder$)(?!^workspaceRoot$)(?!^workspaceFolderBasename$)(?!^default$)(^.+$)": {
193194
"oneOf": [

Extension/gulpfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,9 @@ const processJsonSchemaFiles = () => {
219219
};
220220
let descriptionCallback = (path, value, parent) => {
221221
let locId = filePath + "." + path;
222+
let locHint = parent.descriptionHint;
222223
localizationJsonContents[locId] = value;
223-
localizationMetadataContents.keys.push(locId);
224+
localizationMetadataContents.keys.push(locHint ? { key: locId, comment: [locHint] } : locId);
224225
localizationMetadataContents.messages.push(value);
225226
};
226227
traverseJson(jsonTree, descriptionCallback, "");

0 commit comments

Comments
 (0)