[Qt-interest] How to support Korean language in Qt

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Wed Oct 20 09:56:52 CEST 2010


On 2010-10-20 Sudhish sudhish kapoor wrote:

> Hi all,
>       I am using 4.5.0 and want to show korean font, how to do that 
> can any one help me with that.

- Make sure you have such a font installed on your system (is it usable in other apps?)
- Test with e.g. %QTDIR\examples\painting\fontsampler\ whether the font is also properly displayed with Qt
- Read about "internationalisation" ("i18n") in Qt: http://doc.trolltech.com/4.7/internationalization.html
- In general: read the excellent (!) Qt documentation first ;)

My recommendation is to use English texts in your source code (NOT korean or german or...) and then translate these to your desired language, using Qt Linguist, even if you only plan to support korean. This way you avoid the problem with source file text encoding. Even though most modern text editors / IDEs support Unicode / UTF-8 encoding, some compilers might not (?). Or in other words:

DON'T:

// Swiss german - the umlauts ä, ö, ü etc. might cause trouble!
QString welcome = tr("Guätä Morgä allnä mitenand!");

DO:

QString welcome = tr("Good morning everyone!");


The tr() ("translate") method is available for any QObject based class. Again, read about Qt internationalization on how to translate strings in "non-Qt classes". The tool lupdate.exe with then extract all these strings and but them into a *.ts file.

Then within Qt Linguist (see http://doc.trolltech.com/4.7/linguist-manual.html) you can enter any Unicode character you like, the resulting *.qm translation files (which you load dynamically at runtime and can even switch between at runtime) deal with Unicode properly :)

Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22





More information about the Qt-interest-old mailing list