Skip to content

Commit a81037e

Browse files
committed
Add a localized string for DeferredResponseFile
See dotnet/msbuild#8608 When this string ships in production MSBuild, we will regenerate Strings.json against those dlls and will get the correct localized strings. For now they are all English. Generated by running the ResourcesGenerator tool against a locally build MSBuild containing the new string.
1 parent 5a85601 commit a81037e

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

src/ResourcesGenerator/Program.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,17 @@ static void Main()
2121
var instance =
2222
instances.FirstOrDefault(i => !i.MSBuildPath.Contains("Preview")) ??
2323
instances.FirstOrDefault();
24-
var msbuildPath = instance?.MSBuildPath;
2524

26-
var otherCandidates = new[]
25+
var candidates = new[]
2726
{
28-
@"C:\msbuild\artifacts\bin\bootstrap\net472\MSBuild\Current\Bin",
27+
@"C:\msbuild\artifacts\bin\bootstrap\net472\MSBuild\Current\Bin\amd64",
28+
instance?.MSBuildPath,
2929
Path.Combine(
3030
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
3131
"Microsoft Visual Studio", "2022", "Enterprise", "MSBuild", "Current", "Bin"),
32-
Path.Combine(
33-
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),
34-
"Microsoft Visual Studio", "2019", "Enterprise", "MSBuild", "Current", "Bin")
3532
};
3633

37-
if (msbuildPath == null)
38-
{
39-
msbuildPath = otherCandidates.FirstOrDefault(Directory.Exists);
40-
}
34+
var msbuildPath = candidates.FirstOrDefault(c => c != null && Directory.Exists(c));
4135

