Skip to content

Commit

Permalink
Modify translate
Browse files Browse the repository at this point in the history
  • Loading branch information
KangLin committed Aug 5, 2020
1 parent 81931b5 commit e10c401
Show file tree
Hide file tree
Showing 15 changed files with 1,509 additions and 1,349 deletions.
9 changes: 8 additions & 1 deletion App/Resource/Translations/RabbitImApp_zh_CN.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN">
<context>
<name>CAndroidNotification</name>
<message>
<source>RabbitIm</source>
<translation type="vanished">玉兔即时通讯</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../../main.cpp" line="53"/>
<source>Rabbit immediate communicate</source>
<translation type="unfinished"></translation>
<translation>玉兔即时通讯</translation>
</message>
</context>
</TS>
9 changes: 8 additions & 1 deletion App/Resource/Translations/RabbitImApp_zh_TW.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_TW">
<context>
<name>CAndroidNotification</name>
<message>
<source>RabbitIm</source>
<translation type="vanished">玉兔即時通訊</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../../main.cpp" line="53"/>
<source>Rabbit immediate communicate</source>
<translation type="unfinished"></translation>
<translation>玉兔即時通訊</translation>
</message>
</context>
</TS>
17 changes: 13 additions & 4 deletions App/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ int main(int argc, char *argv[])
#if defined(ANDROID) || defined(RABBITIM_STATIC)
Q_INIT_RESOURCE(Resource);
//Q_INIT_RESOURCE(style);

#endif

#ifdef DEBUG
Q_INIT_RESOURCE(translations_RabbitImApp);
#endif
#endif

QApplication app(argc, argv);
Expand All @@ -47,7 +49,8 @@ int main(int argc, char *argv[])

QTranslator translator;
translator.load(RabbitCommon::CDir::Instance()->GetDirTranslations()
+ QDir::separator() + "RabbitImApp_" + QLocale::system().name() + ".qm");
+ QDir::separator() + "RabbitImApp_"
+ QLocale::system().name() + ".qm");
qApp->installTranslator(&translator);

app.setApplicationDisplayName(QObject::tr("Rabbit immediate communicate"));
Expand Down Expand Up @@ -90,7 +93,7 @@ int main(int argc, char *argv[])
MainWindow w;
#ifndef MOBILE
//加载窗口位置
QSettings conf(CGlobalDir::Instance()->GetApplicationConfigureFile(),
QSettings conf(RabbitCommon::CDir::Instance()->GetFileUserConfigure(),
QSettings::IniFormat);
QScreen *pScreen = QGuiApplication::primaryScreen();

Expand Down Expand Up @@ -128,5 +131,11 @@ int main(int argc, char *argv[])
player.show();
#endif
//*/
return app.exec();
int nRet = app.exec();

#ifdef DEBUG
Q_CLEANUP_RESOURCE(translations_RabbitImApp);
#endif

return nRet;
}
3 changes: 2 additions & 1 deletion Plugin/PluginApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <QSettings>
#include <QTranslator>
#include <QSharedPointer>
#include "RabbitCommonDir.h"

CPluginApp::CPluginApp()
{
Expand Down Expand Up @@ -43,7 +44,7 @@ int CPluginApp::ClearInstance()
int CPluginApp::LoadTranslate(const QString &szDir)
{
//初始化翻译
QSettings conf(CGlobalDir::Instance()->GetApplicationConfigureFile(), QSettings::IniFormat);
QSettings conf(RabbitCommon::CDir::Instance()->GetFileUserConfigure(), QSettings::IniFormat);
QString szLocale = conf.value("Global/Language", QLocale::system().name()).toString();

if("Default" == szLocale)
Expand Down
4 changes: 3 additions & 1 deletion Plugin/PluginProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <QSettings>
#include <QSharedPointer>

#include "RabbitCommonDir.h"

CPluginProtocol::CPluginProtocol()
{
}
Expand Down Expand Up @@ -34,7 +36,7 @@ int CPluginProtocol::ClearInstance()
int CPluginProtocol::LoadTranslate(const QString &szDir)
{
//初始化翻译
QSettings conf(CGlobalDir::Instance()->GetApplicationConfigureFile(), QSettings::IniFormat);
QSettings conf(RabbitCommon::CDir::Instance()->GetFileUserConfigure(), QSettings::IniFormat);
QString szLocale = conf.value("Global/Language", QLocale::system().name()).toString();

if("Default" == szLocale)
Expand Down
Loading

0 comments on commit e10c401

Please sign in to comment.