6#include "initializetranslation.h"
8#include "initializelibraryresources.h"
9#include <qcoreapplication.h>
16#include <qstringliteral.h>
18#include <qtranslator.h>
20#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
23#include <qstringlist.h>
73void initializeTranslation(
QCoreApplication *instance, std::optional<QStringList> newUiLanguages)
77#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
87 if (instance ==
nullptr) {
90 <<
"must not be called without a QCoreApplication object.";
96 <<
"must not be called by any other thread "
97 "except the QCoreApplication thread.";
104 static std::optional<QStringList> translatorUiLanguages;
116 if (!newUiLanguages.has_value()) {
117 if (translatorUiLanguages.has_value()) {
118 newUiLanguages = translatorUiLanguages;
148 if (translatorUiLanguages != newUiLanguages) {
153 initializeLibraryResources();
155 if (newUiLanguages.value().count() <= 0) {
162 QStringLiteral(
"nonexistingfilename"),
165 QStringLiteral(
":/PerceptualColor/i18n")));
182 while (!loaded && i < newUiLanguages.value().count()) {
183 loaded = translator.
load(
189 QLocale(newUiLanguages.value().value(i)),
191 QStringLiteral(
"localization"),
198 QStringLiteral(
":/PerceptualColor/i18n"));
202 translatorUiLanguages = newUiLanguages;
215 if (instanceWhereTranslationIsInstalled != instance) {
217 instanceWhereTranslationIsInstalled = instance;
219 instanceWhereTranslationIsInstalled =
nullptr;
The namespace of this library.
bool installTranslator(QTranslator *translationFile)
QCoreApplication * instance()
QStringList uiLanguages() const const
QThread * currentThread()
bool load(const QLocale &locale, const QString &filename, const QString &prefix, const QString &directory, const QString &suffix)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:18 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.