I work in WPF recently, and the query was presented to me, is it possible to translate the buttons of a MensageBox
according to the culture? Or just force the translation somehow?
For example,
public static bool AreYouSure(string text, string title)
{
var result = MessageBox.Show(text,
title,
MessageBoxButton.YesNo,
MessageBoxImage.Question);
return result == MessageBoxResult.Yes;
}
In this case, the message would be displayed with the Yes
and buttons No
, I would like to make them be Sí
andNo
Within the Microsoft documentation , I didn't find anything about it, is this possible without having to create my own implementation of MessageBox
?
Thank you!
The problem you have is that these default UIs take the one
Culture
fromThread
the application, which by default is theCulture
system one.You must modify the
Culture
delThread
of the application so that it translates it into the language you want:Or change the region of the team you're working with.