From 2c49209b8e33c09656f19b4f0a6089c706f36556 Mon Sep 17 00:00:00 2001 From: Zdenek Jonak Date: Wed, 9 Mar 2016 22:06:17 +0100 Subject: [PATCH] translation support fixed and new translations added --- addressbook/addressbook.cpp | 5 + addressbook/addressbook.h | 1 + addressbook/addressbook.pro | 1 + addressbook/addressbookrc.qrc | 1 + addressbook/translations/addressbook_cs_CZ.qm | Bin 0 -> 789 bytes application/translations/prodejna_cz.ts | 4 +- core/context.cpp | 5 - core/core.pro | 2 +- core/coreplugin.cpp | 7 +- core/imetadataplugin.cpp | 4 + core/iplugin.h | 7 ++ core/rc.qrc | 1 + core/translations/core_cs_CZ.qm | Bin 118 -> 3826 bytes core/translations/core_cs_CZ.ts | 119 +++++++++--------- 14 files changed, 88 insertions(+), 69 deletions(-) create mode 100644 addressbook/translations/addressbook_cs_CZ.qm 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 0000000000000000000000000000000000000000..61e7a6cc9c075653ff32b61cf8edb18c42a79f25 GIT binary patch literal 789 zcmah`O(+FX7(Le;4`V_p35&6?mz9MSULrre@|2&#FjvO=8Qqz;U}3GKY?Nfd!b(|) zVu6h;lr1a8(gNApamHd$Z$2vU`Ihl` z{?5F`A!swkNXLMvhX)^SDO1FGv@XYAEMZXDVcSZ2-n8qcyIqwP0ipp3SnSUu3lllU z3NDr)89#>{M#5S&-C48KQT|*cR~`DqD3O6a(d3&a>l5SeY4mPKdA>PlWo2QW4}PJp z7R*_=kF(bagDM^}oY=$y?*%x_b9f3Fj2<`dNpmotot7$+sreU^O{O$iE!gzM4BQNk zSPnM%+Rh32D|!=Vm!<6g6snM - - + + 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 a0aa1c79b4eab0e634f7832d23259c0a55eb6da1..a5f896d15b051ce03503a058906edb68ebecd696 100644 GIT binary patch literal 3826 zcmbVOYiJx*6h5<=-Ar~j4`P*=hB95GpokT}T2QE>*6-fg+?{BH|f6G^9tsGq3$F~|WT{Gz~Gmy~@fmFT@W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/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