Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Libraries and TheIDE: i18n, Unicode and Internationalization » How can I translate the controls for my app?
How can I translate the controls for my app? [message #34398] Sun, 20 November 2011 16:27 Go to next message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
Hi!

I like Upp, but one feature I miss (or I don't know how to use) is to translate the controls.

For example:
I want to translate the Report Dialog to say "Print" in my native language, I want the calendar control to say "November" in my language to, and I want the EditDate to show dates in non-US format like say 20/11/2011 instead of 11/20/2011.

Any help is welcome!

Thanks
Re: How can I translate the controls for my app? [message #34400 is a reply to message #34398] Sun, 20 November 2011 16:35 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Use
Format("%`",vardate);

And see:
http://www.ultimatepp.org/src$Core$Format$en-us.html


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: How can I translate the controls for my app? [message #34401 is a reply to message #34398] Sun, 20 November 2011 17:25 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

lectus wrote on Sun, 20 November 2011 16:27

Hi!

I like Upp, but one feature I miss (or I don't know how to use) is to translate the controls.

For example:
I want to translate the Report Dialog to say "Print" in my native language, I want the calendar control to say "November" in my language to, and I want the EditDate to show dates in non-US format like say 20/11/2011 instead of 11/20/2011.

Any help is welcome!

Thanks

Hi lectus,

The feature is definitely there Wink In best case all you have to do is to call SetLanguage somewhere before the GUI is initialized (best at the beginning of main) e.g. for cs-cz:
GUI_APP_MAIN {
    SetLanguage(LNG_('C','S','C','Z'));
    MyApp().Run();
}

After this all the strings in GUI (at least those generated using layouts, for in-code strings use t_() macro to mark them for translation) for which the translations are available will be translated.

In case your language is not translated yet, nothing will happen and the strings will remain English. In such case please have a look at Project > Synchronize translation files to confirm it is not listed there. It is very easy to provide translation to new language (well, apart from the actual translating - that can be tedious Smile ), have a look here to see how to do it.

Best regards,
Honza
Re: How can I translate the controls for my app? [message #34403 is a reply to message #34400] Sun, 20 November 2011 17:27 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Lectus

You can also check this about internationalization and use the functions SetDateFormat() and SetDateScan() here.


Best regards
Iñaki
Re: How can I translate the controls for my app? [message #34428 is a reply to message #34398] Tue, 22 November 2011 02:49 Go to previous messageGo to next message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
Hi!
I managed to translate my own strings in my app.
But for example, when I right-click an ArrayCtrl it's still "Insert row". How can I translate this?
Re: How can I translate the controls for my app? [message #34430 is a reply to message #34428] Tue, 22 November 2011 11:14 Go to previous messageGo to next message
unknown user
Hi Freddy,

I don't know which is your language, but you may translate U++ if you want to any language (if not translated yet). Follow instructions from Translating U++ page.

Best regards,
Andrei
Re: How can I translate the controls for my app? [message #36637 is a reply to message #34398] Fri, 22 June 2012 16:31 Go to previous messageGo to next message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
Hi!
So, I submitted the pt_br translation file. Looks like it got added.

First of all, I got the date to work with:
SetDateFormat("%3:02d/%2:02d/%1:4d");
SetDateScan("dmy");

And it displays they way I want it.

As for translation I tried:
SetLanguage(LNG_('P','T','B','R'));


And looks like U++ attempts to translate it, but I get a weird looking translation:
http://i.imgur.com/Nc3Ti.png

Any ideas?

Re: How can I translate the controls for my app? [message #36640 is a reply to message #36637] Fri, 22 June 2012 23:47 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Lectus

There are some problems in your ptBR translation:

- In the month translations you add "date". See some of the translations:
T_("date\vMay")
caES("Maig")
csCZ("Kv\304\233ten")
deDE("Mai")
esES("Mayo")
fiFI("Toukokuu")
frFR("Mai")
huHU("M\303\241jus")
itIT("Maggio")
nlNL("Mei")
plPL("Maj")
ptBR("date\vMaio")

Here you can see the explanation of some special cases: "context keys consist of context and en-US text separated by \v, where both are parts of key. Example: t_("align\vTop"). This is useful in cases when context is needed to provide translation."

- Week is not translated:
T_("Wk")
caES("Sem")
csCZ("Tý")
deDE("Wo.")
esES("Sem")
fiFI("Vko")
frFR("Wk")
huHU("H")
itIT("Sett")
nlNL("Wk")
plPL("Ty.")
ptBR("Wk")



Best regards
Iñaki
Re: How can I translate the controls for my app? [message #36642 is a reply to message #34398] Sat, 23 June 2012 03:52 Go to previous messageGo to next message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
Thanks Koldo!

I was able to fix the bugs following your instructions: http://www.ultimatepp.org/forum/index.php?t=msg&goto=366 41&#msg_36641

Now the calendar displays properly.
Re: How can I translate the controls for my app? [message #36646 is a reply to message #36642] Sat, 23 June 2012 18:03 Go to previous message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Perfect Smile

Best regards
Iñaki
Previous Topic: Ctrl responds to Language-Setting event?
Next Topic: Date format for zhCN
Goto Forum:
  


Current Time: Fri Mar 29 00:33:47 CET 2024

Total time taken to generate the page: 0.02006 seconds