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: 67
Joined: Thu Jul 07, 2005 4:35 pm

Localize application - wxLocale in every Frame and Dialog

Post by Morfio » Wed Jan 21, 2009 10:26 am

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
Moderator
Moderator
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 » Wed Jan 21, 2009 12:45 pm

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: 1189
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex » Wed Jan 21, 2009 12:49 pm


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

Post by Auria » Wed Jan 21, 2009 9:33 pm


Post Reply