Skip to content

Commit c36eda5

Browse files
authored
Fix dotnet fsi does not support DOTNET_CLI_UI_LANGUAGE (#40302)
1 parent c300827 commit c36eda5

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/Cli/Microsoft.DotNet.Cli.Utils/UILanguageOverride.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private static void FlowOverrideToChildProcesses(CultureInfo language)
5454
/// </summary>
5555
/// <returns>The custom language that was set by the user.
5656
/// DOTNET_CLI_UI_LANGUAGE > VSLANG. Returns null if none are set.</returns>
57-
private static CultureInfo GetOverriddenUILanguage()
57+
public static CultureInfo GetOverriddenUILanguage()
5858
{
5959
// DOTNET_CLI_UI_LANGUAGE=<culture name> is the main way for users to customize the CLI's UI language.
6060
string dotnetCliLanguage = Environment.GetEnvironmentVariable(DOTNET_CLI_UI_LANGUAGE);

src/Cli/dotnet/commands/dotnet-fsi/FsiForwardingApp.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Globalization;
5+
using Microsoft.DotNet.Cli.Utils;
6+
47
namespace Microsoft.DotNet.Cli
58
{
69
public class FsiForwardingApp : ForwardingApp
710
{
811
private const string FsiDllName = @"FSharp/fsi.dll";
912
private const string FsiExeName = @"FSharp/fsi.exe";
1013

11-
public FsiForwardingApp(string[] arguments) : base(GetFsiAppPath(), arguments)
14+
static string[] processArguments(string[] args)
15+
{
16+
var lang = UILanguageOverride.GetOverriddenUILanguage();
17+
if (lang == null)
18+
{
19+
return args;
20+
}
21+
else
22+
{
23+
return args.Append($"--preferreduilang:{lang.Name}").ToArray();
24+
}
25+
}
26+
public FsiForwardingApp(string[] arguments) : base(GetFsiAppPath(), processArguments(arguments))
1227
{
1328
}
1429

0 commit comments

Comments
 (0)