simplify translation methods; Ignore dependent details to prevent compilation errors

简化翻译加载方式;忽略依赖的详情以防止编译报错
This commit is contained in:
fensite 2021-10-14 09:03:05 +08:00
parent b1690dc2ec
commit 1b1ac4a0b1
3 changed files with 12 additions and 11 deletions

1
debian/control vendored
View File

@ -23,7 +23,6 @@ Rules-Requires-Root: no
Homepage: https://github.com/ukui/kylin-nm
Vcs-Git: https://github.com/ukui/kylin-nm.git
Vcs-Browser: https://github.com/ukui/kylin-nm
Package: kylin-nm
Architecture: any
Depends: network-manager (>=1.2.6),

4
debian/rules vendored
View File

@ -28,3 +28,7 @@ override_dh_auto_clean:
override_dh_auto_build:
dh_auto_build -- $(MAKE_OPTS)
override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info

View File

@ -85,6 +85,7 @@ int main(int argc, char *argv[])
QtSingleApplication a(id, argc, argv);
qInstallMessageHandler(messageOutput);
if (a.isRunning()) {
qInfo() << "Kylin-Network-Manager Is Already Launched, just show";
auto connection = QDBusConnection::sessionBus();
QDBusInterface iface("com.kylin.network",
"/com/kylin/network",
@ -94,22 +95,19 @@ int main(int argc, char *argv[])
return 0;
}
qDebug()<<"Kylin Network Manager Is Already Launched";
QApplication::setQuitOnLastWindowClosed(false);
// Internationalization
QString locale = QLocale::system().name();
QTranslator trans_global;
if (locale == "zh_CN") {
trans_global.load(":/translations/kylin-nm_zh_CN.qm");
qDebug() << "QLocale " << QLocale();
if (trans_global.load(QLocale(), "kylin-nm", "_", ":/translations/"))
{
a.installTranslator(&trans_global);
qDebug()<<"Translations load success";
} else {
qWarning() << "Translations load fail";
}
if (locale == "tr_TR") {
trans_global.load(":/translations/kylin-nm_tr.qm");
a.installTranslator(&trans_global);
}
qDebug()<<"Translations Are Already Loaded";
MainWindow w;
w.setProperty("useStyleWindowManager", false); //禁用拖动