創屋ぷれす

Jahshakaビルド環境構築7(日本語化2)

前回はjahtranslateクラスで日本語変換の処理を作成しましたが、今回はその他に変更が必要な箇所についてです。

source/jahshaka/JahLibraries/jahformatter/JahFormatter
void JahFormatter::addButton( QPushButton * button, int x, int y, int w, int h, QString text )
{
button->setGeometry( QRect( x, y, w, h ) );
button->setText( text );
// button->setText( QObject::tr( text ) );
}

jahformatterにある各関数の中でQObject::trを読んでいる箇所を削除する。

他に、
source/Jahshaka/JahModeules/text/characterInterface.cpp
とかだと
//tabframe->insertTab( moduleOptionsUI[2], tr( ” “+jt->tr(“CONTROLS”)+” ” ) );
tabframe->insertTab( moduleOptionsUI[2], ” “+jt->tr(“CONTROLS”)+” “);
のように、二重にtrして???に化けたりする。

あとは単純に変換関数をつかっていない場所で、jt->trを使用する。
source/Jahshaka/JahDesktop/player/MainPlauer.cpp
// Set up the translator
jt = JahTranslate::getInstance();
...
playmodecombo->insertItem( jt->tr( "Loop" ) );
playmodecombo->insertItem( jt->tr( "RAM Player" ) );
playmodecombo->insertItem( jt->tr( "Play" ) );
playmodecombo->insertItem( jt->tr( "Playlist" ) );

と、ここまで書いたけど
source/Jahshaka/JahSource/jahmain/main.cppあたりで
QTextCodec* codec = QTextCodec::codecForName("UTF-8");
app->setDefaultCodec(codec);
としておくと案外tr関係の箇所は修正不要、かもしれない。
※試していないのでわからないけれど

とりえあずまとめると、日本語化はソースいじらないと無理。
変換関数が呼ばれていない箇所も多いいのですべて日本語化するのは結構面倒。
ということで、一旦 Jahshaka Linux編は終了です。

創屋のホームページはこちらから

Comments are closed.