4236
if (Directory.Exists(msbuildPath))
4337
{

src/ResourcesGenerator/ResourceCreator.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class ResourceCreator
1414
{
1515
private static string[] msBuildDlls = new string[]
1616
{
17+
"MSBuild.exe",
1718
"Microsoft.Build.dll",
1819
"Microsoft.Build.Tasks.Core.dll",
1920
"Microsoft.Build.Utilities.Core.dll"
@@ -78,7 +79,8 @@ public class ResourceCreator
7879
"CouldNotResolveSdk",
7980
"ProjectImportSkippedExpressionEvaluatedToEmpty",
8081
"SkipTargetBecauseOutputsUpToDate",
81-
"MetaprojectGenerated"
82+
"MetaprojectGenerated",
83+
"DeferredResponseFile"
8284
};
8385

8486
public static Dictionary<string, string> Cultures = new Dictionary<string, string>

src/StructuredLogger/ObjectModel/Message.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private Match GetSourceFileMatch()
5050
return match;
5151
}
5252

53-
match = Strings.MessageIncludedResponseFile.Match(Text);
53+
match = Strings.DeferredResponseFileRegex.Match(Text);
5454
if (match.Success)
5555
{
5656
return match;

src/StructuredLogger/Strings/Strings.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ private static void InitializeRegex()
149149
.Replace("{3}", @"(?<File>.*) \((?<Line>\d+),(?<Column>\d+)\)$");
150150
PropertyReassignmentRegex = new Regex(propertyReassignment, RegexOptions.Compiled | RegexOptions.Singleline);
151151

152-
// Note: This string is not localized in MSBuild.
153-
const string messageIncludeResponseFileString = @$"^Included response file: (?<File>((.:)?[^:\n\r]*?))$";
154-
MessageIncludedResponseFile = new Regex(messageIncludeResponseFileString, RegexOptions.Compiled | RegexOptions.Singleline);
152+
string deferredResponseFile = "^" + GetString("DeferredResponseFile")
153+
.Replace(@"{0}", @"(?<File>((.:)?[^:\n\r]*?))") + "$";
154+
DeferredResponseFileRegex = new Regex(deferredResponseFile, RegexOptions.Compiled | RegexOptions.Singleline);
155155

156156
MetaprojectGenerated = GetString("MetaprojectGenerated");
157157
string messageMetaprojectGeneratedString = MetaprojectGenerated.Replace(@"{0}", @"(?<File>((.:)?[^:\n\r]*?))");
@@ -255,7 +255,7 @@ public static Regex CreateRegex(string text, int replacePlaceholders = 0, RegexO
255255
public static Regex ProjectImportSkippedExpressionEvaluatedToEmptyRegex { get; set; }
256256
public static Regex ProjectImportSkippedNoMatchesRegex { get; set; }
257257
public static Regex PropertyReassignmentRegex { get; set; }
258-
public static Regex MessageIncludedResponseFile { get; set; }
258+
public static Regex DeferredResponseFileRegex { get; set; }
259259
public static Regex MessageMetaprojectGenerated { get; set; }
260260
public static Regex UnifiedPrimaryReferencePrefix { get; set; }
261261
public static Regex PrimaryReferencePrefix { get; set; }

src/StructuredLogger/Strings/Strings.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"en-US": {
3+
"DeferredResponseFile": "Included response file: {0}",
34
"MetaprojectGenerated": "Metaproject \"{0}\" generated.",
45
"OutputItemParameterMessagePrefix": "Output Item(s): ",
56
"General.ProjectUndefineProperties": "Removing Properties for project \"{0}\":",
@@ -53,6 +54,7 @@
5354
"Copy.FileComment": "Copying file from \"{0}\" to \"{1}\"."
5455
},
5556
"de-DE": {
57+
"DeferredResponseFile": "Included response file: {0}",
5658
"MetaprojectGenerated": "Das Metaprojekt \"{0}\" wurde generiert.",
5759
"OutputItemParameterMessagePrefix": "Ausgegebene Elemente: ",
5860
"General.ProjectUndefineProperties": "Eigenschaften für Projekt \"{0}\" werden entfernt:",
@@ -106,6 +108,7 @@
106108
"Copy.FileComment": "Die Datei wird von \"{0}\" in \"{1}\" kopiert."
107109
},
108110
"it-IT": {
111+
"DeferredResponseFile": "Included response file: {0}",
109112
"MetaprojectGenerated": "Il metaprogetto \"{0}\" è stato generato.",
110113
"OutputItemParameterMessagePrefix": "Elementi di output: ",
111114
"General.ProjectUndefineProperties": "Rimozione delle proprietà per il progetto \"{0}\":",
@@ -159,6 +162,7 @@
159162
"Copy.FileComment": "Copia del file da \"{0}\" a \"{1}\"."
160163
},
161164
"es-ES": {
165+
"DeferredResponseFile": "Included response file: {0}",
162166
"MetaprojectGenerated": "Se generó el metaproyecto \"{0}\".",
163167
"OutputItemParameterMessagePrefix": "Elementos de salida: ",
164168
"General.ProjectUndefineProperties": "Quitando propiedades del proyecto \"{0}\":",
@@ -212,6 +216,7 @@
212216
"Copy.FileComment": "Copiando el archivo de \"{0}\" en \"{1}\"."
213217
},
214218
"fr-FR": {
219+
"DeferredResponseFile": "Included response file: {0}",
215220
"MetaprojectGenerated": "Le métaprojet \"{0}\" a été généré.",
216221
"OutputItemParameterMessagePrefix": "Élément(s) en sortie : ",
217222
"General.ProjectUndefineProperties": "Suppression des propriétés du projet \"{0}\" :",
@@ -265,6 +270,7 @@
265270
"Copy.FileComment": "Copie du fichier de \"{0}\" vers \"{1}\"."
266271
},
267272
"cs-CZ": {
273+
"DeferredResponseFile": "Included response file: {0}",
268274
"MetaprojectGenerated": "Metaprojekt {0} byl vygenerován.",
269275
"OutputItemParameterMessagePrefix": "Výstupní položky: ",
270276
"General.ProjectUndefineProperties": "Odstraňování vlastností projektu {0}:",
@@ -318,6 +324,7 @@
318324
"Copy.FileComment": "Probíhá kopírování souboru z umístění {0} do umístění {1}."
319325
},
320326
"ja-JP": {
327+
"DeferredResponseFile": "Included response file: {0}",
321328
"MetaprojectGenerated": "メタプロジェクト \"{0}\" が生成されました。",
322329
"OutputItemParameterMessagePrefix": "出力項目: ",
323330
"General.ProjectUndefineProperties": "プロジェクト \"{0}\" のプロパティの削除:",
@@ -371,6 +378,7 @@
371378
"Copy.FileComment": "\"{0}\" から \"{1}\" へファイルをコピーしています。"
372379
},
373380
"ko-KR": {
381+
"DeferredResponseFile": "Included response file: {0}",
374382
"MetaprojectGenerated": "메타프로젝트 \"{0}\"이(가) 생성되었습니다.",
375383
"OutputItemParameterMessagePrefix": "출력 항목: ",
376384
"General.ProjectUndefineProperties": "\"{0}\" 프로젝트에 대한 속성 제거:",
@@ -424,6 +432,7 @@
424432
"Copy.FileComment": "\"{0}\"에서 \"{1}\"(으)로 파일을 복사하고 있습니다."
425433
},
426434
"ru-RU": {
435+
"DeferredResponseFile": "Included response file: {0}",
427436
"MetaprojectGenerated": "Создан метапроект \"{0}\".",
428437
"OutputItemParameterMessagePrefix": "Выходных элементов: ",
429438
"General.ProjectUndefineProperties": "Удаление свойств для проекта \"{0}\":",
@@ -477,6 +486,7 @@
477486
"Copy.FileComment": "Копирование файла из \"{0}\" в \"{1}\"."
478487
},
479488
"pl-PL": {
489+
"DeferredResponseFile": "Included response file: {0}",
480490
"MetaprojectGenerated": "Wygenerowano metaprojekt „{0}”.",
481491
"OutputItemParameterMessagePrefix": "Elementy wyjściowe: ",
482492
"General.ProjectUndefineProperties": "Usuwanie właściwości projektu {0}:",
@@ -530,6 +540,7 @@
530540
"Copy.FileComment": "Kopiowanie pliku z „{0}” do „{1}”."
531541
},
532542
"pt-BR": {
543+
"DeferredResponseFile": "Included response file: {0}",
533544
"MetaprojectGenerated": "Metaprojeto \"{0}\" gerado.",
534545
"OutputItemParameterMessagePrefix": "Itens de Saída(s): ",
535546
"General.ProjectUndefineProperties": "Removendo Propriedades do projeto \"{0}\":",
@@ -583,6 +594,7 @@
583594
"Copy.FileComment": "Copiando o arquivo de \"{0}\" para \"{1}\"."
584595
},
585596
"tr-TR": {
597+
"DeferredResponseFile": "Included response file: {0}",
586598
"MetaprojectGenerated": "\"{0}\" meta projesi oluşturuldu.",
587599
"OutputItemParameterMessagePrefix": "Çıkış Öğeleri: ",
588600
"General.ProjectUndefineProperties": "\"{0}\" projesinin Özellikleri kaldırılıyor:",
@@ -636,6 +648,7 @@
636648
"Copy.FileComment": "Dosya \"{0}\" konumundan \"{1}\" konumuna kopyalanıyor."
637649
},
638650
"zh-Hans": {
651+
"DeferredResponseFile": "Included response file: {0}",
639652
"MetaprojectGenerated": "已生成元项目“{0}”。",
640653
"OutputItemParameterMessagePrefix": "输出项: ",
641654
"General.ProjectUndefineProperties": "移除项目“{0}”的属性:",

0 commit comments

Comments
 (0)