diff --git a/addressbook/addressbook.cpp b/addressbook/addressbook.cpp index 552ee2d..0ffcf53 100644 --- a/addressbook/addressbook.cpp +++ b/addressbook/addressbook.cpp @@ -23,6 +23,11 @@ QIcon Addressbook::pluginIcon() return QIcon(":/icons/addressbookPlugin.svg"); } +QTranslator *Addressbook::translator() +{ + return translatorFrom(":/translations/addressbook_"); +} + diff --git a/addressbook/addressbook.h b/addressbook/addressbook.h index b07b982..ae965a8 100644 --- a/addressbook/addressbook.h +++ b/addressbook/addressbook.h @@ -27,6 +27,7 @@ protected: // IPlugin interface public: virtual QIcon pluginIcon(); + QTranslator *translator(); }; diff --git a/addressbook/addressbook.pro b/addressbook/addressbook.pro index a901d68..af561c0 100644 --- a/addressbook/addressbook.pro +++ b/addressbook/addressbook.pro @@ -67,3 +67,4 @@ FORMS += \ RESOURCES += \ addressbookrc.qrc +TRANSLATIONS = translations/addressbook_cs_CZ.ts diff --git a/addressbook/addressbookrc.qrc b/addressbook/addressbookrc.qrc index f9a5431..3b5709a 100644 --- a/addressbook/addressbookrc.qrc +++ b/addressbook/addressbookrc.qrc @@ -1,5 +1,6 @@ icons/addressbookPlugin.svg + translations/addressbook_cs_CZ.qm diff --git a/addressbook/translations/addressbook_cs_CZ.qm b/addressbook/translations/addressbook_cs_CZ.qm new file mode 100644 index 0000000..61e7a6c Binary files /dev/null and b/addressbook/translations/addressbook_cs_CZ.qm differ diff --git a/application/translations/prodejna_cz.ts b/application/translations/prodejna_cz.ts index d8234ef..907c49f 100644 --- a/application/translations/prodejna_cz.ts +++ b/application/translations/prodejna_cz.ts @@ -43,8 +43,8 @@ - - + + Settings diff --git a/core/context.cpp b/core/context.cpp index 58c5d22..be5c917 100644 --- a/core/context.cpp +++ b/core/context.cpp @@ -50,8 +50,6 @@ 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")) { @@ -62,9 +60,6 @@ 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 2ed2239..313c498 100644 --- a/core/core.pro +++ b/core/core.pro @@ -147,4 +147,4 @@ else:unix: LIBS += -L$$OUT_PWD/../qdecimal/lib/ -lqdecimal -ldecnumber INCLUDEPATH += $$PWD/../qdecimal/src INCLUDEPATH += $$PWD/../qdecimal/decnumber -TRANSLATIONS = translations/core_cz.ts +TRANSLATIONS = translations/core_cs_CZ.ts diff --git a/core/coreplugin.cpp b/core/coreplugin.cpp index 5c96908..6aa2b7c 100644 --- a/core/coreplugin.cpp +++ b/core/coreplugin.cpp @@ -1,6 +1,8 @@ #include "coreplugin.h" #include #include +#include + #include "settings/globalsettingsform.h" CorePlugin::CorePlugin() @@ -27,9 +29,6 @@ void CorePlugin::initServiceUi() QTranslator *CorePlugin::translator() { - QTranslator *trans = new QTranslator(); - trans->load(":/translations/core_" + QLocale::system().name()); - - return trans; + return translatorFrom(":/translations/core_"); } diff --git a/core/imetadataplugin.cpp b/core/imetadataplugin.cpp index 0f4fcfd..438ca92 100644 --- a/core/imetadataplugin.cpp +++ b/core/imetadataplugin.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "igridform.h" @@ -50,6 +51,9 @@ QStringList IMetaDataPlugin::dependsOn() void IMetaDataPlugin::init(const QJsonObject &metaData) { parseMetaData(metaData); + + qApp->installTranslator(this->translator()); + initServiceUi(); if (IGridForm *pluginUi = dynamic_cast(m_ui)) diff --git a/core/iplugin.h b/core/iplugin.h index 4ce3014..8b695a5 100644 --- a/core/iplugin.h +++ b/core/iplugin.h @@ -76,6 +76,13 @@ public: virtual QIcon pluginIcon() { return QIcon(); } protected: + QTranslator* translatorFrom(QString fileName) { + QTranslator *trans = new QTranslator(); + trans->load(fileName + QLocale::system().name()); + + return trans; + } + QWidget *m_ui; QWidget *m_settingsUi; IService *m_service; diff --git a/core/rc.qrc b/core/rc.qrc index 420e891..e01dea7 100644 --- a/core/rc.qrc +++ b/core/rc.qrc @@ -14,5 +14,6 @@ icons/list.svg icons/usersPlugin.svg icons/rolesPlugin.svg + translations/core_cs_CZ.qm diff --git a/core/translations/core_cs_CZ.qm b/core/translations/core_cs_CZ.qm index a0aa1c7..a5f896d 100644 Binary files a/core/translations/core_cs_CZ.qm 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 index daf845e..0af7ecc 100644 --- a/core/translations/core_cs_CZ.ts +++ b/core/translations/core_cs_CZ.ts @@ -14,17 +14,17 @@ Manage filters - + Nastavení filtrů Name - + Název Filter - + Filtr @@ -32,59 +32,59 @@ Form - + Nahrát filtr Apply - + Použít Go - + Load filter: - + Nahrát filtr: Save - + Uložit Manage - + Spravovat Add condition "AND" - + Přidat podmínku "A" Add condition "OR" - + Přidat podmínku "NEBO" Remove condition - + Odebrat podmínku OR - + NEBO AND - + A @@ -92,12 +92,17 @@ Edit record + Upravit záznam + + + + TextLabel - + Validation error - + Chyba ověření dat @@ -105,68 +110,68 @@ Form - + Company info - + Informace o společnosti IC - + IČO VAT number - + DIČ VAT payer - + Plátce DPH Contact - + Kontaktní údaje Firm Name - + Název společnosti Street - + Ulice House Number - + Číslo popisné City - + Město ZIP code - + PSČ Logo - + Logo Select file - + Vyber soubor @@ -174,74 +179,74 @@ Form - + Add record - + Přidat záznam N - + Edit record - + Upravit záznam E - + Delete record - + Smazat záznam D - + Filter - + Filtr F - + Print - + Tisk P - + Select columns - + Vybrat sloupce Database error - + Chyba databáze Realy delete this record? - + Opravdu si přejete smazat tento záznam? @@ -249,22 +254,22 @@ Form - + Name - + Název Active - + Aktivní Permissions: - + Oprávnění: @@ -273,7 +278,7 @@ Filter name - + Název filtru @@ -281,7 +286,7 @@ Settings - + Nastavení @@ -289,42 +294,42 @@ Form - + Login - + Uživatelské jméno Password - + Heslo Name - + Jméno Is Admin - + Admin Active - + Aktivní Roles - + Role Retype Password - + Zopakujte heslo