Results 1 to 3 of 3

Thread: Qt Linguist: am I doing this right?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2017
    Posts
    37
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Qt Linguist: am I doing this right?

    I ran lupdate on my program and got a file juliaskein.ts:
    Qt Code:
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <!DOCTYPE TS>
    3. <TS version="2.0">
    4. <context>
    5. <name>JuliaWidget</name>
    6. <message>
    7. <location filename="jwidget.cpp" line="11"/>
    8. <source>Julia Skein</source>
    9. <translation type="unfinished"></translation>
    10. </message>
    11. </context>
    12. </TS>
    To copy to clipboard, switch view to plain text mode 
    The single string is used as the window title. I then made two copies and edited them in Qt Linguist:
    Qt Code:
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <!DOCTYPE TS>
    3. <TS version="2.0" language="en_US">
    4. <context>
    5. <name>JuliaWidget</name>
    6. <message>
    7. <location filename="jwidget.cpp" line="11"/>
    8. <source>Julia Skein</source>
    9. <translation>Julia Skein</translation>
    10. </message>
    11. </context>
    12. </TS>
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <!DOCTYPE TS>
    3. <TS version="2.0" language="es">
    4. <context>
    5. <name>JuliaWidget</name>
    6. <message>
    7. <location filename="jwidget.cpp" line="11"/>
    8. <source>Julia Skein</source>
    9. <translation>Madeja Julia</translation>
    10. </message>
    11. </context>
    12. </TS>
    To copy to clipboard, switch view to plain text mode 
    I have both juliaskein_en.ts and juliaskein_es.ts open in Qt Linguist; that's working fine. However, if I open juliaskein.ts, it pops up a dialog box asking what the target language is. This file doesn't have a target language; it should not have any translated strings. What should I do so that it opens without a target language and without asking for a target language? Is there a way to start a new translation in Qt Linguist, or do I just copy a file and edit it?

  2. #2
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Qt Linguist: am I doing this right?

    So the file juliaskein.ts is your template for creating the actual translations. This approach does not seem very useful to me because next time you want to add a further translation the template might be already outdated. Instead I would just call lupdate to create new translations and of course to update existing ones.

    When using CMake you can automate calling lupdate/lrelease by using Qt Linguist macros: http://doc.qt.io/qt-5/cmake-manual.html
    It is also possible to automate the process using qmake: https://wiki.qt.io/Automating_generation_of_qm_files

  3. #3
    Join Date
    Jul 2017
    Posts
    37
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Qt Linguist: am I doing this right?

    So, once I've created the first translation, I don't need to keep juliaskein.ts around, and I copy an existing translation to create a new translation? Or do I add it to a list in CMakeLists to create a new translation?

Similar Threads

  1. Qt Linguist Question
    By zgulser in forum Qt Programming
    Replies: 1
    Last Post: 26th March 2012, 10:32
  2. how to open qt linguist?
    By tomkonikkara in forum Newbie
    Replies: 1
    Last Post: 29th July 2011, 07:01
  3. Qt Linguist
    By goli in forum Newbie
    Replies: 0
    Last Post: 9th June 2011, 08:52
  4. QT linguist Cmake
    By _Jack_ in forum Qt Programming
    Replies: 1
    Last Post: 18th September 2010, 12:29
  5. How to use Qt Linguist
    By mourad in forum Qt Tools
    Replies: 1
    Last Post: 24th May 2008, 03:18

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.