MCPcopy Index your code
hub / github.com/microsoft/vscode-cpptools / processJsonSchemaFiles

Function processJsonSchemaFiles

Extension/gulpfile.js:186–213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

184// Traverses schema json files looking for "description" fields to localized.
185// The path to the "description" field is used to create a localization key.
186const processJsonSchemaFiles = () => {
187 return es.through(function (file) {
188 let jsonTree = JSON.parse(file.contents.toString());
189 let localizationJsonContents = {};
190 let filePath = removePathPrefix(file.path, file.cwd);
191 let localizationMetadataContents = {
192 messages: [],
193 keys: [],
194 filePath: filePath
195 };
196 let descriptionCallback = (path, value, parent) => {
197 let locId = filePath + "." + path;
198 let locHint = parent.descriptionHint;
199 localizationJsonContents[locId] = value;
200 localizationMetadataContents.keys.push(locHint ? { key: locId, comment: [locHint] } : locId);
201 localizationMetadataContents.messages.push(value);
202 };
203 traverseJson(jsonTree, descriptionCallback, "");
204 this.queue(new vinyl({
205 path: path.join(file.path + '.nls.json'),
206 contents: Buffer.from(JSON.stringify(localizationJsonContents, null, '\t'), 'utf8')
207 }));
208 this.queue(new vinyl({
209 path: path.join(file.path + '.nls.metadata.json'),
210 contents: Buffer.from(JSON.stringify(localizationMetadataContents, null, '\t'), 'utf8')
211 }));
212 });
213};
214
215gulp.task("translations-export", (done) => {
216

Callers 1

gulpfile.jsFile · 0.85

Calls 4

removePathPrefixFunction · 0.85
traverseJsonFunction · 0.85
toStringMethod · 0.80
fromMethod · 0.80

Tested by

no test coverage detected