summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeena Miettinen <riitta-leena.miettinen@qt.io>2019-09-13 10:51:11 +0200
committerLeena Miettinen <riitta-leena.miettinen@qt.io>2019-09-25 17:53:02 +0200
commit21d65d5c2dbfadb3e6dae0707f2ba6e0d4bb2c30 (patch)
tree65b0dc9207c7265bc2fe2900eedf5f82da80e919
parent3825a45d5c17cba5298417dd68fef973f62f699c (diff)
I18N: describe loading translations for Qt modules
Make the first example simpler and move the code for locating Qt modules to a subsection. Map Qt modules to catalogs available in the qttranslations repository. Explain that devs can either use the meta catalog or pick the catalogs for the modules that they use (only available way for new Qt 5 modules). Task-number: QTBUG-69203 Change-Id: I0727ca3b5547349ab2a1e387040086ead532b688 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
-rw-r--r--doc/src/internationalization/i18n.qdoc152
-rw-r--r--doc/src/snippets/code/doc_src_i18n.cpp15
2 files changed, 155 insertions, 12 deletions
diff --git a/doc/src/internationalization/i18n.qdoc b/doc/src/internationalization/i18n.qdoc
index 2419906d8..16c858c3c 100644
--- a/doc/src/internationalization/i18n.qdoc
+++ b/doc/src/internationalization/i18n.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -193,10 +193,152 @@
translation is loaded according to the current locale at runtime, and
finally, the translator object is installed into the application.
- Note the use of QLibraryInfo::location() to locate the Qt translations.
- Developers should request the path to the translations at run-time by
- passing QLibraryInfo::TranslationsPath to this function instead of
- using the \c QTDIR environment variable in their applications.
+ \section1 Locating Qt Translations
+
+ You can also use QLibraryInfo::location() to locate the translations for the
+ Qt modules used. You can request the path to the translations at run-time by
+ passing QLibraryInfo::TranslationsPath to this function.
+
+ \section2 Available Catalogs
+
+ The Qt translation catalogs are located in the \c qttranslations repository.
+
+ \warning Qt translations are contributed by the Qt community, and provided
+ without any guarantees. Translations migh be missing, outdated, or entirely
+ incorrect, up to the point of being malicious. It is recommended that you
+ audit any translations you ship.
+
+ The \c qt_ meta catalog contains the still-existing Qt translations that
+ were included in the \c qt_ catalog in Qt 4. It was created to make porting
+ applications from Qt 4 to Qt 5 easier. The meta catalog depends on
+ translations that might be absent, because they belong to unnecessary or
+ deprecated modules, which might cause the loading of the translations to
+ fail. If you use modules that are new in Qt 5 in your application, you must
+ specify the names of the catalogs for those modules even if you use the
+ meta catalog.
+
+ The following table lists the translation catalogs available for the Qt
+ modules and tools in Qt.
+
+ \table
+ \header
+ \li Qt Module or Tool
+ \li Catalog
+ \row
+ \li \l {Qt Assistant Manual}{Qt Assistant}
+ \li \c assistant_
+ \row
+ \li \l [QtBluetooth]{Qt Bluetooth}
+ \li \c qtconnectivity_
+ \row
+ \li \l [QtConcurrent]{Qt Concurrent}
+ \li \c qtbase_
+ \row
+ \li \l [QtCore]{Qt Core}
+ \li \c qtbase_
+ \row
+ \li \l [QtDBus]{Qt D-Bus}
+ \li \c qtbase_
+ \row
+ \li \l {Qt Designer}
+ \li \c designer_
+ \row
+ \li \l [QtGui]{Qt GUI}
+ \li \c qtbase_
+ \row
+ \li \l {Qt Help}
+ \li \c qt_help_
+ \row
+ \li \l {Qt Linguist Manual}{Qt Linguist}
+ \li \c linguist_
+ \row
+ \li \l [QtLocation]{Qt Location}
+ \li \c qtlocation_
+ \row
+ \li \l [QtMultimedia]{Qt Multimedia}
+ \li \c qtmultimedia_
+ \row
+ \li \l [QtMultimediaWidgets]{Qt Multimedia Widgets}
+ \li \c qtmultimedia_
+ \row
+ \li \l[QtNfc]{Qt NFC}
+ \li \c qtconnectivity_
+ \row
+ \li \l[Qt Network]{Qt Network}
+ \li \c qtbase_
+ \row
+ \li \l [QtPositioning]{Qt Positioning}
+ \li \c qtlocation_
+ \row
+ \li \l [QtPrintSupport]{Qt Print Support}
+ \li \c qtbase_
+ \row
+ \li \l {Qt QML}
+ \li \c qtdeclarative_
+ \row
+ \li \l {Qt Quick}
+ \li \c qtdeclarative_
+ \row
+ \li \l {Qt Quick Controls}
+ \li \c qtquickcontrols2_
+ \row
+ \li \l {Qt Quick Widgets C++ Classes}{Qt Quick Widgets}
+ \li \c qtdeclarative_
+ \row
+ \li \l [QtSerialPort]{Qt Serial Port}
+ \li \c qtserialport_
+ \row
+ \li \l [QtSql]{Qt SQL}
+ \li \c qtbase_
+ \row
+ \li \l [QtWebEngine]{Qt WebEngine}
+ \li \c qtwebengine_
+ \row
+ \li \l [QtWebSockets]{Qt WebSockets}
+ \li \c qtwebsockets_
+ \row
+ \li \l [QtWidgets]{Qt Widgets}
+ \li \c qtbase_
+ \endtable
+
+ \omit
+ The following modules are not listed above because they are deprecated,
+ documented as a part of another module, QPA modules, or not translated
+ for some reason.
+
+ \list
+ \row \li QtEglFSDeviceIntegration \li \c qtbase_ \li QPA
+ \row \li QtMultimediaGstTools \li \c qtmultimedia_ \li Qt Multimedia
+ \row \li QtMultimediaQuick \li \c qtmultimedia_ \li Qt Multimedia
+ \row \li QtOpenGL \li \c qtbase_ \li Deprecated
+ \row \li QtOpenGLExtensions \li \c qtbase_ \li Deprecated
+ \row \li QtPacketProtocol \li \c qtdeclarative_ \li Qt Quick
+ \row \li QtPositioningQuick \li \c qtlocation_ \li Qt Positioning
+ \row \li QtQmlDebug \li \c qtdeclarative_ \li Qt Quick
+ \row \li QtQmlModels \li \c qtdeclarative_ \li Qt Quick
+ \row \li QtQmlWorkerScript \li \c qtdeclarative_ \li Qt Quick
+ \row \li QtQuickParticles \li \c qtdeclarative_ \li Qt Quick
+ \row \li QtQuickShapes \li \c qtdeclarative_ \li Qt Quick
+ \row \li QtQuickTemplates2 \li \c qtquickcontrols2_ \li Qt Quick Controls 2
+ \row \li QtQuickTest \li \c qtdeclarative_ \li Not translated
+ \row \li QtQuickWidgets \li \c qtdeclarative_ \li Qt Quick
+ \row \li QtScript \li \c qtscript_ \li Deprecated
+ \row \li QtScriptTools \li \c qtscript_ \li Deprecated
+ \row \li QtTest \li \c qtbase_ \li Not translated
+ \row \li QtWebEngineCore \li \c qtwebengine_ \li Qt WebEngine
+ \row \li QtWebEngineWidgets \li \c qtwebengine_ \li Qt WebEngine
+ \row \li QtXml \li \c qtbase_ \li Deprecated
+ \row \li QtXmlPatterns \li \c qtxmlpatterns_ \li Deprecated
+ \endlist
+ \endomit
+
+ \section2 Example: Basic Qt Modules
+
+ For example, to locate translations for basic Qt modules, such as Qt Core,
+ Qt GUI, Qt Network, and Qt Widgets, add the following code to the \c main()
+ function:
+
+ \snippet snippets/code/doc_src_i18n.cpp 14
\section1 Support for Encodings
diff --git a/doc/src/snippets/code/doc_src_i18n.cpp b/doc/src/snippets/code/doc_src_i18n.cpp
index afde55d77..18a5def16 100644
--- a/doc/src/snippets/code/doc_src_i18n.cpp
+++ b/doc/src/snippets/code/doc_src_i18n.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -129,16 +129,10 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- QTranslator qtTranslator;
- qtTranslator.load("qt_" + QLocale::system().name(),
- QLibraryInfo::location(QLibraryInfo::TranslationsPath));
- app.installTranslator(&qtTranslator);
-
QTranslator myappTranslator;
myappTranslator.load("myapp_" + QLocale::system().name());
app.installTranslator(&myappTranslator);
- ...
return app.exec();
}
//! [8]
@@ -199,3 +193,10 @@ void same_global_function(LoginWidget *logwid)
logwid);
}
//! [13]
+
+
+//! [14]
+ QTranslator qtTranslator;
+ qtTranslator.load(QLocale::system(), QStringLiteral("qtbase_"));
+ app.installTranslator(&qtTranslator);
+//! [14]