Localize application - wxLocale in every Frame and Dialog

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
Morfio
Experienced Solver
Experienced Solver
Posts: 70
Joined: Thu Jul 07, 2005 4:35 pm

Localize application - wxLocale in every Frame and Dialog

Post by Morfio »

Hi,

I want to translate my application. I thought I use wxLocale and add my catalog. In the main dialog it works perfectly, but in the children of the dialog all strings are in default english. Have I to add wxLocale (and the catalogs) to every subwindow in my program or is it possible to do this in a global way?

Thank you very much,

Morfio
tan
wxWorld Domination!
wxWorld Domination!
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Re: Localize application - wxLocale in every Frame and Dialo

Post by tan »

Hi,
Morfio wrote:Hi,

I want to translate my application. I thought I use wxLocale and add my catalog. In the main dialog it works perfectly, but in the children of the dialog all strings are in default english. Have I to add wxLocale (and the catalogs) to every subwindow in my program or is it possible to do this in a global way?
usually it becomes on wxApp level. OnOnit method is the best place for it.
Anything like this:

Code: Select all

bool MyApp::OnInit()
{
// Some Init
    ...
// Set locale
    int sys_lang = wxLocale::GetSystemLanguage();
    if( sys_lang != wxLANGUAGE_DEFAULT )
    {
	m_locale.Init(sys_lang);			// set custom locale
	m_locale.AddCatalogLookupPathPrefix("locale");	// set "locale" prefix
	m_locale.AddCatalog("maycatalog");      		// our private domain
	m_locale.AddCatalog("wxstd");      		// wx common domain is default
        ...
    }
    ...
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
User avatar
T-Rex
Moderator
Moderator
Posts: 1249
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex »

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

Post Reply