Skip to content

Commit 0e6812e

Browse files
committed
add support for loc file
1 parent 3c72614 commit 0e6812e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

package.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,36 @@ var createExtensionTasks = configuration.environments.map((env) => {
5252

5353
fs.writeJsonSync(taskFilePath, task);
5454

55+
var taskLocFilePath = path.join(taskDirectory.directory, 'task.json');
56+
if (fs.existsSync(taskLocFilePath)) {
57+
var taskLoc = fs.readJsonSync(taskLocFilePath);
58+
taskLoc.id = env.TaskIds[taskDirectory.name];
59+
taskLoc.friendlyName += env.DisplayNamesSuffix;
60+
61+
taskLoc.version.Major = version.major;
62+
taskLoc.version.Minor = version.minor;
63+
taskLoc.version.Patch = version.patch;
64+
if (taskLoc.helpMarkDown) {
65+
taskLoc.helpMarkDown = taskLoc.helpMarkDown.replace('#{Version}#', version.getVersionString());
66+
}
67+
68+
var locfilesDirectory = path.join(taskDirectory.directory, 'Strings/resources.resjson');
69+
if (fs.existsSync(locfilesDirectory)) {
70+
var langs = fs.readdirSync(locfilesDirectory);
71+
for (var index = 0; index < langs.length; index++) {
72+
var element = langs[index];
73+
var resourceFile = path.join(locfilesDirectory, element, "resources.resjson");
74+
if (fs.existsSync(resourceFile)){
75+
var resource = fs.readJsonSync(resourceFile);
76+
resource["loc.helpMarkDown"] = resource["loc.helpMarkDown"].replace('#{Version}#', version.getVersionString());
77+
fs.writeJsonSync(resourceFile, resource);
78+
}
79+
}
80+
}
81+
}
82+
83+
84+
5585
var taskId = taskDirectory.name.replace(/([A-Z])/g, '-$1').toLowerCase().replace(/^[-]+/, "");
5686
extension.contributions.push({
5787
id: taskId + "-task",

0 commit comments

Comments
 (0)