translation support fixed and new translations added

print
Zdenek Jonak 9 years ago
parent fe1671d91e
commit 2c49209b8e

@ -23,6 +23,11 @@ QIcon Addressbook::pluginIcon()
return QIcon(":/icons/addressbookPlugin.svg");
}
QTranslator *Addressbook::translator()
{
return translatorFrom(":/translations/addressbook_");
}

@ -27,6 +27,7 @@ protected:
// IPlugin interface
public:
virtual QIcon pluginIcon();
QTranslator *translator();
};

@ -67,3 +67,4 @@ FORMS += \
RESOURCES += \
addressbookrc.qrc
TRANSLATIONS = translations/addressbook_cs_CZ.ts

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>icons/addressbookPlugin.svg</file>
<file>translations/addressbook_cs_CZ.qm</file>
</qresource>
</RCC>

@ -43,8 +43,8 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="105"/>
<location filename="../mainwindow.ui" line="108"/>
<location filename="../mainwindow.ui" line="109"/>
<location filename="../mainwindow.ui" line="112"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>

@ -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<IPlugin*>(p);
if (plugin != NULL) {
plugin->init(pluginLoader.metaData());
QTranslator *translator = plugin->translator();
qApp->installTranslator(translator);
m_plugins.append(plugin);
}
}

@ -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

@ -1,6 +1,8 @@
#include "coreplugin.h"
#include <QJsonDocument>
#include <QFile>
#include <QApplication>
#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_");
}

@ -4,6 +4,7 @@
#include <QJsonArray>
#include <QLocale>
#include <QDebug>
#include <QApplication>
#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<IGridForm*>(m_ui))

@ -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;

@ -14,5 +14,6 @@
<file>icons/list.svg</file>
<file>icons/usersPlugin.svg</file>
<file>icons/rolesPlugin.svg</file>
<file>translations/core_cs_CZ.qm</file>
</qresource>
</RCC>

Binary file not shown.

