The Wayback Machine - https://web.archive.org/web/20220710052246/https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/issues/2318
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Informations in the DatePicker are half-translated #2318

Closed
Xaalek opened this issue May 6, 2021 · 6 comments
Closed

Informations in the DatePicker are half-translated #2318

Xaalek opened this issue May 6, 2021 · 6 comments
Labels

Comments

@Xaalek
Copy link
Member

@Xaalek Xaalek commented May 6, 2021

Hello,
As you can see on the screenshot below, the text in the datepicker is half-translated :
image
Blue area is translated. Red areas are not translated.

Here is the calendar of my computer in comparison :
image

A mix of multiple languages in the same panel is not great for the user experience.
I think we should consider writing everything in English or translating everything into the language of the computer.

@Keboo Keboo added the bug label May 6, 2021
@Keboo
Copy link
Member

@Keboo Keboo commented May 6, 2021

Agreed, this looks like a bug. We should be respecting the language that is specified in the current culture.

@woltek
Copy link

@woltek woltek commented Mar 16, 2022

Got the same thing,

Seems like Language.GetSpecificCulture() is not returning Current culture
use CultureInfo.CurrentCulture instead.

image

@Xaalek
Copy link
Member Author

@Xaalek Xaalek commented Apr 22, 2022

@woltek If we change this, we won't be able to manually define a culture on the DatePicker.

I found a way to change the default culture by the computer one.

We have to add this in the App.OnStartup() event

Thread.CurrentThread.CurrentCulture = CultureInfo.CurrentCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentCulture;
            FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(
                        XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

Moreover, it's commented in the demo app : https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/MainDemo.Wpf/App.xaml.cs#L20

So in the end I don't know if it's really a bug.

@Keboo Is this still a bug according to you?
If it is not a bug, I think we should add a section in the Getting Started guide or in the wiki that explains how to setup the culture info. Because until today, I had no idea that this feature existed
https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/wiki/Getting-Started

@Keboo
Copy link
Member

@Keboo Keboo commented Apr 23, 2022

I agree that the method documented in the demo app is what should be done to set the language of your app. This is because WPF does not follow the system language. See dotnet/wpf#1946

However, we have had bugs where it code was not respecting the current culture. As long as the calendar properly updates after setting the language, I would say this is not an issue.

@Xaalek
Copy link
Member Author

@Xaalek Xaalek commented Apr 23, 2022

Before saying that it is not a bug, we must test if when we put a different language of the computer, the information in blue is well translated in this language. I forgot to test this

@Xaalek
Copy link
Member Author

@Xaalek Xaalek commented Apr 27, 2022

@Keboo
I tried to put the application in English with CultureInfo("en-US") while my windows is in French. The DatePickers are well translated into English.
I also tried to use CultureInfo.CurrentCulture and the DatePickers are well translated into French.

So we can say that the problem is solved. We just need to write this information in the wiki so that other people know how to configure the language of an application that use MaterialDesignInXaml. It will also allow people to not think it's a bug whereas they just forgot a few lines of code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants