Modified the path of translated pm files and the timing of generation

This commit is contained in:
balloonflower
2019-08-12 11:58:11 +08:00
parent 7fe0c15489
commit 33fbbc42d3
8 changed files with 31 additions and 30 deletions
+1 -2
View File
@@ -1,5 +1,4 @@
#!/bin/sh
#! /bin/sh
# Run this to generate all the initial makefiles, etc.
#lrelease src/src.pro
lrelease kylin-video.pro
+3 -1
View File
@@ -1,11 +1,13 @@
kylin-video (2.0.0-0ubuntu2) eoan; urgency=low
* Supported Interface Size Tension.
* Added new files, such as videowindow.cpp, autohidecursorwidget.cpp and displaylayercomposer.cpp.
* Added new files, such as videowindow.cpp, autohidecursorwidget.cpp and
displaylayercomposer.cpp.
* Add remote controller dbus.
* Add equalizer and filter for audio.
* Fixed the exception of the esctip.
* Access icon from theme.
* Modified the path of translated pm files and the timing of generation.
-- lixiang <lixiang@kylinos.cn> Mon, 22 Jul 2019 10:51:05 +0800
+1 -1
View File
@@ -14,7 +14,7 @@ override_dh_auto_configure:
dh $@
override_dh_install:
./autogen.sh
# ./autogen.sh
dh_install
override_dh_missing:
-6
View File
@@ -122,10 +122,4 @@
<qresource prefix="/qss">
<file>res/style.qss</file>
</qresource>
<qresource prefix="/qm">
<file>translations/kylin-video_zh_CN.qm</file>
<file>translations/kylin-video_fr.qm</file>
<file>translations/kylin-video_pt.qm</file>
<file>translations/kylin-video_ru.qm</file>
</qresource>
</RCC>
+2 -4
View File
@@ -37,16 +37,14 @@ QString Paths::appPath() {
QString Paths::translationPath()
{
return ":/qm/translations";
/*QString path;
QString path;
if (QDir("/usr/share/kylin-video/translations").exists()) {
path = "/usr/share/kylin-video/translations";
return path;
}
else {
return appPath() + "/translations";
}*/
}
}
QString Paths::shortcutsPath() {
+12 -16
View File
@@ -23,31 +23,32 @@
#include <QApplication>
#include <QDebug>
Translator::Translator() {
qApp->installTranslator( &app_trans );
qApp->installTranslator( &qt_trans );
Translator::Translator()
{
qApp->installTranslator(&app_trans);
qApp->installTranslator(&qt_trans);
}
Translator::~Translator() {
Translator::~Translator()
{
}
bool Translator::loadCatalog(QTranslator & t, QString name, QString locale, QString dir) {
bool Translator::loadCatalog(QTranslator & t, QString name, QString locale, QString dir)
{
QString s = name + "_" + locale + ".qm"; //.toLower();
bool r = t.load(s, dir);
if (r) {
// qDebug("Translator::loadCatalog: successfully loaded %s from %s", s.toUtf8().data(), dir.toUtf8().data());
}
else {
if (!r) {
qDebug("Translator::loadCatalog: can't load %s from %s", s.toUtf8().data(), dir.toUtf8().data());
}
return r;
}
void Translator::load(const QString &snap/*QString locale*/) {
void Translator::load(const QString &snap)
{
QString locale = QLocale::system().name();
QString trans_path = Paths::translationPath();
//edited by kobe 20160823
QString qt_trans_path;
if (!snap.isEmpty()) {
qt_trans_path = QString("%1%2").arg(snap).arg(Paths::qtTranslationPath());
@@ -56,11 +57,6 @@ void Translator::load(const QString &snap/*QString locale*/) {
qt_trans_path = Paths::qtTranslationPath();
}
// In linux try to load it first from app path (in case there's an updated
// translation), if it fails it will try then from the Qt path.
// if (! loadCatalog(qt_trans, "qt", locale, trans_path ) ) {
loadCatalog(qt_trans, "qt", locale, qt_trans_path);
// }
loadCatalog(app_trans, "kylin-video", locale, trans_path);
}
+4
View File
@@ -13,6 +13,9 @@ RESOURCES = res.qrc
DEFINES += SINGLE_INSTANCE
!system($$PWD/translations/generate_translations_pm.sh): error("Failed to generate pm")
qm_files.files = translations/*.qm
qm_files.path = /usr/share/kylin-video/translations/
inst1.files += res/kylin-video.png
inst1.path = /usr/share/pixmaps
inst2.files += ../kylin-video.desktop
@@ -21,6 +24,7 @@ target.source += $$TARGET
target.path = /usr/bin
INSTALLS += inst1 \
inst2 \
qm_files \
target
QMAKE_CPPFLAGS *= $(shell dpkg-buildflags --get CPPFLAGS)
+8
View File
@@ -0,0 +1,8 @@
#! /bin/bash
ts_file_list=(`ls translations/*.ts`)
for ts in "${ts_file_list[@]}"
do
lrelease "${ts}"
done