Results 1 to 4 of 4

Thread: Translation for qt based libraries

  1. #1
    Join Date
    May 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Translation for qt based libraries

    Hi,

    I have to localize texts inside a library using qt. Setting up and using lupdate and lrelease from inside buildsystem works perfect.

    But two questions:

    1. Where I have to install the localized files so qt will find them? (Linux/Unix). For first I used /usr/share/<libname>/i18n/ as target folder.
    2. How may I load this translations inside library? is this possible without knowledge about the calling application or has the application load the translation for this library?

    Cu

    E.

  2. #2
    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: Translation for qt based libraries

    Quote Originally Posted by elektritter View Post
    1. Where I have to install the localized files so qt will find them? (Linux/Unix). For first I used /usr/share/<libname>/i18n/ as target folder.
    Anywhere you want - you'll tell Qt where to look for them when requesting the translations. You can even embed the translations into the library itself.

    2. How may I load this translations inside library? is this possible without knowledge about the calling application or has the application load the translation for this library
    You can either do that yourself or tell the end-developer to do that. In either case you have to make sure QApplication object is already created and then you need to install a translator on it. You can create a kind of "initialize" function that the end-developer will have to call and that would install the translator.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Translation for qt based libraries

    Quote Originally Posted by wysota View Post
    Anywhere you want - you'll tell Qt where to look for them when requesting the translations. You can even embed the translations into the library itself.
    A - and how do I qt tell this? I looked trough documentation but didn't see any point "Load translations from this location".

    And embedding into application is made via a rc-file if I read the documentation right at this point. So Same: how do I embed it into a library? Loading a rc-file makes no sense to me. (If you may point me to the right documentation would be real nice)

    You can either do that yourself or tell the end-developer to do that. In either case you have to make sure QApplication object is already created and then you need to install a translator on it. You can create a kind of "initialize" function that the end-developer will have to call and that would install the translator.
    Ok, constructor of main interface looks like a good idea for this...

    tnx for you answer

    E.

  4. #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: Translation for qt based libraries

    Quote Originally Posted by elektritter View Post
    A - and how do I qt tell this? I looked trough documentation but didn't see any point "Load translations from this location".
    QTranslator::load()
    And embedding into application is made via a rc-file if I read the documentation right at this point. So Same: how do I embed it into a library? Loading a rc-file makes no sense to me. (If you may point me to the right documentation would be real nice)
    What do you mean that it makes no sense to you?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Qt + Eclipse + MinGW + Windows: How to include libraries?
    By jambrek in forum General Programming
    Replies: 3
    Last Post: 19th December 2007, 13:57
  2. Qt 3.3 libraries
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 21st December 2006, 17:25
  3. Standardization on libraries
    By brcain in forum General Discussion
    Replies: 13
    Last Post: 16th August 2006, 22:56
  4. Replies: 4
    Last Post: 7th March 2006, 08:52
  5. Splitting Translation Files
    By Jimmy2775 in forum Qt Programming
    Replies: 9
    Last Post: 3rd February 2006, 19:23

Tags for this Thread

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.