one UI language, another internal Topic is solved

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
mael15
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 539
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

one UI language, another internal

Post by mael15 »

Hi everyone,
my program creates pdfs and shows a preview with a certain language. Now I want to change the UI langauge of my program without changing the pdf language.
In other words: How can I have the user chose between English, Spanish and German for the program and independently for the pdf preview?
One language works just fine with wxTranslationHelper which uses wxLocale, but two at the same time?
thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: one UI language, another internal

Post by doublemax »

Can't you just create another instance of wxTranslations that you manage yourself?

http://docs.wxwidgets.org/trunk/classwx ... tions.html
Use the source, Luke!
mael15
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 539
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

Re: one UI language, another internal

Post by mael15 »

Thanx, might there be a problem with:
Only one wxTranslations instance is active at a time
??
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: one UI language, another internal

Post by doublemax »

mael15 wrote:Thanx, might there be a problem with:
Only one wxTranslations instance is active at a time
??
I've never tried it, but i think you can still have another instance that you don't mark as active with Set(). You'll just have to call wxTranslations::GetTranslatedString() manually for each string you want to translate.
Use the source, Luke!
mael15
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 539
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

Re: one UI language, another internal

Post by mael15 »

I have a follow up question:
After I changed the language setting, is there a way to "refresh" i.e. the label of a button without having to use SetLabel(newLanguageLabel)? I have a lot of controls and am facing a lot of work either recreating the controls or calling SetLabel or similar functions hundreds of times.
I could just restart the programme or the tell the user to do it, but I find it better to change it on the fly.
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: one UI language, another internal

Post by doublemax »

After I changed the language setting, is there a way to "refresh" i.e. the label of a button without having to use SetLabel(newLanguageLabel)?
No. As you said, you either have to iterate over all controls or restart the application.

I personally chose the second option in my programs, because switching the GUI language doesn't happen often and switching it on the fly is just not worth the effort.
Use the source, Luke!
mael15
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 539
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

Re: one UI language, another internal

Post by mael15 »

doublemax wrote:switching it on the fly is just not worth the effort
That´s what I thought and I also found a post by you that shows how to restart the application, thank you!
Post Reply