waf / CSharpRepl

A command line C# REPL with syntax highlighting – explore the language, libraries and nuget packages interactively.
https://fuqua.io/CSharpRepl/
Mozilla Public License 2.0
2.92k stars 113 forks source link

Set default culture for compile error messages #324

Closed waf closed 11 months ago

waf commented 11 months ago

Ensure that if the user has their "UI Culture" set to a language, we use that language for compiler error messages (emitted by CSharpScript).

We don't actually have any API for doing this with roslyn that I could find. Instead, through trial and error, by setting CultureInfo.DefaultThreadCurrentCulture to the UI Culture, we can get CSharpScript to emit errors in the language of the UI culture.

Note that setting CultureInfo.DefaultThreadCurrentUICulture didn't fix it; it needs to be CultureInfo.DefaultThreadCurrentCulture.

Closes #312.

codecov[bot] commented 11 months ago

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (884985f) 77.4% compared to head (081c7fa) 77.5%.

Files Patch % Lines
CSharpRepl/Program.cs 50.0% 5 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #324 +/- ## ===================================== Coverage 77.4% 77.5% ===================================== Files 83 83 Lines 5597 5597 Branches 735 735 ===================================== + Hits 4337 4342 +5 + Misses 992 987 -5 Partials 268 268 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.