label Text is not changing using Qt Linguist
hi all
i am using QT4.1 on Mac
by using qt linguist i had made the whole application text into multi languages
everything ia getting changed but text of label doesn't change
when i do lupdate label text include much things like font-family,font:,font-weight etc.
<source><html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Lucida Grande; font-size:13pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">create<span style=" font-weight:600;"> </span>Image</p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">It is used to create image file</p></body></html></source>
<translation type="unfinished"></translation>
but i had made it just as it is,as text of designer's label.like this
<source>create Image
It is used to create image file</source>
<translation type="obsolete">crer image
Elle est employe pour crer le dossier d image</translation>
so do tell me why its not showing converted text
if anyone ne know then do tell me what is the problem and also tell the reason to not converting
thanks in advance
Re: label Text is not changing using Qt Linguist
you should take a look @ the following example...
Re: label Text is not changing using Qt Linguist
but i am following exactly the same things as qt manual have the example
and even i want to follw that way.....
if you know then tell what problem can occur
even on the same dialog text of buttons is changed title of windows is changing so why not the label text
Re: label Text is not changing using Qt Linguist
Re: label Text is not changing using Qt Linguist
actully problem is not with code
as i had created the same kind of example that works fine
but if project get larger or larger then it doesn't translate the label's text
but it is showing message what ever i am going to show but label text which is placed on another dialog is not changing
means by double clicking from mainwindow i get another dialog which have this label text
so can you tell what problem it is ???
thanks in advance
Re: label Text is not changing using Qt Linguist
Without any code we won't be able to help. The size of the application doesn't really matter. Maybe you forgot to update translation files or there is a problem with initializing the translator? Does QTranslator::load return true after loading the translation?
Providing a minimal compilable example reproducing the problem would help greatly.
Re: label Text is not changing using Qt Linguist
thans for reply
see firstly i had done the lupdate unicodetest.pro (to craete the .ts files)
after inserting strings of label text in french language ,i.e UnicodeTest_fr.ts, i had done the
lupdate unicodetest.pro
lrelease unicodetest.pro
and then qmake &&make on terminal
and even translator is returning true but still label text is not changing on the another dialog
see the code for french language
void UnicodeTest :: OnClickFrench()
{
bool x=trans.load("UnicodeTest_fr","/UnicodeTest/translation");
QString msgStr=trans.translate("UnicodeTest","You had chosen the French Language ");
QMessageBox::information(0,"message",msgStr);
QString menuActionStr= trans.translate("UnicodeTest","English");
actionEnglish->setText(menuActionStr);
QString menuActionStr1= trans.translate("UnicodeTest","French");
actionFrench->setText(menuActionStr1);
QString menuStr=trans.translate("UnicodeTest","Language");
menuLanguage->setTitle(menuStr);
qApp->installTranslator(&trans);
}
Re: label Text is not changing using Qt Linguist
Do all the translate() calls return proper translated data? If so, then I don't see anything incorrect here... What exactly doesn't work? I'm only having a doubt about using translate() instead of tr() or QT_TR_NOOP() - are your strings even grabbed by lupdate into the ts file?
Re: label Text is not changing using Qt Linguist
yes every translate() is translating the text tha's why it shoeing the translated text on first window when i click french language on mainwindow but label text on next dialog which is written in one of my previous post...which is in< source>.....<translation > form is not changing....
tell me what type of problems can be occured..with it???
Re: label Text is not changing using Qt Linguist
Where do you perform the actual retranslation? For Designer created uis this will be done automatically through retranslateUi() method created by uic, but for manually coded windows you have to do that yourself.
Re: label Text is not changing using Qt Linguist
can you tell me whe this error occurs???
tag mismatch in XML file UnicodeTest_en.ts
but as i had observed deeply there is no tag which is mismatching of XML file
thanks in advance
Re: label Text is not changing using Qt Linguist
Hard to say without seeing the file. But you didn't answer my questions.
1 Attachment(s)
Re: label Text is not changing using Qt Linguist
yes i am adding it manually in the translation file but even it is not changing the designer's UI
i am translating whole application's text in .ts file and loading the .qm file in the code which i had shown you..so wht else you want to ask...
as i had seen the XML file very keenly i think there is not a tag which is mismatching...
i am attaching the .ts file see and tell where it is mismatching the tag
see in the context name VolumeActionDialog and StellarPhoenixMAC
Re: label Text is not changing using Qt Linguist
But do you perform the retranslation anywhere? A string being in the translation file won't automagically translate itself when the language is changed. You need to wrap the string into tr() calls and make sure those calls are performed when the language is changed. Please take a simple form, uic it, look at the generated code and notice how Designer generated forms are being retranslated when the language changes.
Re: label Text is not changing using Qt Linguist
may be i am not getting you what you want to say...
but i wanna tell you what is my procedure means what i had done
in my app i have one menu "language" containing two action English and French
i was just doing to convert app to english and french
when i click on english action everything in english when i click french firstly one message will appears in french that you had selected french language
then i double click on the same window's body having treewidget's item when i double click on treewiget's item ,one another dialog appears which have some label text dialog's name is VolumeActionDialog and its class name is VolumeActionDlg(which is not changing the label text)
see wht i am doing on terminal shell
qmake -project
adding lines for TRANLATIONS+=translation/StellarPhoenix_en.ts \
translation/StellarPhoenix_fr.ts
lupdate stellarphoenix.pro
lrelease stellarphoenix.pro
qmake -spec macx-g++
qmake &&make
what ever you are asking for retranslateUi() that is done in ui_VolumeActionDialog.h by qmake
manually i am not doing retranslateUi() because label text i am adding by designer....
Re: label Text is not changing using Qt Linguist
Could you attach the exact code of your application? We seem not to be getting anywhere right now...
Re: label Text is not changing using Qt Linguist
ok leave it i'll find it later ..and do tell if you know how translate the text in bold i mean my label text is in bold
and i want it should return , after translation , in bold
see i have one paragraph having first line in bold and all others are normal how to ,after translation , i can show it in same format (first line in bold and rest all normal).
thanks in advance
Re: label Text is not changing using Qt Linguist
If you don't provide any code, we won't be able to help. You are doing something wrong, but we can't pinpoint it without your cooperation. If you don't want to show us the code, I can only redirect you to the docs:
1 Attachment(s)
Re: label Text is not changing using Qt Linguist
not the problem is not in giving the code ....
seee my problem is almost solved now everything is changing into another languages
but one is not changing is label text which is in bold ....even label text is translated but not in bold in my text only the first line is in bold.....rest all is regular
like this i have 3 labels ....
and see the attachment with it
Re: label Text is not changing using Qt Linguist
The application doesn't eem... seem to work. It doesn't even compile out of the box. Did you test it? If I choose anything from the menu, all texts are removed.
Edit: Ok, I managed to get it to work (I mean display text), but I don't see any bold text you mentioned.
Edit2: Oh, and you really waste a lot of effort... You are translating everything manually and then install the translator which make the application translate itself on its own. So there is a high chance your translations are simply overwritten by the onces Qt does. I suggest you read the chapter about i18n again...