designer translate ui fixed

This commit is contained in:
Arin Alexander 2018-05-22 01:24:38 +04:00
parent b21a63e8a9
commit d460a36e45
2 changed files with 14 additions and 9 deletions

View File

@ -15,6 +15,8 @@ void DesignerSettingManager::getAviableLanguages(QList<QLocale::Language>* langu
languages->append(QLocale::Russian);
languages->append(QLocale::English);
languages->append(QLocale::Arabic);
languages->append(QLocale::French);
languages->append(QLocale::Chinese);
}
QLocale::Language DesignerSettingManager::getCurrentDefaultLanguage()

View File

@ -9,24 +9,27 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
DesignerSettingManager manager;
LimeReport::ReportEngine report;
QTranslator limeReportTranslator;
QTranslator qtTranslator;
QString translationPath = QApplication::applicationDirPath();
translationPath.append("/languages");
QString designerTranslation = QLocale(manager.getCurrentDefaultLanguage()).name();
limeReportTranslator.load("limereport_"+designerTranslation, translationPath);
a.installTranslator(&limeReportTranslator);
if (limeReportTranslator.load("limereport_"+designerTranslation, translationPath)){
QTranslator qtTranslator;
qtTranslator.load("qt_" + designerTranslation, translationPath);
a.installTranslator(&qtTranslator);
qtTranslator.load("qt_" + designerTranslation, translationPath);
a.installTranslator(&qtTranslator);
a.installTranslator(&limeReportTranslator);
Qt::LayoutDirection layoutDirection = QLocale(manager.getCurrentDefaultLanguage()).textDirection();
Qt::LayoutDirection layoutDirection = QLocale(manager.getCurrentDefaultLanguage()).textDirection();
a.setLayoutDirection(layoutDirection);
report.setPreviewLayoutDirection(layoutDirection);
}
LimeReport::ReportEngine report;
a.setLayoutDirection(layoutDirection);
report.setPreviewLayoutDirection(layoutDirection);
if (a.arguments().count()>1){
report.loadFromFile(a.arguments().at(1));