Page 1 of 3 123 LastLast
Results 1 to 20 of 60

Thread: label Text is not changing using Qt Linguist

  1. #1
    Join Date
    Mar 2007
    Posts
    69
    Thanks
    14
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X

    Question 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>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;/head&gt;&lt;body style=&quot; white-space: pre-wrap; font-family:Lucida Grande; font-size:13pt; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;create&lt;span style=&quot; font-weight:600;&quot;&gt; &lt;/span&gt;Image&lt;/p&gt;&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;It is used to create image file&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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

  2. #2
    Join Date
    Jan 2007
    Posts
    68
    Thanks
    9
    Thanked 8 Times in 8 Posts

    Default Re: label Text is not changing using Qt Linguist

    you should take a look @ the following example...

  3. The following user says thank you to darksaga for this useful post:

    thomasjoy (11th September 2007)

  4. #3
    Join Date
    Mar 2007
    Posts
    69
    Thanks
    14
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X

    Default 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

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: label Text is not changing using Qt Linguist

    Could we see some code?

  6. #5
    Join Date
    Mar 2007
    Posts
    69
    Thanks
    14
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X

    Question 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

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default 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.

  8. #7
    Join Date
    Mar 2007
    Posts
    69
    Thanks
    14
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X

    Question 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);

    }

  9. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default 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?

  10. #9
    Join Date
    Mar 2007
    Posts
    69
    Thanks
    14
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X

    Question 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???

  11. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default 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.

  12. The following user says thank you to wysota for this useful post:

    thomasjoy (13th September 2007)

  13. #11
    Join Date
    Mar 2007
    Posts
    69
    Thanks
    14
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X

    Default 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

  14. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: label Text is not changing using Qt Linguist

    Hard to say without seeing the file. But you didn't answer my questions.

  15. #13
    Join Date
    Mar 2007
    Posts
    69
    Thanks
    14
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X

    Question 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
    Attached Files Attached Files
    Last edited by thomasjoy; 14th September 2007 at 09:42.

  16. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default 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.

  17. #15
    Join Date
    Mar 2007
    Posts
    69
    Thanks
    14
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X

    Default 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....

  18. #16
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default 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...

  19. #17
    Join Date
    Mar 2007
    Posts
    69
    Thanks
    14
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X

    Default 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

  20. #18
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default 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:

  21. #19
    Join Date
    Mar 2007
    Posts
    69
    Thanks
    14
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X

    Default 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
    Attached Files Attached Files

  22. #20
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default 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...
    Last edited by wysota; 18th September 2007 at 12:54.

Similar Threads

  1. Replies: 15
    Last Post: 31st January 2020, 19:25
  2. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 10:49
  3. German text on the label in Linux
    By Krish_ng in forum Qt Programming
    Replies: 2
    Last Post: 13th July 2007, 23:20
  4. Replies: 1
    Last Post: 24th October 2006, 17:40
  5. Changing the text color of a QTreeView leaf.
    By johnny_sparx in forum Qt Programming
    Replies: 3
    Last Post: 23rd March 2006, 00:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.