How do I use wxLocale without changing window direction?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
ET3D
Knows some wx things
Knows some wx things
Posts: 32
Joined: Wed Nov 09, 2011 7:09 am

How do I use wxLocale without changing window direction?

Post by ET3D »

I'm trying to use wxLocale, just with the defaults, so the system's locale is used. I need that mainly for number formatting.

The problem is, if the program runs on a Hebrew locale the window controls are switched right to left and the menu appears on the right. I don't want this to happen, I just want numbers to be formatted correctly. How can I control this?

(Running on Windows 7, by the way. I'm not sure if this problem is Windows specific or not.)
ET3D
Knows some wx things
Knows some wx things
Posts: 32
Joined: Wed Nov 09, 2011 7:09 am

Re: How do I use wxLocale without changing window direction?

Post by ET3D »

What I ended up doing is:

Code: Select all

	const wxLanguageInfo * locale = wxLocale::GetLanguageInfo(wxLocale::GetSystemLanguage());
	wxLanguageInfo localeL2R = *locale;
	localeL2R.Language = wxLANGUAGE_USER_DEFINED;
	localeL2R.LayoutDirection = wxLayout_LeftToRight;
	wxLocale::AddLanguage(localeL2R);
	m_locale.Init(wxLANGUAGE_USER_DEFINED);
Seems to work. If there's any simpler (or more correct) way to do it, let me know.
Post Reply