question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to change the language of the controls?

See original GitHub issue

Hi, I could not find anywhere on code/issues how I can change the display language.

For example, In my case I have these: image

I want to change these to chinese also so instead of “On” will be written chinese word of “On”

I tried to guess it. According to your source code here: https://github.com/Kinnara/ModernWpf/blob/a23d5bcc6e8c857161f7c7dfe6b3d18d548259fe/test/ModernWpfTestApp/App.xaml.cs#L37

I tried to guess and did this:

MainWindow.Language = XmlLanguage.GetLanguage("zh-cn");

But it did not woked

Any idea how to do it? And I want to do it at runtime.

Thanks.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
luojunyuancommented, Apr 8, 2021

try Thread.CurrentThread.CurrentCulture.ToString() to see which culture info you are.

public partial class App : Application
{
    public App()
    {
        Language.Strings.Culture = Thread.CurrentThread.CurrentCulture.ToString() switch
        {
            "zh-CN" => new System.Globalization.CultureInfo("zh-Hans"),
            "zh-Hans" => new System.Globalization.CultureInfo("zh-Hans"),
            _ => new System.Globalization.CultureInfo(""),
        };
    }
}

This work for me. The Language is my localization project, “zh-Hans” is the resource tag. image

make sure your target culture info like “zh-Hans”, is also included in the build folder. there will be a folder called zh-hans/ with a ModernWpf.Controls.resources.dll file in it.

0reactions
gileli121commented, Apr 17, 2021

.NET Core requires the user to install more 130-150 MB I will never understand why I need this

Read more comments on GitHub >

github_iconTop Results From Across the Web

Switch between languages using the Language bar
Press the Windows logo key and type Control to search for the Control Panel app. · Click Control Panel. · Under Clock, Language,...
Read more >
How to Change the Language in Windows
Open the Control Panel. · Click the Clock, Language, and Region option. · Click the Change the display language link. · In the...
Read more >
How to change keyboard language in Windows
Click Start and then Control Panel ; In Control Panel, if you are in Category View, click on Switch to Classic View (top...
Read more >
Change your language or use multiple languages - Android
Set your language · On your Android phone or tablet, open the Wear OS app. · Under "Settings," tap Google Assistant and then...
Read more >
Change your display language on Google - Android
Open the Google app Google Search . · At the top right, tap your Profile icon. · Tap Settings Settings and then Language...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found