Skip to content

Commit 5a06292

Browse files
committed
Dont look for vslang because vs can manage the lang settings itself already and also fix a test to use en because bild machines are apparently in french sometimes???
1 parent 9b1c074 commit 5a06292

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

src/MSBuild.UnitTests/XMake_Tests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,9 @@ public void TestEnvironmentTest()
838838
[Fact]
839839
public void MSBuildEngineLogger()
840840
{
841+
using TestEnvironment testEnvironment = TestEnvironment.Create();
842+
testEnvironment.SetEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en"); // build machines may have other values.
843+
841844
string oldValueForMSBuildLoadMicrosoftTargetsReadOnly = Environment.GetEnvironmentVariable("MSBuildLoadMicrosoftTargetsReadOnly");
842845
string projectString =
843846
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +

src/MSBuild/XMake.cs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,13 +1678,15 @@ internal static void SetConsoleUI()
16781678
}
16791679

16801680
/// <summary>
1681-
/// The .NET SDK and Visual Studio both have environment variables that set a custom language. MSBuild should respect those variables.
1681+
/// The .NET SDK and Visual Studio both have environment variables that set a custom language. MSBuild should respect the SDK variable.
16821682
/// To use the correspoding UI culture, in certain cases the console encoding must be changed. This function will change the encoding in these cases.
16831683
/// This code introduces a breaking change due to the encoding of the console being changed.
16841684
/// If the environment variables are undefined, this function should be a no-op.
16851685
/// </summary>
1686-
/// <returns>The custom language that was set by the user for an 'external' tool besides MSBuild.
1687-
/// DOTNET_CLI_UI_LANGUAGE > VSLANG. Returns <see langword="null"/> if none are set.</returns>
1686+
/// <returns>
1687+
/// The custom language that was set by the user for an 'external' tool besides MSBuild.
1688+
/// Returns <see langword="null"/> if none are set.
1689+
/// </returns>
16881690
private static CultureInfo GetExternalOverridenUILanguageIfSupportableWithEncoding()
16891691
{
16901692
CultureInfo externalLanguageSetting = GetExternalOverriddenUILanguage();
@@ -1736,12 +1738,12 @@ private static bool ForceUniversalEncodingOptInEnabled()
17361738
}
17371739

17381740
/// <summary>
1739-
/// Look at UI language overrides that can be set by known external invokers. (DOTNET_CLI_UI_LANGUAGE and VSLANG).
1741+
/// Look at UI language overrides that can be set by known external invokers. (DOTNET_CLI_UI_LANGUAGE.)
17401742
/// Does NOT check System Locale or OS Display Language.
17411743
/// Ported from the .NET SDK: https://github.com/dotnet/sdk/blob/bcea1face15458814b8e53e8785b52ba464f6538/src/Cli/Microsoft.DotNet.Cli.Utils/UILanguageOverride.cs
17421744
/// </summary>
17431745
/// <returns>The custom language that was set by the user for an 'external' tool besides MSBuild.
1744-
/// DOTNET_CLI_UI_LANGUAGE > VSLANG. Returns null if none are set.</returns>
1746+
/// Returns null if none are set.</returns>
17451747
private static CultureInfo GetExternalOverriddenUILanguage()
17461748
{
17471749
// DOTNET_CLI_UI_LANGUAGE=<culture name> is the main way for users to customize the CLI's UI language via the .NET SDK.
@@ -1755,18 +1757,6 @@ private static CultureInfo GetExternalOverriddenUILanguage()
17551757
catch (CultureNotFoundException) { }
17561758
}
17571759

1758-
// VSLANG=<lcid> is set by Visual Studio.
1759-
string vsLang = Environment.GetEnvironmentVariable("VSLANG");
1760-
if (vsLang != null && int.TryParse(vsLang, out int vsLcid))
1761-
{
1762-
try
1763-
{
1764-
return new CultureInfo(vsLcid);
1765-
}
1766-
catch (ArgumentOutOfRangeException) { }
1767-
catch (CultureNotFoundException) { }
1768-
}
1769-
17701760
return null;
17711761
}
17721762

0 commit comments

Comments
 (0)