AddCatalog fails for a dll loaded dynamically.

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
karanshah
In need of some credit
In need of some credit
Posts: 7
Joined: Tue Dec 02, 2014 6:54 am

AddCatalog fails for a dll loaded dynamically.

Post by karanshah »

Hi All,

I am using wx-widgets 3.0.
I have an app that uses embedded localization. I am using the call wxTranslations::Get()->SetLoader(new wxResourceTranslationsLoader);. This will take the definition from the resource file and strings get translated. This app of mine loads a dll dynamically. I tried embedded localization for the dll too but it fails. So I tried loading the mo files from a local path. But when I call AddCatalog, it returns false.

Here is my code.

void InitializeCatalog()
{
wxLocale pLocale;// = wxGetLocale();
pLocale.Init(wxLANGUAGE_FRENCH);


if (false == pLocale.IsLoaded(wxT("ProfileSelector")))
{

#if defined(__WXMSW__)
pLocale.AddCatalogLookupPathPrefix(::wxPathOnly(wxStandardPaths::Get().GetExecutablePath()) + "\\Resources\\CPSDlls");
#elif defined(__WXMAC__)
pLocale.AddCatalogLookupPathPrefix(wxT("/Applications/Fiery/Color Profiler Suite 4/lib/ProfileSelector.bundle/Contents/Resources"));
#endif


bool b = pLocale.AddCatalog(wxT("Common"));
b = pLocale.AddCatalog(wxT("ProfileSelector"));
b = pLocale.AddCatalog(wxT("DiscoveryUI"));

}
}

Actually my parent app that loads the dll already adds "Common" and "DiscoveryUI" to the memory. Hence in the code above AddCatalog(wxT("Common")); returns true and AddCatalog(wxT("DiscoveryUI")); returns true but AddCatalog(wxT("ProfileSelector")); returns false.

If I set the locale to English_US, it adds the catalog for Profile Selector also and returns true. My mo files are present in the location mentioned in the code.

Could you let me know if I am missing something ?

Thanks,
Karan
jgrzybowski
Earned some good credits
Earned some good credits
Posts: 113
Joined: Sat Sep 24, 2011 9:32 pm
Location: Poland

Re: AddCatalog fails for a dll loaded dynamically.

Post by jgrzybowski »

In help I have read the following example for non-english:

Code: Select all

locale.AddCatalog(wxT("myapp"), wxLANGUAGE_GERMAN, wxT("iso-8859-1"));
More info you can find here:
http://docs.wxwidgets.org/trunk/overvie ... glish.html
I hope it would be helpful, I have never used wxLocale. For future I can advise you to write posts on this subforum: C++ Development. Threre you should have more answers, because this subform is for wxDevC++ users.
Regards, Jarek
Post Reply