翻译文件在编译时生成
This commit is contained in:
parent
5642dc2e45
commit
d6f2adb6a9
|
@ -12,3 +12,12 @@ TRANSLATIONS += \
|
||||||
translations/kylin-nm_tr.ts \
|
translations/kylin-nm_tr.ts \
|
||||||
translations/kylin-nm_bo.ts \
|
translations/kylin-nm_bo.ts \
|
||||||
translations/kylin-nm_bo_CN.ts
|
translations/kylin-nm_bo_CN.ts
|
||||||
|
|
||||||
|
CONFIG(release, debug|release) {
|
||||||
|
!system($$PWD/translate_generation.sh): error("Failed to generate translation")
|
||||||
|
}
|
||||||
|
|
||||||
|
qm_files.path = $${PREFIX}/share/kylin-nm/kylin-nm/
|
||||||
|
qm_files.files = translations/*.qm
|
||||||
|
|
||||||
|
INSTALLS += qm_files \
|
||||||
|
|
|
@ -17,9 +17,6 @@
|
||||||
<file>res/h/right-pwd.png</file>
|
<file>res/h/right-pwd.png</file>
|
||||||
<file>res/h/show-pwd.png</file>
|
<file>res/h/show-pwd.png</file>
|
||||||
<file>res/h/no-pwd-wifi.png</file>
|
<file>res/h/no-pwd-wifi.png</file>
|
||||||
<file>translations/kylin-nm_bo.qm</file>
|
|
||||||
<file>translations/kylin-nm_tr.qm</file>
|
|
||||||
<file>translations/kylin-nm_zh_CN.qm</file>
|
|
||||||
<file>res/x/fly-mode-off.svg</file>
|
<file>res/x/fly-mode-off.svg</file>
|
||||||
<file>res/x/fly-mode-on.svg</file>
|
<file>res/x/fly-mode-on.svg</file>
|
||||||
<file>res/x/hot-spot-off.svg</file>
|
<file>res/x/hot-spot-off.svg</file>
|
||||||
|
@ -128,6 +125,5 @@
|
||||||
<file>res/s/conning-b/10.png</file>
|
<file>res/s/conning-b/10.png</file>
|
||||||
<file>res/s/conning-b/11.png</file>
|
<file>res/s/conning-b/11.png</file>
|
||||||
<file>res/s/conning-b/12.png</file>
|
<file>res/s/conning-b/12.png</file>
|
||||||
<file>translations/kylin-nm_bo_CN.qm</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
11
src/main.cpp
11
src/main.cpp
|
@ -127,7 +127,7 @@ int main(int argc, char *argv[])
|
||||||
QString locale = QLocale::system().name();
|
QString locale = QLocale::system().name();
|
||||||
QTranslator trans_global;
|
QTranslator trans_global;
|
||||||
qDebug() << "QLocale " << QLocale();
|
qDebug() << "QLocale " << QLocale();
|
||||||
if (trans_global.load(QLocale(), "kylin-nm", "_", ":/translations/"))
|
if (trans_global.load(QLocale(), "kylin-nm", "_", "/usr/share/kylin-nm/kylin-nm/"))
|
||||||
{
|
{
|
||||||
a.installTranslator(&trans_global);
|
a.installTranslator(&trans_global);
|
||||||
qDebug()<<"Translations load success";
|
qDebug()<<"Translations load success";
|
||||||
|
@ -144,6 +144,15 @@ int main(int argc, char *argv[])
|
||||||
qWarning() << "QtBase Translations load fail";
|
qWarning() << "QtBase Translations load fail";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QTranslator sdkTranslator;
|
||||||
|
if (sdkTranslator.load(QLocale(), "gui", "_", ":/translations/"))
|
||||||
|
{
|
||||||
|
a.installTranslator(&sdkTranslator);
|
||||||
|
qDebug()<<"SDK Translations load success";
|
||||||
|
} else {
|
||||||
|
qWarning() << "SDK Translations load fail";
|
||||||
|
}
|
||||||
|
|
||||||
while (!p_networkResource->NetworkManagerIsInited()) {
|
while (!p_networkResource->NetworkManagerIsInited()) {
|
||||||
::usleep(1000);
|
::usleep(1000);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ts_list=(`ls translations/*.ts`)
|
||||||
|
source /etc/os-release
|
||||||
|
version=(`echo $ID`)
|
||||||
|
|
||||||
|
for ts in "${ts_list[@]}"
|
||||||
|
do
|
||||||
|
printf "\nprocess ${ts}\n"
|
||||||
|
if [ "$version" == "fedora" ] || [ "$version" == "opensuse-leap" ] || [ "$version" == "opensuse-tumbleweed" ];then
|
||||||
|
lrelease-qt5 "${ts}"
|
||||||
|
else
|
||||||
|
lrelease "${ts}"
|
||||||
|
fi
|
||||||
|
done
|
|
@ -1 +0,0 @@
|
||||||
<クdハ<>箆!ソ`。スン
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue