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