diff --git a/application/appRc.qrc b/application/appRc.qrc index a37b608..afa9743 100644 --- a/application/appRc.qrc +++ b/application/appRc.qrc @@ -4,5 +4,6 @@ icons/login_64.png style.css icons/settings.svg + translations/prodejna_cs_CZ.qm diff --git a/application/application.pro b/application/application.pro index 307a02c..eeb2f76 100644 --- a/application/application.pro +++ b/application/application.pro @@ -56,3 +56,7 @@ INCLUDEPATH += $$PWD/../qdecimal/decnumber RESOURCES += \ appRc.qrc + +TRANSLATIONS = translations/prodejna_cz.ts + +DISTFILES += diff --git a/application/main.cpp b/application/main.cpp index ac8a17e..6b68e87 100644 --- a/application/main.cpp +++ b/application/main.cpp @@ -1,12 +1,22 @@ #include "mainwindow.h" #include #include - -#include +#include +#include int main(int argc, char *argv[]) { QApplication a(argc, argv); + + QTranslator qtTranslator; + qtTranslator.load("qt_" + QLocale::system().name(), + QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + a.installTranslator(&qtTranslator); + + QTranslator myappTranslator; + myappTranslator.load(":/translations/prodejna_" + QLocale::system().name()); + a.installTranslator(&myappTranslator); + MainWindow w; w.move(QApplication::desktop()->screen()->rect().center() - w.rect().center()); w.show(); diff --git a/application/translations/prodejna_cs_CZ.qm b/application/translations/prodejna_cs_CZ.qm new file mode 100644 index 0000000..9d707a8 Binary files /dev/null and b/application/translations/prodejna_cs_CZ.qm differ diff --git a/application/translations/prodejna_cz.ts b/application/translations/prodejna_cz.ts new file mode 100644 index 0000000..d8234ef --- /dev/null +++ b/application/translations/prodejna_cz.ts @@ -0,0 +1,52 @@ + + + + + LoginDialog + + + + Login + Login + + + + Password + Heslo + + + + MainWindow + + + MainWindow + Nastaveni + + + + File + Soubor + + + + Exit + + + + + Open database... + + + + + Login... + + + + + + Settings + + + + diff --git a/core/autoform.h b/core/autoform.h index 7de9d38..02e944b 100644 --- a/core/autoform.h +++ b/core/autoform.h @@ -17,7 +17,7 @@ class AutoForm : public FormBinder { public: explicit AutoForm(QWidget *parent = 0) { - setParent(parent); + this->setParent(parent); m_serviceConnected = false; m_saved = false; } diff --git a/core/context.cpp b/core/context.cpp index 2052f57..58c5d22 100644 --- a/core/context.cpp +++ b/core/context.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include @@ -49,6 +50,8 @@ void Context::loadPlugins() m_plugins.append(new Users); m_plugins.append(new Roles); + qApp->installTranslator(corePlugin->translator()); + QDir pluginsDir(qApp->applicationDirPath() + "/../plugins"); foreach (QString fileName, pluginsDir.entryList(QStringList() << "*.so" << "*.dll")) { @@ -59,6 +62,9 @@ void Context::loadPlugins() IPlugin *plugin = qobject_cast(p); if (plugin != NULL) { plugin->init(pluginLoader.metaData()); + + QTranslator *translator = plugin->translator(); + qApp->installTranslator(translator); m_plugins.append(plugin); } } diff --git a/core/core.pro b/core/core.pro index 370f413..2ed2239 100644 --- a/core/core.pro +++ b/core/core.pro @@ -146,3 +146,5 @@ else:unix: LIBS += -L$$OUT_PWD/../qdecimal/lib/ -lqdecimal -ldecnumber INCLUDEPATH += $$PWD/../qdecimal/src INCLUDEPATH += $$PWD/../qdecimal/decnumber + +TRANSLATIONS = translations/core_cz.ts diff --git a/core/coreplugin.cpp b/core/coreplugin.cpp index d36d224..5c96908 100644 --- a/core/coreplugin.cpp +++ b/core/coreplugin.cpp @@ -25,3 +25,11 @@ void CorePlugin::initServiceUi() m_settingsUi = new GlobalSettingsForm(); } +QTranslator *CorePlugin::translator() +{ + QTranslator *trans = new QTranslator(); + trans->load(":/translations/core_" + QLocale::system().name()); + + return trans; +} + diff --git a/core/coreplugin.h b/core/coreplugin.h index c1b1f29..7186b0d 100644 --- a/core/coreplugin.h +++ b/core/coreplugin.h @@ -12,6 +12,10 @@ public: // IMetaDataPlugin interface protected: virtual void initServiceUi(); + + // IPlugin interface +public: + QTranslator *translator() override; }; #endif // COREPLUGIN_H diff --git a/core/iplugin.h b/core/iplugin.h index bdc0aab..4ce3014 100644 --- a/core/iplugin.h +++ b/core/iplugin.h @@ -7,6 +7,7 @@ #include #include #include +#include #include "service.h" #include "igridform.h" @@ -71,9 +72,8 @@ public: return (Service*)m_service; } - virtual QIcon pluginIcon() { - return QIcon(); - } + virtual QTranslator* translator() { return NULL; } + virtual QIcon pluginIcon() { return QIcon(); } protected: QWidget *m_ui; diff --git a/core/translations/core_cs_CZ.qm b/core/translations/core_cs_CZ.qm new file mode 100644 index 0000000..a0aa1c7 Binary files /dev/null and b/core/translations/core_cs_CZ.qm differ diff --git a/core/translations/core_cs_CZ.ts b/core/translations/core_cs_CZ.ts new file mode 100644 index 0000000..daf845e --- /dev/null +++ b/core/translations/core_cs_CZ.ts @@ -0,0 +1,330 @@ + + + + + ColumnDialog + + + Select columns + Volba sloupcu + + + + FilterDialog + + + Manage filters + + + + + Name + + + + + Filter + + + + + FilterUi + + + Form + + + + + Apply + + + + + Go + + + + + Load filter: + + + + + + Save + + + + + + Manage + + + + + Add condition "AND" + + + + + Add condition "OR" + + + + + Remove condition + + + + + OR + + + + + AND + + + + + FormDialog + + + Edit record + + + + + Validation error + + + + + GlobalSettingsForm + + + Form + + + + + Company info + + + + + IC + + + + + VAT number + + + + + VAT payer + + + + + Contact + + + + + Firm Name + + + + + Street + + + + + House Number + + + + + City + + + + + ZIP code + + + + + + Logo + + + + + Select file + + + + + GridForm + + + Form + + + + + Add record + + + + + N + + + + + Edit record + + + + + E + + + + + + Delete record + + + + + D + + + + + Filter + + + + + F + + + + + Print + + + + + P + + + + + Select columns + + + + + + Database error + + + + + Realy delete this record? + + + + + RolesForm + + + Form + + + + + Name + + + + + Active + + + + + Permissions: + + + + + SaveFilterDialog + + + + Filter name + + + + + SettingsForm + + + Settings + + + + + UserForm + + + Form + + + + + Login + + + + + Password + + + + + Name + + + + + Is Admin + + + + + Active + + + + + Roles + + + + + Retype Password + + + +