| 1 | // SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 2 | // SPDX-FileCopyrightText: 2025 Harald Sitter <sitter@kde.org> |
| 3 | |
| 4 | #include "localizedcontext.h" |
| 5 | |
| 6 | #include <QQmlContext> |
| 7 | #include <QQmlEngine> |
| 8 | |
| 9 | KLocalizedQmlContext *LocalizedContext::create(QQmlEngine *qmlEngine, [[maybe_unused]] QJSEngine *jsEngine) |
| 10 | { |
| 11 | auto context = qobject_cast<KLocalizedQmlContext *>(object: qmlEngine->rootContext()->contextObject()); |
| 12 | if (!context) { |
| 13 | qWarning() << "Failed to get KLocalizedQmlContext from engine root context. See KLocalization::setupLocalizedContext(). Localization will not work!" ; |
| 14 | } |
| 15 | return context; |
| 16 | } |
| 17 | |
| 18 | #include "moc_localizedcontext.cpp" |
| 19 | |