Skip to content

Commit

Permalink
localization
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisRumyantsev committed Oct 11, 2023
1 parent e1250d4 commit bada8de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Agent.Worker/TaskManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,14 @@ private void CheckForTaskDeprecation(IExecutionContext executionContext, Pipelin
{
string friendlyName = taskJson["friendlyName"].Value<string>();
int majorVersion = new Version(task.Version).Major;
string deprecationMessage = $"Task '{friendlyName}' version {majorVersion} ({task.Name}@{majorVersion}) is deprecated";
string deprecationMessage = StringUtil.Loc("DeprecationMessage", friendlyName, majorVersion, task.Name);
var removalDate = taskJson["removalDate"];

if (removalDate != null)
{
string whitespace = " ";
string removalDateString = removalDate.Value<DateTime>().ToString("MMMM d, yyyy");
deprecationMessage += $" and will be removed. From {removalDateString} onwards it may no longer be available";
deprecationMessage += whitespace + StringUtil.Loc("DeprecationMessageRemovalDate", removalDateString);
var helpUrl = taskJson["helpUrl"];

if (helpUrl != null)
Expand All @@ -344,12 +345,12 @@ private void CheckForTaskDeprecation(IExecutionContext executionContext, Pipelin
if (helpUrlString.StartsWith(urlPrefix))
{
string versionHelpUrl = $"{helpUrlString}-v{majorVersion}".Replace(urlPrefix, $"https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/");
deprecationMessage += $". Please see {versionHelpUrl} for more information about this task";
deprecationMessage += whitespace + StringUtil.Loc("DeprecationMessageHelpUrl", versionHelpUrl);
}
}
}

executionContext.Warning($"{deprecationMessage}.");
executionContext.Warning(deprecationMessage);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/Misc/layoutbin/en-US/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@
"DeploymentPoolNotFound": "Deployment pool not found: '{0}'",
"DeprecatedNode6": "This task uses Node 6 execution handler, which will be removed March 31st 2022. If you are the developer of the task - please consider the migration guideline to Node 10 handler - https://aka.ms/migrateTaskNode10 (check this page also if you would like to disable Node 6 deprecation warnings). If you are the user - feel free to reach out to the owners of this task to proceed on migration.",
"DeprecatedRunner": "Task '{0}' is dependent on a task runner that is end-of-life and will be removed in the future. Authors should review Node upgrade guidance: https://aka.ms/node-runner-guidance.",
"DeprecationMessage": "Task '{0}' version {1} ({2}@{1}) is deprecated.",
"DeprecationMessageHelpUrl": "Please see {0} for more information about this task.",
"DeprecationMessageRemovalDate": "This task will be removed. From {0} onwards it may no longer be available.",
"DirectoryHierarchyUnauthorized": "Permission to read the directory contents is required for '{0}' and each directory up the hierarchy. {1}",
"DirectoryIsEmptyForArtifact": "Directory '{0}' is empty. Nothing will be added to build artifact '{1}'.",
"DirectoryNotFound": "Directory not found: '{0}'",
Expand Down

0 comments on commit bada8de

Please sign in to comment.