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 » Community » Newbie corner » Translation files
Translation files [message #54694] Tue, 01 September 2020 17:44 Go to next message
idkfa46 is currently offline  idkfa46
Messages: 147
Registered: December 2011
Experienced Member
Hi guys,
I was going to internationalize my tool and I had a look at the online documentation (https://www.ultimatepp.org/srcdoc$Core$i18n$en-us.html and https://www.ultimatepp.org/srcdoc$Core$Translating$en-us.htm l) but it's not clear for me if there is an easy way to generate the .t file that includes all T_() macros present in my package.

Is there a good example to look at in the Bazaar to set this feature?

Thanks,
Matteo
Re: Translation files [message #54695 is a reply to message #54694] Tue, 01 September 2020 19:13 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12716
Registered: November 2005
Ultimate Member
What you need to do is to add .t file to your package, then use "Project/Synchronize translation files...". TheIDE then scans through all packages and where it finds .t, scans all files for t_ texts. It would be probably wise at that point to uncheck all translation files that you do not want to update, leving just your .t file. Then there is Versions list - that one is editable. There you want to add all languages that you need. After pressing OK, TheIDE update all .t files that have check, adding empty definitions for all string/language combos that are not alredy defined.

Mirek
Re: Translation files [message #54706 is a reply to message #54695] Wed, 02 September 2020 11:03 Go to previous messageGo to next message
idkfa46 is currently offline  idkfa46
Messages: 147
Registered: December 2011
Experienced Member
Good news! I forgot to add the .t file before running the "Synchronize translation file" and my package was not included in the list!

Thanks,
Matteo
Re: Translation files [message #54716 is a reply to message #54706] Thu, 03 September 2020 16:27 Go to previous messageGo to next message
idkfa46 is currently offline  idkfa46
Messages: 147
Registered: December 2011
Experienced Member
Hi guys,
I'm here again... I made a test but I have a few problems changing the language setting inside the tool

I set the .t file that include (encoded UTF8)
#ifdef _MSC_VER
#pragma setlocale("C")
#endif

T_("Support")
itIT("Supporto")


I try to change the language with the function below:
void STDctrl::Language(void)
{
	MenuBar bar;	
	bar.MaxIconSize(Size(80,35)).LeftGap(85);
	bar.Add("Italiano", Images::Flag, THISBACK1(SetLang, 10));
	bar.Add("English", Images::Flag, THISBACK1(SetLang, 20));
	bar.Execute();
}

void STDctrl::SetLang(int i)
{
	switch(i) {
	case 10:
		SetLanguage(LNGC_('I','T','I','T', CHARSET_UNICODE));
		Refresh();
		break;
	case 20:
		SetLanguage(LNGC_('E','N','U','S', CHARSET_UNICODE));
		Refresh();
		break;
	default:
		SetLanguage(LNGC_('E','N','U','S', CHARSET_UNICODE));
		Refresh();
		break;
	}
}


and this:
GUI_APP_MAIN
{	
SetLanguage( GetSystemLNG());
}


When I open the software the "SetLanguage( GetSystemLNG())" function works and the tool display the italian translation "supporto" but if I try to call the function THISBACK1(SetLang, 10 or 20) nothing happen. Maybe I have to refresh something?

One more question, can I turn the default setting to italian and English as a second language with something like this?ù

T_("Supporto")
enUS("Support")


Thanks,
Matteo



Re: Translation files [message #54717 is a reply to message #54716] Thu, 03 September 2020 16:55 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12716
Registered: November 2005
Ultimate Member
idkfa46 wrote on Thu, 03 September 2020 16:27


When I open the software the "SetLanguage( GetSystemLNG())" function works and the tool display the italian translation "supporto" but if I try to call the function THISBACK1(SetLang, 10 or 20) nothing happen. Maybe I have to refresh something?



Changing language requires restart, sorry. It would have performance impact otherwise.

You might perhaps organize things so that the application restarts itself after changing the language.

Quote:

One more question, can I turn the default setting to italian and English as a second language with something like this?ù

T_("Supporto")
enUS("Support")



Not possible - there is no info in t_ about the language or even package, so one language has to be "reference" one.

We could certainly do that, but that would complicate the whole process.

Mirek
Re: Translation files [message #54721 is a reply to message #54717] Thu, 03 September 2020 17:37 Go to previous messageGo to next message
idkfa46 is currently offline  idkfa46
Messages: 147
Registered: December 2011
Experienced Member
mirek wrote on Thu, 03 September 2020 16:55


Changing language requires restart, sorry. It would have performance impact otherwise.

You might perhaps organize things so that the application restarts itself after changing the language.



So fare the only solution is:
- remove the SetLanguage( GetSystemLNG()) at the software start
- store the user setting somewhere
- read the user setting at the software re-start

Thanks, I'll try... Laughing
Matteo
Re: Translation files [message #54722 is a reply to message #54721] Thu, 03 September 2020 18:50 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12716
Registered: November 2005
Ultimate Member
idkfa46 wrote on Thu, 03 September 2020 17:37
mirek wrote on Thu, 03 September 2020 16:55


Changing language requires restart, sorry. It would have performance impact otherwise.

You might perhaps organize things so that the application restarts itself after changing the language.



So fare the only solution is:
- remove the SetLanguage( GetSystemLNG()) at the software start
- store the user setting somewhere
- read the user setting at the software re-start

Thanks, I'll try... Laughing
Matteo


Exactly!

Mirek
Re: Translation files [message #54865 is a reply to message #54694] Wed, 23 September 2020 11:22 Go to previous messageGo to next message
idkfa46 is currently offline  idkfa46
Messages: 147
Registered: December 2011
Experienced Member
It's working fine but when I import to my file.t accented characters the tool convert it as below:

T_("Stampa")
csCZ("Tisk")
enGB("Print")
esES("Impresi\303\263n")  -- ???? -- instead of esES("Impresión")
itIT("Stampa")


Why? If I close and open UPP again all come back to normality...

Thanks,
Matteo
Re: Translation files [message #54866 is a reply to message #54865] Wed, 23 September 2020 11:46 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12716
Registered: November 2005
Ultimate Member
idkfa46 wrote on Wed, 23 September 2020 11:22
It's working fine but when I import to my file.t accented characters the tool convert it as below:


Import how? I will check...

This is probably some remnant of workaround for problems with some compilers that were not allowing >128 chars in strings...
Re: Translation files [message #54869 is a reply to message #54866] Wed, 23 September 2020 14:18 Go to previous messageGo to next message
idkfa46 is currently offline  idkfa46
Messages: 147
Registered: December 2011
Experienced Member
mirek wrote on Wed, 23 September 2020 11:46
idkfa46 wrote on Wed, 23 September 2020 11:22
It's working fine but when I import to my file.t accented characters the tool convert it as below:


Import how? I will check...

This is probably some remnant of workaround for problems with some compilers that were not allowing >128 chars in strings...


I just copy and paste from notepad...

Matteo
Re: Translation files [message #54870 is a reply to message #54694] Wed, 23 September 2020 14:25 Go to previous messageGo to next message
idkfa46 is currently offline  idkfa46
Messages: 147
Registered: December 2011
Experienced Member


One more question... sometimes I find "// Obsolete" in my file.t

What does it mean?

Thanks,
Matteo
Re: Translation files [message #54871 is a reply to message #54870] Wed, 23 September 2020 16:08 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12716
Registered: November 2005
Ultimate Member
idkfa46 wrote on Wed, 23 September 2020 14:25


One more question... sometimes I find "// Obsolete" in my file.t

What does it mean?

Thanks,
Matteo


It means that the english string (like t_("text to translate")) is not in project anymore.
Re: Translation files [message #54872 is a reply to message #54869] Wed, 23 September 2020 16:22 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12716
Registered: November 2005
Ultimate Member
idkfa46 wrote on Wed, 23 September 2020 14:18
mirek wrote on Wed, 23 September 2020 11:46
idkfa46 wrote on Wed, 23 September 2020 11:22
It's working fine but when I import to my file.t accented characters the tool convert it as below:


Import how? I will check...

This is probably some remnant of workaround for problems with some compilers that were not allowing >128 chars in strings...


I just copy and paste from notepad...

Matteo


Cannot reproduce. What I have tried:

I have added test.t into some testing main package, added some t_("something"), did Project/Synchronize translation files.., added esES variant, then gone to test.t and copy&paste Impresión from here to test.t. Everything seems normal.

Where have I diverted from what you are doing?

Mirek
Re: Translation files [message #54874 is a reply to message #54872] Wed, 23 September 2020 16:38 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 704
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello Mirek,

I can reproduce it - just open .t file then switch to hex edit and then go to text view again. All special symbols are dispayed as \${value}.

Klugier


Ultimate++ - one framework to rule them all.

[Updated on: Wed, 23 September 2020 16:38]

Report message to a moderator

Re: Translation files [message #54875 is a reply to message #54874] Wed, 23 September 2020 17:11 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12716
Registered: November 2005
Ultimate Member
Klugier wrote on Wed, 23 September 2020 16:38
Hello Mirek,

I can reproduce it - just open .t file then switch to hex edit and then go to text view again. All special symbols are dispayed as \${value}.

Klugier


After further investigation, as weird as it sounds this is OK. I am sorry I have forgot this over years.

Thing is, the text really is stored on the disk with those \xxx values as workaround for visual c++ compiler, which otherwise complains. However to make everything readable and editable, this conversion for .t files normally happens on load / save.

Now if you press Ctrl+B and then Ctrl+T, the problem is that Ctrl+T is command that forces to display file exactly as it is on disk (e.g. layout file). You can switch this by just pressing Ctrl+T, without Ctrl+B...

So maybe a bit confusing, but harmless...

Mirek

Re: Translation files [message #54878 is a reply to message #54694] Wed, 23 September 2020 17:32 Go to previous messageGo to next message
idkfa46 is currently offline  idkfa46
Messages: 147
Registered: December 2011
Experienced Member

Got it, thanks!

Matteo
Re: Translation files [message #54900 is a reply to message #54875] Sun, 27 September 2020 00:15 Go to previous message
Klugier is currently offline  Klugier
Messages: 704
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello Mirek,

After today analyzing of ide tool bar. I came into conclusion that the designed behavior of handling translation file is as follow:
- text editing (it displays special numbers)
- designer mode (it displays symbols correctly without special numbers), however in UI it is treated as text mode... (second text mode with no UI representation...)

So, what we should do in this case is representing "designer" state for .t file (Right now it is interpreted as text and this is misleading for our users).

Take a look at this screenshot
index.php?t=getfile&id=6227&private=0

Matteo thanks for reporting.

Klugier


Ultimate++ - one framework to rule them all.

[Updated on: Sun, 27 September 2020 01:17]

Report message to a moderator

Previous Topic: sqlarray and sqlite
Next Topic: New system of feature requests on our forums- please read and use!
Goto Forum:
  


Current Time: Sun Sep 27 22:20:38 CEST 2020

Total time taken to generate the page: 0.02482 seconds