diff options
author | Leena Miettinen <riitta-leena.miettinen@qt.io> | 2019-09-13 10:51:11 +0200 |
---|---|---|
committer | Leena Miettinen <riitta-leena.miettinen@qt.io> | 2019-09-25 17:53:02 +0200 |
commit | 21d65d5c2dbfadb3e6dae0707f2ba6e0d4bb2c30 (patch) | |
tree | 65b0dc9207c7265bc2fe2900eedf5f82da80e919 /doc/src/snippets | |
parent | 3825a45d5c17cba5298417dd68fef973f62f699c (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>
Diffstat (limited to 'doc/src/snippets')
-rw-r--r-- | doc/src/snippets/code/doc_src_i18n.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
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] |