mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 11:37:56 -04:00
Partial functioning of translations
This commit is contained in:
parent
3d930e5bd8
commit
75be2c9311
@ -6,6 +6,7 @@
|
||||
|
||||
QT += core gui
|
||||
QT += webenginewidgets
|
||||
QT += widgets qml quick
|
||||
|
||||
CONFIG += link_pkgconfig
|
||||
|
||||
@ -85,10 +86,9 @@ isEmpty(PREFIX) {
|
||||
target.path = $$PREFIX/bin
|
||||
INSTALLS += target
|
||||
|
||||
TRANSLATIONS = locales/kiwix-desktop_fr.ts
|
||||
TRANSLATIONS = "resources/i18n/kiwix-desktop_fr.ts"
|
||||
CODECFORSRC = UTF-8
|
||||
|
||||
QT += widgets
|
||||
|
||||
static {
|
||||
PKGCONFIG_OPTION = "--static"
|
||||
@ -117,4 +117,8 @@ QMAKE_CFLAGS += $$PKGCONFIG_CFLAGS
|
||||
LIBS += $$system(pkg-config --libs $$PKGCONFIG_OPTION kiwix)
|
||||
|
||||
RESOURCES += \
|
||||
resources/kiwix.qrc
|
||||
resources/kiwix.qrc \
|
||||
resources/translations.qrc
|
||||
|
||||
system($$QMAKE_LUPDATE -locations relative -no-ui-lines $$_PRO_FILE_)
|
||||
system($$QMAKE_LRELEASE $$_PRO_FILE_)
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="fr_FR">
|
||||
<TS version="2.1" language="fr">
|
||||
<context>
|
||||
<name>AboutDialog</name>
|
||||
<message>
|
5
resources/translations.qrc
Normal file
5
resources/translations.qrc
Normal file
@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/i18n" lang="fr">
|
||||
<file alias="kiwix-desktop.qm">i18n/kiwix-desktop_fr.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,6 +1,6 @@
|
||||
#include "library.h"
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QObject>
|
||||
#include <QtDebug>
|
||||
|
||||
Library::Library()
|
||||
@ -17,7 +17,7 @@ QString Library::openBook(const QString &zimPath)
|
||||
if(QString::fromStdString(it->second->getZimFilePath()) == zimPath)
|
||||
return it->first;
|
||||
}
|
||||
qInfo() << tr("Opening") << zimPath;
|
||||
qInfo() << QObject::tr("Opening") << zimPath;
|
||||
auto zimPath_ = zimPath.toStdString();
|
||||
auto reader = std::shared_ptr<kiwix::Reader>(new kiwix::Reader(zimPath_));
|
||||
auto id = QString::fromStdString(reader->getId() + ".zim");
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "kiwixapp.h"
|
||||
|
||||
#include <QTranslator>
|
||||
#include <QLibraryInfo>
|
||||
#include <QCommandLineParser>
|
||||
#include <iostream>
|
||||
|
||||
@ -8,13 +10,18 @@ int main(int argc, char *argv[])
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
KiwixApp a(argc, argv);
|
||||
|
||||
// format systems language
|
||||
QString defaultLocale = QLocale::system().name(); // e.g. "de_DE"
|
||||
defaultLocale.truncate(defaultLocale.lastIndexOf('_')); // e.g. "de"
|
||||
QLocale::setDefault(defaultLocale);
|
||||
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load("qt_" + QLocale::system().name(),
|
||||
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
a.installTranslator(&qtTranslator);
|
||||
|
||||
QTranslator myappTranslator;
|
||||
myappTranslator.load("kiwix-desktop_" + QLocale::system().name());
|
||||
myappTranslator.load(":/i18n/kiwix-desktop.qm");
|
||||
a.installTranslator(&myappTranslator);
|
||||
|
||||
QCommandLineParser parser;
|
||||
|
Loading…
x
Reference in New Issue
Block a user