From b42a5bac54a9d6781691af9e796ef0c4c3514fce Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 30 Aug 2021 15:55:27 +0200 Subject: Update documentation on translations Adapt to qtbase/74515a7a30b809a3ab0a2d67496e870ea3c872e6. Pick-to: 6.2 Change-Id: I200e8a6803a46deb064f84d312a15e888f5d4e6d Reviewed-by: Kai Koehne Reviewed-by: Paul Wicking --- doc/src/internationalization/i18n.qdoc | 30 +++++++++++++++--------------- doc/src/snippets/code/doc_src_i18n.cpp | 10 ++++++---- 2 files changed, 21 insertions(+), 19 deletions(-) (limited to 'doc') diff --git a/doc/src/internationalization/i18n.qdoc b/doc/src/internationalization/i18n.qdoc index 45fc623ec..777bb863e 100644 --- a/doc/src/internationalization/i18n.qdoc +++ b/doc/src/internationalization/i18n.qdoc @@ -227,49 +227,49 @@ \li Catalog \row \li \l [QtConcurrent]{Qt Concurrent} - \li \c qtbase_ + \li \c qtbase \row \li \l [QtCore]{Qt Core} - \li \c qtbase_ + \li \c qtbase \row \li \l [QtDBus]{Qt D-Bus} - \li \c qtbase_ + \li \c qtbase \row \li \l {Qt Designer} - \li \c designer_ + \li \c designer \row \li \l [QtGui]{Qt GUI} - \li \c qtbase_ + \li \c qtbase \row \li \l {Qt Help} - \li \c qt_help_ + \li \c qt_help \row \li \l {Qt Linguist Manual}{Qt Linguist} - \li \c linguist_ + \li \c linguist \row \li \l[Qt Network]{Qt Network} - \li \c qtbase_ + \li \c qtbase \row \li \l [QtPrintSupport]{Qt Print Support} - \li \c qtbase_ + \li \c qtbase \row \li \l {Qt QML} - \li \c qtdeclarative_ + \li \c qtdeclarative \row \li \l {Qt Quick} - \li \c qtdeclarative_ + \li \c qtdeclarative \row \li \l {Qt Quick Controls} - \li \c qtquickcontrols2_ + \li \c qtdeclarative \row \li \l {Qt Quick Widgets C++ Classes}{Qt Quick Widgets} - \li \c qtdeclarative_ + \li \c qtdeclarative \row \li \l [QtSql]{Qt SQL} - \li \c qtbase_ + \li \c qtbase \row \li \l [QtWidgets]{Qt Widgets} - \li \c qtbase_ + \li \c qtbase \endtable \section2 Example: Basic Qt Modules diff --git a/doc/src/snippets/code/doc_src_i18n.cpp b/doc/src/snippets/code/doc_src_i18n.cpp index 2bd80d5ab..c5f379b97 100644 --- a/doc/src/snippets/code/doc_src_i18n.cpp +++ b/doc/src/snippets/code/doc_src_i18n.cpp @@ -130,8 +130,8 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); QTranslator myappTranslator; - myappTranslator.load(QLocale(), QLatin1String("myapp"), QLatin1String("_"), QLatin1String(":/i18n")); - app.installTranslator(&myappTranslator); + if (myappTranslator.load(QLocale::system(), u"myapp"_qs, u"_"_qs, u":/i18n"_qs)) + app.installTranslator(&myappTranslator); return app.exec(); } @@ -197,6 +197,8 @@ void same_global_function(LoginWidget *logwid) //! [14] QTranslator qtTranslator; - qtTranslator.load(QLocale::system(), QStringLiteral("qtbase_")); - app.installTranslator(&qtTranslator); + if (qtTranslator.load(QLocale::system(), u"qtbase"_qs, u"_"_qs, + QLibraryInfo::path(QLibraryInfo::TranslationsPath))) { + app.installTranslator(&qtTranslator); + } //! [14] -- cgit v1.2.3