Description:
I'm using the DevExpress.XtraEditors.Controls.Localizer class to localize my editors. But I can't change month names in the date editor - I can only change the Today and Clear captions…
Answer:
Week and month names are taken from the system. They correspond to the current user locale. If you want your application to always be, for example, in Spanish, you can use the following code:
C#[STAThread]
static void Main()
{
Threading.Thread.CurrentThread.CurrentUICulture = new Globalization.CultureInfo("es-ES");
Application.Run(new Form1());
}
Visual Basic' the main form's constructor
Public Sub New()
MyBase.New()
Threading.Thread.CurrentThread.CurrentCulture = New Globalization.CultureInfo("es-ES")
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
See Also:
How to translate components via their Localizer objects
The collection of localized DevExpress assemblies
As far as I can see, the only way to set the dateedit's culture is to set the CurrentCulture to whatever I desire. My problem is that my CurrentCulture must stay as Invariant Culture and my CurrentUICulture set to whatever language user wants.
Is there a way to avoid this behavior?.
You can use different Culture and UICulture in the same application. The CurrentUICulture property determines the control's interface (E.g. "Clear" button translation in the DateEdit control ). The CurrentCulture property determines system localization (E.g. month names, currency format ).
Please refer to the following MSDN help topics for additional information:
CultureInfo.CurrentCulture Property (System.Globalization)
Thread.CurrentUICulture Property (System.Threading)