@ -14,17 +14,17 @@
<message>
<location filename="../filterdialog.ui" line="14"/>
<source>Manage filters</source>
<translation type="unfinished"></translation>
<translation>Nastavení filtrů</translation>
</message>
<message>
<location filename="../filterdialog.cpp" line="63"/>
<source>Name</source>
<translation type="unfinished"></translation>
<translation>Název</translation>
</message>
<message>
<location filename="../filterdialog.cpp" line="63"/>
<source>Filter</source>
<translation type="unfinished"></translation>
<translation>Filtr</translation>
</message>
</context>
<context>
@ -32,59 +32,59 @@
<message>
<location filename="../filterui.ui" line="14"/>
<source>Form</source>
<translation type="unfinished"></translation>
<translation>Nahrát filtr</translation>
</message>
<message>
<location filename="../filterui.ui" line="71"/>
<source>Apply</source>
<translation type="unfinished"></translation>
<translation>Použít</translation>
</message>
<message>
<location filename="../filterui.ui" line="74"/>
<source>Go</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../filterui.ui" line="97"/>
<source>Load filter:</source>
<translation type="unfinished"></translation>
<translation>Nahrát filtr:</translation>
</message>
<message>
<location filename="../filterui.ui" line="117"/>
<location filename="../filterui.ui" line="120"/>
<source>Save</source>
<translation type="unfinished"></translation>
<translation>Uložit</translation>
</message>
<message>
<location filename="../filterui.ui" line="140"/>
<location filename="../filterui.ui" line="143"/>
<source>Manage</source>
<translation type="unfinished"></translation>
<translation>Spravovat</translation>
</message>
<message>
<location filename="../filterui.ui" line="209"/>
<source>Add condition &quot;AND&quot;</source>
<translation type="unfinished"></translation>
<translation>Přidat podmínku &quot;A&quot;</translation>
</message>
<message>
<location filename="../filterui.ui" line="214"/>
<source>Add condition &quot;OR&quot;</source>
<translation type="unfinished"></translation>
<translation>Přidat podmínku &quot;NEBO&quot;</translation>
</message>
<message>
<location filename="../filterui.ui" line="219"/>
<source>Remove condition</source>
<translation type="unfinished"></translation>
<translation>Odebrat podmínku</translation>
</message>
<message>
<location filename="../filterui.cpp" line="88"/>
<source>OR</source>
<translation type="unfinished"></translation>
<translation>NEBO</translation>
</message>
<message>
<location filename="../filterui.cpp" line="88"/>
<source>AND</source>
<translation type="unfinished"></translation>
<translation>A</translation>
</message>
</context>
<context>
@ -92,12 +92,17 @@
<message>
<location filename="../formdialog.ui" line="17"/>
<source>Edit record</source>
<translation>Upravit záznam</translation>
</message>
<message>
<location filename="../formdialog.ui" line="64"/>
<source>TextLabel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../formdialog.cpp" line="32"/>
<location filename="../formdialog.cpp" line="36"/>
<source>Validation error</source>
<translation type="unfinished"></translation>
<translation>Chyba ověření dat</translation>
</message>
</context>
<context>
@ -105,68 +110,68 @@
<message>
<location filename="../settings/globalsettingsform.ui" line="14"/>
<source>Form</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../settings/globalsettingsform.ui" line="20"/>
<source>Company info</source>
<translation type="unfinished"></translation>
<translation>Informace o společnosti</translation>
</message>
<message>
<location filename="../settings/globalsettingsform.ui" line="26"/>
<source>IC</source>
<translation type="unfinished"></translation>
<translation>IČO</translation>
</message>
<message>
<location filename="../settings/globalsettingsform.ui" line="36"/>
<source>VAT number</source>
<translation type="unfinished"></translation>
<translation>DIČ</translation>
</message>
<message>
<location filename="../settings/globalsettingsform.ui" line="46"/>
<source>VAT payer</source>
<translation type="unfinished"></translation>
<translation>Plátce DPH</translation>
</message>
<message>
<location filename="../settings/globalsettingsform.ui" line="56"/>
<source>Contact</source>
<translation type="unfinished"></translation>
<translation>Kontaktní údaje</translation>
</message>
<message>
<location filename="../settings/globalsettingsform.ui" line="62"/>
<source>Firm Name</source>
<translation type="unfinished"></translation>
<translation>Název společnosti</translation>
</message>
<message>
<location filename="../settings/globalsettingsform.ui" line="72"/>
<source>Street</source>
<translation type="unfinished"></translation>
<translation>Ulice</translation>
</message>
<message>
<location filename="../settings/globalsettingsform.ui" line="82"/>
<source>House Number</source>
<translation type="unfinished"></translation>
<translation>Číslo popisné</translation>
</message>
<message>
<location filename="../settings/globalsettingsform.ui" line="92"/>
<source>City</source>
<translation type="unfinished"></translation>
<translation>Město</translation>
</message>
<message>
<location filename="../settings/globalsettingsform.ui" line="102"/>
<source>ZIP code</source>
<translation type="unfinished"></translation>
<translation>PSČ</translation>
</message>
<message>
<location filename="../settings/globalsettingsform.ui" line="115"/>
<location filename="../settings/globalsettingsform.ui" line="121"/>
<source>Logo</source>
<translation type="unfinished"></translation>
<translation>Logo</translation>
</message>
<message>
<location filename="../settings/globalsettingsform.ui" line="128"/>
<source>Select file</source>
<translation type="unfinished"></translation>
<translation>Vyber soubor</translation>
</message>
</context>
<context>
@ -174,74 +179,74 @@
<message>
<location filename="../gridform.ui" line="14"/>
<source>Form</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../gridform.ui" line="23"/>
<source>Add record</source>
<translation type="unfinished"></translation>
<translation>Přidat záznam</translation>
</message>
<message>
<location filename="../gridform.ui" line="29"/>
<source>N</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../gridform.ui" line="52"/>
<source>Edit record</source>
<translation type="unfinished"></translation>
<translation>Upravit záznam</translation>
</message>
<message>
<location filename="../gridform.ui" line="55"/>
<source>E</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../gridform.ui" line="75"/>
<location filename="../gridform.h" line="188"/>
<source>Delete record</source>
<translation type="unfinished"></translation>
<translation>Smazat záznam</translation>
</message>
<message>
<location filename="../gridform.ui" line="78"/>
<source>D</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../gridform.ui" line="98"/>
<source>Filter</source>
<translation type="unfinished"></translation>
<translation>Filtr</translation>
</message>
<message>
<location filename="../gridform.ui" line="101"/>
<source>F</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../gridform.ui" line="124"/>
<source>Print</source>
<translation type="unfinished"></translation>
<translation>Tisk</translation>
</message>
<message>
<location filename="../gridform.ui" line="127"/>
<source>P</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../gridform.ui" line="190"/>
<source>Select columns</source>
<translation type="unfinished"></translation>
<translation>Vybrat sloupce</translation>
</message>
<message>
<location filename="../gridform.h" line="138"/>
<location filename="../gridform.h" line="141"/>
<source>Database error</source>
<translation type="unfinished"></translation>
<translation>Chyba databáze</translation>
</message>
<message>
<location filename="../gridform.h" line="188"/>
<source>Realy delete this record?</source>
<translation type="unfinished"></translation>
<translation>Opravdu si přejete smazat tento záznam?</translation>
</message>
</context>
<context>
@ -249,22 +254,22 @@
<message>
<location filename="../roles/rolesform.ui" line="14"/>
<source>Form</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../roles/rolesform.ui" line="23"/>
<source>Name</source>
<translation type="unfinished"></translation>
<translation>Název</translation>
</message>
<message>
<location filename="../roles/rolesform.ui" line="33"/>
<source>Active</source>
<translation type="unfinished"></translation>
<translation>Aktivní</translation>
</message>
<message>
<location filename="../roles/rolesform.ui" line="52"/>
<source>Permissions:</source>
<translation type="unfinished"></translation>
<translation>Oprávnění:</translation>
</message>
</context>
<context>
@ -273,7 +278,7 @@
<location filename="../savefilterdialog.ui" line="14"/>
<location filename="../savefilterdialog.ui" line="23"/>
<source>Filter name</source>
<translation type="unfinished"></translation>
<translation>Název filtru</translation>
</message>
</context>
<context>
@ -281,7 +286,7 @@
<message>
<location filename="../settingsform.ui" line="17"/>
<source>Settings</source>
<translation type="unfinished"></translation>
<translation>Nastavení</translation>
</message>
</context>
<context>
@ -289,42 +294,42 @@
<message>
<location filename="../users/userform.ui" line="14"/>
<source>Form</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../users/userform.ui" line="20"/>
<source>Login</source>
<translation type="unfinished"></translation>
<translation>Uživatelské jméno</translation>
</message>
<message>
<location filename="../users/userform.ui" line="30"/>
<source>Password</source>
<translation type="unfinished"></translation>
<translation>Heslo</translation>
</message>
<message>
<location filename="../users/userform.ui" line="44"/>
<source>Name</source>
<translation type="unfinished"></translation>
<translation>Jméno</translation>
</message>
<message>
<location filename="../users/userform.ui" line="57"/>
<source>Is Admin</source>
<translation type="unfinished"></translation>
<translation>Admin</translation>
</message>
<message>
<location filename="../users/userform.ui" line="67"/>
<source>Active</source>
<translation type="unfinished"></translation>
<translation>Aktivní</translation>
</message>
<message>
<location filename="../users/userform.ui" line="77"/>
<source>Roles</source>
<translation type="unfinished"></translation>
<translation>Role</translation>
</message>
<message>
<location filename="../users/userform.ui" line="91"/>
<source>Retype Password</source>
<translation type="unfinished"></translation>
<translation>Zopakujte heslo</translation>
</message>
</context>
</TS>

Loading…
Cancel
Save