Results 1 to 4 of 4

Thread: translate QIODevice::errorString()

  1. #1
    Join Date
    Jun 2006
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Question translate QIODevice::errorString()

    Hi all,

    Should/does Qt provide translations for e.g. QIODevice::errorString()?

    For example, when trying to QFile::open() a readonly file for writing, errorString() gives "Access is denied.". This string I'd like to translate, but rather not on my own.

    I have loaded qt[base]_*.qm to no avail. The *.ts I have not at my hands currently, so I can't look into these.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: translate QIODevice::errorString()

    There is no direct translation support for QIODevice, it simply repeats whatever a subclass sets using QIODevice::setErrorString(). QFile does set strings marked for translation and, for example, there is a French translation in the qt_fr.ts that I would assume is automatically picked up on machines with a French locale.

  3. #3
    Join Date
    Jun 2006
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: translate QIODevice::errorString()

    Thx Chris.

    In the meantime I installed qt-everywhere-opensource-src-5.2.1 and looked into qtbase_*.ts. The exact string "Access is denied." is not in there. In fact, it can't be found in any file therein!
    (Apart from sqlite.* and tst_xmlpatterns.cpp which are irrelevant for my case.)

    So the only reasonable assumption left is: It's delivered by the underlying runtime (MSVC 2010 in my case) which probably passes it through from the OS. Is that so? Although in theory it could be some hardcoded Unicode which my search didn't cover.

    Changing my Windows Desktop's display language from english to something else doesn't affect the error string either.

    Where does that string come from?

    Quote Originally Posted by ChrisW67 View Post
    QFile does set strings marked for translation and, for example, there is a French translation in the qt_fr.ts that I would assume is automatically picked up on machines with a French locale.
    If you found the string inside qt_fr.ts then surely you didn't check 5.2? Translations have been modularized and QFile context is in qtbase_*.ts now.

  4. #4
    Join Date
    Jun 2012
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: translate QIODevice::errorString()

    I've encountered a similar problem. Only the string is different: "No file name specified". It is hardcoded in qtbase/src/corelib/io/qfsfileengine.cpp and it's not marked for translation. Qt 5.4.2.

Similar Threads

  1. Help about Phonon::MediaObject::errorString () Description
    By hrn2k1 in forum Installation and Deployment
    Replies: 0
    Last Post: 5th May 2011, 13:29
  2. Translate my app (dynamic)
    By liran ritkop in forum Qt Programming
    Replies: 6
    Last Post: 31st March 2011, 11:25
  3. Dynamic Translate
    By liran ritkop in forum Qt Programming
    Replies: 14
    Last Post: 30th March 2011, 13:22
  4. translate on fly
    By Noxxik in forum Qt Programming
    Replies: 5
    Last Post: 26th February 2009, 15:21
  5. errorString
    By AnithaRagupathy in forum Qt Programming
    Replies: 1
    Last Post: 19th October 2007, 03:03

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.