Skip to content

Commit 409c562

Browse files
authored
Fix localization of test adapter messages (#3867)
1 parent 8f2649f commit 409c562

File tree

3 files changed

+28
-21
lines changed

3 files changed

+28
-21
lines changed

src/Adapter/MSTest.TestAdapter/build/net/MSTest.TestAdapter.targets

+7-7
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@
7373

7474
<!-- Copy resources over to $(TargetDir) if this is a localized build. -->
7575
<Target Name="CopyMSTestV2Resources" BeforeTargets="PrepareForBuild" Condition=" '$(EnableMSTestV2CopyResources)' == 'true' " DependsOnTargets="GetMSTestV2CultureHierarchy">
76-
<PropertyGroup>
77-
<CurrentUICultureHierarchy>%(CurrentUICultureHierarchy.Identity)</CurrentUICultureHierarchy>
78-
</PropertyGroup>
7976

77+
<!-- Expand the UICulture hierarchy to items, such as cs-CZ, cs, and attach the culture metadata to the item. -->
8078
<ItemGroup>
81-
<MSTestV2Files Include="$(MSBuildThisFileDirectory)..\_localization\*.dll" />
79+
<MSTestV2Files Include="$(MSBuildThisFileDirectory)..\_localization\%(CurrentUICultureHierarchy.Identity)\*.dll">
80+
<UICulture>%(CurrentUICultureHierarchy.Identity)</UICulture>
81+
</MSTestV2Files>
8282
</ItemGroup>
8383

8484
<ItemGroup>
85-
<Content Include="@(MSTestV2Files->'%(RootDir)%(Directory)$(CurrentUICultureHierarchy)\%(FileName).resources.dll')"
86-
Condition="Exists('%(RootDir)%(Directory)$(CurrentUICultureHierarchy)\%(FileName).resources.dll')">
87-
<Link>$(CurrentUICultureHierarchy)\%(FileName).resources.dll</Link>
85+
<!-- Add the localization file as content so it gets copied from nuget to bin folder. -->
86+
<Content Include="@(MSTestV2Files->'%(FullPath)')">
87+
<Link>%(MSTestV2Files.UICulture)\%(FileName).dll</Link>
8888
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
8989
<BaseAssemblyFullPath>%(FullPath)</BaseAssemblyFullPath>
9090
<Visible>False</Visible>

src/Adapter/MSTest.TestAdapter/build/netfx-netcore-netstandard/MSTest.TestAdapter.targets

+11-5
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,20 @@
6666

6767
<!-- Copy resources over to $(TargetDir) if this is a localized build. -->
6868
<Target Name="CopyMSTestV2Resources" BeforeTargets="PrepareForBuild" Condition=" '$(EnableMSTestV2CopyResources)' == 'true' " DependsOnTargets="GetMSTestV2CultureHierarchy">
69+
70+
<!-- Expand the UICulture hierarchy to items, such as cs-CZ, cs, and attach the culture metadata to the item. -->
6971
<ItemGroup>
70-
<MSTestV2ResourceFiles Include="$(MSBuildThisFileDirectory)..\_localization\%(CurrentUICultureHierarchy.Identity)\*resources.dll">
71-
<CultureString>%(CurrentUICultureHierarchy.Identity)</CultureString>
72-
</MSTestV2ResourceFiles>
72+
<MSTestV2Files Include="$(MSBuildThisFileDirectory)..\_localization\%(CurrentUICultureHierarchy.Identity)\*.dll">
73+
<UICulture>%(CurrentUICultureHierarchy.Identity)</UICulture>
74+
</MSTestV2Files>
75+
</ItemGroup>
7376

74-
<Content Include="@(MSTestV2ResourceFiles)" Condition=" @(MSTestV2ResourceFiles) != '' ">
75-
<Link>%(MSTestV2ResourceFiles.CultureString)\%(Filename)%(Extension)</Link>
77+
<ItemGroup>
78+
<!-- Add the localization file as content so it gets copied from nuget to bin folder. -->
79+
<Content Include="@(MSTestV2Files->'%(FullPath)')">
80+
<Link>%(MSTestV2Files.UICulture)\%(FileName).dll</Link>
7681
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
82+
<BaseAssemblyFullPath>%(FullPath)</BaseAssemblyFullPath>
7783
<Visible>False</Visible>
7884
</Content>
7985
</ItemGroup>

src/Adapter/MSTest.TestAdapter/build/uwp/MSTest.TestAdapter.targets

+10-9
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,20 @@
2929
<!-- Copy resources over to $(TargetDir) if this is a localized build. -->
3030
<Target Name="CopyMSTestV2Resources" BeforeTargets="PrepareForBuild" Condition=" '$(EnableMSTestV2CopyResources)' == 'true' " DependsOnTargets="GetMSTestV2CultureHierarchy">
3131

32-
<PropertyGroup>
33-
<CurrentUICultureHierarchy>%(CurrentUICultureHierarchy.Identity)</CurrentUICultureHierarchy>
34-
</PropertyGroup>
35-
32+
<!-- Expand the UICulture hierarchy to items, such as cs-CZ, cs, and attach the culture metadata to the item. -->
3633
<ItemGroup>
37-
<MSTestV2Files Include="$(MSBuildThisFileDirectory)../_localization/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll" />
38-
<MSTestV2Files Include="$(MSBuildThisFileDirectory)*.dll" />
34+
<MSTestV2Files Include="$(MSBuildThisFileDirectory)..\_localization\%(CurrentUICultureHierarchy.Identity)\*.dll">
35+
<UICulture>%(CurrentUICultureHierarchy.Identity)</UICulture>
36+
</MSTestV2Files>
37+
<MSTestV2Files Include="$(MSBuildThisFileDirectory)*.dll">
38+
<UICulture>%(CurrentUICultureHierarchy.Identity)</UICulture>
39+
</MSTestV2Files>
3940
</ItemGroup>
4041

4142
<ItemGroup>
42-
<Content Include="@(MSTestV2Files->'%(RootDir)%(Directory)$(CurrentUICultureHierarchy)\%(FileName).resources.dll')"
43-
Condition="Exists('%(RootDir)%(Directory)$(CurrentUICultureHierarchy)\%(FileName).resources.dll')">
44-
<Link>$(CurrentUICultureHierarchy)\%(FileName).resources.dll</Link>
43+
<!-- Add the localization file as content so it gets copied from nuget to bin folder. -->
44+
<Content Include="@(MSTestV2Files->'%(FullPath)')">
45+
<Link>%(MSTestV2Files.UICulture)\%(FileName).dll</Link>
4546
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4647
<BaseAssemblyFullPath>%(FullPath)</BaseAssemblyFullPath>
4748
<Visible>False</Visible>

0 commit comments

Comments
 (0)