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.
-
Nucleorion
- Knows some wx things

- Posts: 45
- Joined: Sat Jan 07, 2017 10:08 pm
Post
by Nucleorion » Thu Mar 16, 2017 6:36 pm
I also try:
Code: Select all
m_locale.Init(wxLANGUAGE_ENGLISH, wxLOCALE_CONV_ENCODING); //wxLOCALE_CONV_ENCODING Deprecated
wxLocale::AddCatalogLookupPathPrefix(wxT(".\\langs"));
m_locale.AddCatalog(wxT("es_ES"));
But it does not work either
-
doublemax
- Moderator

- Posts: 15506
- Joined: Fri Apr 21, 2006 8:03 pm
- Location: $FCE2
Post
by doublemax » Thu Mar 16, 2017 7:39 pm
Try a tool like Procmon and check in which paths the executable is looking for the translation files.
I use my own translation solution for my own texts, but for the wxWidgets translation files, i had to put them in this path:
Use the source, Luke!
-
Nucleorion
- Knows some wx things

- Posts: 45
- Joined: Sat Jan 07, 2017 10:08 pm
Post
by Nucleorion » Fri Mar 17, 2017 9:50 am
Procmon = Process monitor?
I get this:

-
PB
- Part Of The Furniture

- Posts: 2781
- Joined: Sun Jan 03, 2010 5:45 pm
Post
by PB » Fri Mar 17, 2017 11:19 am
You may also check the output of the i18 debug trace, which shows the looked-up paths and files, as described here
viewtopic.php?f=1&t=42414#p171997
-
eranon
- Can't get richer than this

- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
-
Contact:
Post
by eranon » Fri Mar 17, 2017 8:28 pm
Hello,
In my own codes, I manage location of the language catalogs like this:
Code: Select all
#ifdef __WXMSW__
#ifdef _DEBUG
m_strLangsBase = ::NormalizePathSep(wxPathOnly(argv[0]) + "/../../lang");
#else
m_strLangsBase = ::NormalizePathSep(wxPathOnly(argv[0]) + "/lang");
#endif
#endif // __WXMSW__
#ifdef __WXOSX__
m_strLangsBase = ::NormalizePathSep(wxPathOnly(argv[0]) + "/../Resources");
#endif // __WXOSX__
Also, just an added info on a secondary point : as stated at
http://docs.wxwidgets.org/trunk/group__ ... 96ec864160, I quote:
Note that since wxWidgets 2.9.0 you shouldn't use wxT() anymore in your program sources (it was previously required if you wanted to support Unicode).
It's now implicit.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
-
Nucleorion
- Knows some wx things

- Posts: 45
- Joined: Sat Jan 07, 2017 10:08 pm
Post
by Nucleorion » Mon Apr 24, 2017 8:53 am
I keep trying
I have made sure that the files are on the path but it still does not work
It would be ideal to find a turorial updated and explained in detail. I really do not understand how with the work that it costs to make these tools then there is hardly official documentation
About the routes it can not find I do not understand why you ask for them. Nowhere have I seen that I have to create anything in a folder called LC_MESSAGES as well as many others
-
eranon
- Can't get richer than this

- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
-
Contact:
Post
by eranon » Mon Apr 24, 2017 10:17 am
If you don't succeed with a relative path, go back to a known point and use an absolute harcoded one in your code for the moment. When all will be OK, you'll just have to fix this single point (since hardcoded absolute path is obviously not a good idea for your final release).
And to check if a file exists, you simply have wxFileExists() in stock.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
-
doublemax
- Moderator

- Posts: 15506
- Joined: Fri Apr 21, 2006 8:03 pm
- Location: $FCE2
Post
by doublemax » Mon Apr 24, 2017 10:48 am
The ProcessMonitor output looks to me like the "es_ES" catalog is found. How do you check if it was successful?
Use the source, Luke!
-
Nucleorion
- Knows some wx things

