Home » Community » Newbie corner » Translation files
|
|
|
|
|
|
| Re: Translation files [message #54716 is a reply to message #54706] |
Thu, 03 September 2020 16:27   |
idkfa46
Messages: 155 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 #54874 is a reply to message #54872] |
Wed, 23 September 2020 16:38   |
 |
Klugier
Messages: 1117 Registered: September 2012 Location: Poland, Kraków
|
Senior 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
U++ - 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   |
 |
mirek
Messages: 14290 Registered: November 2005
|
Ultimate Member |
|
|
Klugier wrote on Wed, 23 September 2020 16:38Hello 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 #54900 is a reply to message #54875] |
Sun, 27 September 2020 00:15   |
 |
Klugier
Messages: 1117 Registered: September 2012 Location: Poland, Kraków
|
Senior 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

Matteo thanks for reporting.
Klugier
U++ - one framework to rule them all.
[Updated on: Sun, 27 September 2020 01:17] Report message to a moderator
|
|
|
|
| Re: Translation files [message #54941 is a reply to message #54694] |
Wed, 30 September 2020 12:31   |
idkfa46
Messages: 155 Registered: December 2011
|
Experienced Member |
|
|
I'm here again! The tranlsation mode works very well but I'm in trouble with my database...
When I change the language the t_() content inside the db do not change and I have a few queries that fail!
here is an example:
void Impostazioni::ResetDbCoefCombinaz()
{
SQL & Delete(COEFCOMBIN);
int i=0;
Progress p(t_("Creating database: coefficienti di combinazione..."));
try
{
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Carichi permanenti"))(PSI0j,0)(PSI1j,0)(PSI2j,0); p.SetPos(++i);
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Carichi permanenti NON strutturali"))(PSI0j,0)(PSI1j,0)(PSI2j,0); p.SetPos(++i);
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Categoria A Ambienti ad uso residenziale"))(PSI0j,0.70)(PSI1j,0.50)(PSI2j,0.30); p.SetPos(++i);
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Categoria B Uffici"))(PSI0j,0.70)(PSI1j,0.50)(PSI2j,0.30); p.SetPos(++i);
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Categoria C Ambienti suscettibili di affollamento"))(PSI0j,0.70)(PSI1j,0.70)(PSI2j,0.60); p.SetPos(++i);
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Categoria D Ambienti ad uso commerciale"))(PSI0j,0.70)(PSI1j,0.70)(PSI2j,0.60); p.SetPos(++i);
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Categoria E Biblioteche, archivi, magazzini e ambienti ad uso industriale"))(PSI0j,1.00)(PSI1j,0.90)(PSI2j,0.80); p.SetPos(++i);
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Categoria F Rimesse e parcheggi (per autoveicoli di peso <= 30 kN)"))(PSI0j,0.70)(PSI1j,0.70)(PSI2j,0.60); p.SetPos(++i);
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Categoria G Rimesse e parcheggi (per autoveicoli di peso > 30 kN)"))(PSI0j,0.70)(PSI1j,0.50)(PSI2j,0.30); p.SetPos(++i);
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Categoria H Coperture"))(PSI0j,0.00)(PSI1j,0.00)(PSI2j,0.00); p.SetPos(++i);
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Vento"))(PSI0j,0.60)(PSI1j,0.20)(PSI2j,0.00); p.SetPos(++i);
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Neve (a quota <= 1000 m s.l.m.)"))(PSI0j,0.50)(PSI1j,0.20)(PSI2j,0.00); p.SetPos(++i);
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Neve (a quota > 1000 m s.l.m.)"))(PSI0j,0.70)(PSI1j,0.50)(PSI2j,0.20); p.SetPos(++i);
SQL & Insert(COEFCOMBIN)(CATEGORIA,t_("Variazioni termiche"))(PSI0j,0.60)(PSI1j,0.50)(PSI2j,0.00); p.SetPos(++i);
}
catch(SqlExc &e)
{
Exclamation("[* " + DeQtfLf(e) + "]");
}
}
double Impostazioni::GetPsi0j(String s)
{
SQL * Select(PSI0j).From(COEFCOMBIN).Where(CATEGORIA == s); return SQL[PSI0j];
}
Is there any trick to solve it or to force the language update?
Thanks,
Matteo
|
|
|
|
|
|
|
|
|
|
| Re: Translation files [message #54978 is a reply to message #54968] |
Sat, 03 October 2020 04:38   |
 |
mirek
Messages: 14290 Registered: November 2005
|
Ultimate Member |
|
|
idkfa46 wrote on Fri, 02 October 2020 12:04Ciao Mirek,
thank your for your feedback. I try to better explaining the situation...
1 - At the moment I have a database that contain text in a t_() macro and at the first run the database is create with the user language
I guess you might got this a bit wrong, perhaps you see a magic in t_ that is not there.. All that t_ does is that it might return different string literal. So your database contains texts, period.
Quote:
Is there a trick to force database translation update?
I have to read and update it row by row? In that case is it possible to read the database text with a Select * and Update the translation without going throught the T_("") language with something like this?
Basically, yes.
Maybe you can delete the whole table content and insert new values?
All that said, this design, depending on translation, feels pretty awful. What about defining some integer constants instead of texts?
Alternatively, what about having these texts in DB in english and do the eventual translation in the application?
Mirek
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Apr 25 14:09:08 GMT+2 2026
Total time taken to generate the page: 0.00777 seconds
|