0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 00:54:39 +03:00

Translation has been changed

This commit is contained in:
Arin Alexander 2018-09-06 23:07:19 +03:00
parent ea2a38758d
commit b878cf95ae
3 changed files with 16 additions and 26 deletions

View File

@ -108,20 +108,6 @@ Dialog.exec() == 1;
</scriptContext> </scriptContext>
<suppressFieldAndVarError Type="bool" Value="0"/> <suppressFieldAndVarError Type="bool" Value="0"/>
<translation Type="Translation"> <translation Type="Translation">
<Default Value="0">
<page1>
<TextItem1>
<content Checked="N" SourceValue="Test" Value="Test"/>
</TextItem1>
</page1>
</Default>
<Russian Value="96">
<page1>
<TextItem1>
<content Checked="Y" SourceValue="Test" Value="Проверка"/>
</TextItem1>
</page1>
</Russian>
</translation> </translation>
</object> </object>
</Report> </Report>

View File

@ -1010,6 +1010,7 @@ void ReportEnginePrivate::activateLanguage(QLocale::Language language)
BaseDesignIntf* item = page->childByName(itemTranslation->itemName); BaseDesignIntf* item = page->childByName(itemTranslation->itemName);
if (item) { if (item) {
foreach(PropertyTranslation* propertyTranslation, itemTranslation->propertyesTranslation){ foreach(PropertyTranslation* propertyTranslation, itemTranslation->propertyesTranslation){
if (propertyTranslation->checked)
item->setProperty(propertyTranslation->propertyName.toLatin1(), propertyTranslation->value); item->setProperty(propertyTranslation->propertyName.toLatin1(), propertyTranslation->value);
} }
} }
@ -1123,11 +1124,6 @@ ReportPages ReportEnginePrivate::renderToPages()
m_reportRender = ReportRender::Ptr(new ReportRender); m_reportRender = ReportRender::Ptr(new ReportRender);
updateTranslations(); updateTranslations();
dataManager()->clearErrors();
dataManager()->connectAllDatabases();
dataManager()->setDesignTime(false);
dataManager()->updateDatasourceModel();
connect(m_reportRender.data(),SIGNAL(pageRendered(int)), connect(m_reportRender.data(),SIGNAL(pageRendered(int)),
this, SIGNAL(renderPageFinished(int))); this, SIGNAL(renderPageFinished(int)));
@ -1152,6 +1148,11 @@ ReportPages ReportEnginePrivate::renderToPages()
if (m_scriptEngineContext->runInitScript()){ if (m_scriptEngineContext->runInitScript()){
dataManager()->clearErrors();
dataManager()->connectAllDatabases();
dataManager()->setDesignTime(false);
dataManager()->updateDatasourceModel();
activateLanguage(m_reportLanguage); activateLanguage(m_reportLanguage);
emit renderStarted(); emit renderStarted();

View File

@ -232,8 +232,8 @@ void XMLWriter::saveTranslation(QString propertyName, QObject* item, QDomElement
languageNode.appendChild(pageNode); languageNode.appendChild(pageNode);
foreach(ItemTranslation* item, page->itemsTranslation){ foreach(ItemTranslation* item, page->itemsTranslation){
QDomElement itemNode = m_doc->createElement(item->itemName); QDomElement itemNode = m_doc->createElement(item->itemName);
pageNode.appendChild(itemNode);
foreach(PropertyTranslation* property, item->propertyesTranslation){ foreach(PropertyTranslation* property, item->propertyesTranslation){
if (property->sourceValue.compare(property->value) != 0){
QDomElement propertyNode = m_doc->createElement(property->propertyName); QDomElement propertyNode = m_doc->createElement(property->propertyName);
propertyNode.setAttribute("Value",property->value); propertyNode.setAttribute("Value",property->value);
propertyNode.setAttribute("SourceValue", property->sourceValue); propertyNode.setAttribute("SourceValue", property->sourceValue);
@ -241,6 +241,9 @@ void XMLWriter::saveTranslation(QString propertyName, QObject* item, QDomElement
itemNode.appendChild(propertyNode); itemNode.appendChild(propertyNode);
} }
} }
if (!itemNode.childNodes().isEmpty())
pageNode.appendChild(itemNode);
}
} }
} }
node->appendChild(translationsNode); node->appendChild(translationsNode);