- Posts: 45
- Joined: Sat Jan 07, 2017 10:08 pm
Post
by Nucleorion » Fri Apr 28, 2017 8:23 am
eranon wrote:If you don't succeed with a relative path, go back to a known point and use an absolute harcoded one in your code for the moment. When all will be OK, you'll just have to fix this single point (since hardcoded absolute path is obviously not a good idea for your final release).
And to check if a file exists, you simply have wxFileExists() in stock.
How I use an absolute harcoded one?
How use wxFileExists() in this. I can't use for example
Code: Select all
wxFileExists(m_locale.AddCatalog(wxT("es_ES")))
doublemax wrote:The ProcessMonitor output looks to me like the "es_ES" catalog is found. How do you check if it was successful?
I don't understand doublemax. I don't know how check it. ProcessMonitor says some routes found and others not. What path are the right? All?
-
Nucleorion
- Knows some wx things

- Posts: 45
- Joined: Sat Jan 07, 2017 10:08 pm
Post
by Nucleorion » Fri Apr 28, 2017 9:34 am
Whell, first error:
Code: Select all
m_locale.Init(wxLANGUAGE_SPANISH);//Init to the spanish
wxLocale::AddCatalogLookupPathPrefix(wxT(".\\langs"));//add path
m_locale.AddCatalog( wxT ("es"));//add catalog wxWidgetspath/locale/es.mo
m_locale.AddCatalog(wxT("es_ES"));//add my .mo edit files
Move this lines before //(*AppInitialize
So
Code: Select all
m_locale.Init(wxLANGUAGE_SPANISH);//Init to the spanish
wxLocale::AddCatalogLookupPathPrefix(wxT(".\\langs"));//add path
m_locale.AddCatalog( wxT ("es"));//add catalog wxWidgetspath/locale/es.mo
m_locale.AddCatalog(wxT("es_ES"));//add my .mo edit files
//(*AppInitialize
bool wxsOK = true;
wxInitAllImageHandlers();
if ( wxsOK )
{
MultilingualExampleFrame* Frame = new MultilingualExampleFrame(0);
Frame->Show();
SetTopWindow(Frame);
}
//*)
Now load the default language right. The path is: lang\es_ES\es_ES.mo
-
Nucleorion
- Knows some wx things

- Posts: 45
- Joined: Sat Jan 07, 2017 10:08 pm
Post
by Nucleorion » Fri Apr 28, 2017 9:44 am
For change language into to program I have a menu to set language.
Code: Select all
void MultilingualExampleFrame::OnMenu_Language_Spanish_Selected(wxCommandEvent& event)
{
wxLocale* locale;
long language=wxLANGUAGE_SPANISH;
locale = new wxLocale( language );
locale->AddCatalogLookupPathPrefix(wxT(".\\langs\\es_ES"));
locale->AddCatalog( wxT ("es_ES.po"));
}
This change texts of parents windows but no in the main frame; menus, form, etc.
How I can set language in runtime?
-
doublemax
- Moderator

- Posts: 15506
- Joined: Fri Apr 21, 2006 8:03 pm
- Location: $FCE2
Post
by doublemax » Fri Apr 28, 2017 11:53 am
How I can set language in runtime?
You can't - at least not with little effort. Store the new language, tell the user the app needs a restart and restart. As this doesn't happen often, i think it's an acceptable compromise.
Use the source, Luke!
-
Nucleorion
- Knows some wx things

- Posts: 45
- Joined: Sat Jan 07, 2017 10:08 pm
Post
by Nucleorion » Fri Apr 28, 2017 4:01 pm
Ok. Thanks Mate

-
ONEEYEMAN
- Part Of The Furniture

- Posts: 4709
- Joined: Sat Apr 16, 2005 7:22 am
- Location: USA, Ukraine
Post
by ONEEYEMAN » Fri Apr 28, 2017 8:24 pm
Also keep in mind that sometimes additional software might be required to properly display international symbols.
Or just a properly generated locale on the system.
Thank you.