Skip to content

Commit 21fb999

Browse files
martincostelloAndyGerlicher
authored andcommitted
Support Windows' pseudo-locales (#3654)
* Support Windows pseudo-locales Add support for Windows pseudo-locales so that satellite resource assemblies can be compiled for them. * Update HardcodedCultureNames Update HardcodedCultureNames by regenerating it using the generated since removed from aspnet/Localization (see aspnet/Localization#130). Closes #3653
1 parent 0f6f837 commit 21fb999

File tree

2 files changed

+476
-3
lines changed

2 files changed

+476
-3
lines changed

src/Tasks.UnitTests/AssignCulture_Tests.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,32 @@ public void Regress283991()
192192
Assert.Equal(0, t.AssignedFilesWithCulture.Length);
193193
Assert.Equal(1, t.AssignedFilesWithNoCulture.Length);
194194
}
195+
196+
/*
197+
* Method: PseudoLocalization
198+
*
199+
* Test the usage of Windows Pseudo-Locales
200+
* https://docs.microsoft.com/en-gb/windows/desktop/Intl/pseudo-locales
201+
*/
202+
[Theory]
203+
[InlineData("qps-ploc")]
204+
[InlineData("qps-plocm")]
205+
[InlineData("qps-ploca")]
206+
[InlineData("qps-Latn-x-sh")] // Windows 10+
207+
public void PseudoLocalization(string culture)
208+
{
209+
AssignCulture t = new AssignCulture();
210+
t.BuildEngine = new MockEngine();
211+
ITaskItem i = new TaskItem($"MyResource.{culture}.resx");
212+
t.Files = new ITaskItem[] { i };
213+
t.Execute();
214+
215+
Assert.Equal(1, t.AssignedFiles.Length);
216+
Assert.Equal(1, t.CultureNeutralAssignedFiles.Length);
217+
Assert.Equal(culture, t.AssignedFiles[0].GetMetadata("Culture"));
218+
Assert.Equal($"MyResource.{culture}.resx", t.AssignedFiles[0].ItemSpec);
219+
Assert.Equal("MyResource.resx", t.CultureNeutralAssignedFiles[0].ItemSpec);
220+
}
195221
}
196222
}
197223

0 commit comments

Comments
 (0)