The translation mark is outside a context. Either put it in a context or use QT_TRANSLATE_NOOP instead of QT_TR_NOOP passing a context to the call. Make sure the same context is used with the tr() call.
The translation mark is outside a context. Either put it in a context or use QT_TRANSLATE_NOOP instead of QT_TR_NOOP passing a context to the call. Make sure the same context is used with the tr() call.
stevocz (17th December 2013)
can you fix it and send me back this application?
because i am try this:
const char * const TEXT_TO_TRANSLATE = QT_TRANSLATE_NOOP("translateCategory", "Translate");
and "Translate" is in .ts file, but in application text isn't changed.
and please fix QDialogButtonBox
maybe a stupid question, but why translate the QDialogButtonBox strings again?
Those strings from Qt should already be translate for Qt.
If they aren't, maybe the Qt translation catalogue wasn't loaded?
See http://qt-project.org/doc/qt-4.8/i18...ng-translation
Cheers,
_
when i am erased .ts file and create new, QT_TRANSLATE_NOOP works ok
this
const char * const TEXT_TO_TRANSLATE = QT_TRANSLATE_NOOP("translateCategory", "translate");
ui.label_2->setText(QApplication::translate("translateCategor y",TEXT_TO_TRANSLATE));
and this
const char * const TEXT_TO_TRANSLATE = QT_TRANSLATE_NOOP("QObject", "translate");
ui.label_2->setText(QObject::tr(TEXT_TO_TRANSLATE));
booth work.
or best for this example
const char * const TEXT_TO_TRANSLATE = QT_TRANSLATE_NOOP("MainWindow", "translate");
ui.label_2->setText(tr(TEXT_TO_TRANSLATE));
work too.
Last edited by stevocz; 17th December 2013 at 14:28.
yes, tr() is modified and works. now i must edit QDialogButtonBox.
but how? i am tried load QLibraryInfo but doesnt work
What does QLibraryInfo have to do with this??? You are supposed to install a translator on your application using Qt's message catalog that resides in the translations subdirectory of your Qt installation.
and how do it?
The same as you do it with any other translator -- you load the message catalog and install the translator on the application.
stevocz (18th December 2013)
thank this works, but there are only few languages. how add my language?
Last edited by stevocz; 18th December 2013 at 07:44.
TS files for Qt are available. You can provide your own translations using Linguist or search the web if an external catalog for your language is available.
stevocz (18th December 2013)
Bookmarks