|
|
Home » U++ Library support » U++ Libraries and TheIDE: i18n, Unicode and Internationalization » How to display several languages without translation files?
How to display several languages without translation files? [message #4417] |
Sat, 05 August 2006 18:36 |
|
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
this topic is a continuation of:
http://www.arilect.com/upp/forum/index.php?t=msg&th=270& amp;start=0&
My question is:
How to display several languages without translation files (data coming from a database)?
(I have to have at least 3 languages)
1 case:
several languages in one string to one text (or array) controls?
2 case:
several languages from different differently encoded strings each going to a separate text (or array cell) control.
For the 1 case, AFAIK, the only possibillity is unicode/utf or WString. Am I right?
While I have succeeded this way for ArrayCtrl, I can't get the same for Label text. I guess this is not possible without telling it when to switch different language encodings (code pages) inside the text. Am I right?
That why I am asking for case 2.
Then I would like to write:
Label l;
WString ru_ru1=ToUnicode("Революция",255); //in fact it comes from DB
l.text=RU_RU(ru_ru1);
...
and accordingly for all other languages.
Then,
SetLanguage(LNGC_('R', 'U', 'R', 'U', CHARSET_WIN1251));
is no help? Am I right? (BTW, What is the scope of SetLanguage? global project, file, or several lines until next one?)
I tried different:
// rus2=ToCharset(CHARSET_WIN1251, rus2, 255);
// rus2=ToCharset( CHARSET_KOI8_R, rus2,CHARSET_WIN1251);
rus2=ToCharset( CHARSET_KOI8_R, rus2,255);
but with no succes.
What is the correct way?
|
|
|
|
Re: How to display several languages without translation files? [message #4421 is a reply to message #4418] |
Sun, 06 August 2006 00:10 |
|
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
luzr wrote on Sat, 05 August 2006 20:07 | What is DB encoding?
Mirek
|
Forget DB.
The problem is to make several labels with a different language each. Or column titles. From *.cpp file. Is this possible? If yes, how?
Edit: P.S -no translation files. Not using translation files.
Edit2:
like this
...
Label l;
WString ru_ru1=ToUnicode("Революция",255);
l.text=???(???,ru_ru1,???);
...
I've set the existing *.cpp file to UTF8.
[Updated on: Sun, 06 August 2006 01:58] Report message to a moderator
|
|
|
Re: How to display several languages without translation files? [message #4422 is a reply to message #4421] |
Sun, 06 August 2006 08:26 |
|
mirek
Messages: 13984 Registered: November 2005
|
Ultimate Member |
|
|
fudadmin wrote on Sat, 05 August 2006 18:10 |
luzr wrote on Sat, 05 August 2006 20:07 | What is DB encoding?
Mirek
|
Forget DB.
The problem is to make several labels with a different language each. Or column titles. From *.cpp file. Is this possible? If yes, how?
Edit: P.S -no translation files. Not using translation files.
Edit2:
like this
...
Label l;
WString ru_ru1=ToUnicode("Революция",255);
l.text=???(???,ru_ru1,???);
...
I've set the existing *.cpp file to UTF8.
|
Oooops. Looks like my explanation about "default-default" charset was wrong.... Perhaps because of backward compatibility, default-default is WIN1252 (which AFAIK is equal to ISO-8859-1) - code-pages used in US.
So what you need to do is SetDefaultCharset(CHARSET_UTF8); at the start of your code.
(Should I change this?)
There is no need to play with ToUnicode then, just use the UTF-8:
chrset::chrset()
{
CtrlLayout(*this, "Window title");
lbl1 = "řeřicha česky";
lbl2 = "Революция";
lbl3 = "∑¤∂¼½đ";
}
GUI_APP_MAIN
{
SetDefaultCharset(CHARSET_UTF8);
chrset().Run();
}
Mirek
[Updated on: Sun, 06 August 2006 08:27] Report message to a moderator
|
|
|
Re: How to display several languages without translation files? [message #4441 is a reply to message #4422] |
Tue, 08 August 2006 19:24 |
|
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
luzr wrote on Sun, 06 August 2006 07:26 |
Oooops. Looks like my explanation about "default-default" charset was wrong.... Perhaps because of backward compatibility, default-default is WIN1252 (which AFAIK is equal to ISO-8859-1) - code-pages used in US.
So what you need to do is SetDefaultCharset(CHARSET_UTF8); at the start of your code.
(Should I change this?)
There is no need to play with ToUnicode then, just use the UTF-8:
chrset::chrset()
{
CtrlLayout(*this, "Window title");
lbl1 = "řeřicha česky";
lbl2 = "Революция";
lbl3 = "∑¤∂¼½đ";
}
GUI_APP_MAIN
{
SetDefaultCharset(CHARSET_UTF8);
chrset().Run();
}
Mirek
|
Thanks! At last (I think...) I understand
===
U++, when compiling, doesn't use the same "brain part" which U++ editor uses... and doesn't know which encoding comes to its "mouth".
When compiling, you have to tell U++ "brain" which "mouth" to open by telling explicitly SetDefaultCharset(...).
Then you can manipulate the "digesting process" (and different "output products") with ToCharset, ToUnicode, ToUtf... etc.
===
Conclusive tip: To have WYSIWYG (what you see is what you get) you have to have the same encoding (eg. UTF8) for your file and SetDefaultCharset(...).
===
The scope of SetDefaultCharset(...) is your application (not package).
===
Is everything correct?
[P.S.Edited according to below... ]
[Updated on: Wed, 09 August 2006 17:13] Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Wed Jun 05 20:46:46 CEST 2024
Total time taken to generate the page: 0.01872 seconds
|
|
|