Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
4.6.2
-
None
-
Windows XP SP3(Japanese veresion), VC++ 2008
Description
Linguist cannot translate Japanese Shift_JIS into ASCII correctly.
I wrote a simple test program named MyApp.exe to examine the issue.
The program has only one QPushButton in the MainWindow. The text on the button
is "CLICK" (this time I use double-wide uppercase alphabetical characters
included in the Japanese encoding in an easy-to-understand manner, since I
suppose probably you don't understand Japanese language).
When the button is clicked, a message box appears by the following code in
the slot function connected to the clicked() signal of the button.
QMessageBox::information(this, tr("TITLE"), tr("HELLO"));
In the body of main(), I wrote as follows.
QTextCodec::setCodecForTr(QTextCodec::codecForName("Shift_JIS"));
QTranslator translator;
translator.load("MyApp_en.qm"); // Fixed .qm file, since it's a test
a.installTranslator(&translator);
In the meantime, I added the following lines at the end of MyApp.pro.
TRANSLATIONS = MyApp_en.ts
CODECFORTR = Shift_JIS
Then, I generated MyApp_en.ts by typing as follows in the command prompt.
lupdate MyApp.pro
Next, I did translation by using Linguist as follows.
CLICK -> Click
TITLE -> Title
HELLO -> Hello
After that, I saved the translation result to MyApp_en.ts, and generated
MyApp_en.qm by [File]->[Release] menu of Linguist.
Then I activated the test program. As a result, the text on the button was
translated correctly. But the two phrases in the message box were not
translated, so row original phrases were shown ("TITLE" and "HELLO").
As a trial, I used lrelease command to generate MyApp_en.qm instead of Linguist,
then the following message was shown, although MyApp_en.qm was generated.
No QTextCodec for Shift_JIS available. Using Latin1
The translation result of that was the same as in the case of Linguist.
FYI: The system encoding of Japanese Windows XP is Shift_JIS, and VC++
accepts only Shift_JIS as Japanese encoding. Therefore, UTF-8 or any other
encodings than Shift_JIS cannot be used in my environment.