New test localization (checking html tags mismatch).
--HG-- branch : develop
This commit is contained in:
parent
da4bf27c75
commit
19b880ad76
|
@ -5541,7 +5541,7 @@ Vuoi salvare i cambiamenti?</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source><html><head/><body><p>Mode for working with pattern pieces. These pattern pieces are base for going to the next stage &quot;Details mode&quot;. Before you will be able to enable the &quot;Details mode&quot; need create at least one detail.</p></body></html></source>
|
<source><html><head/><body><p>Mode for working with pattern pieces. These pattern pieces are base for going to the next stage &quot;Details mode&quot;. Before you will be able to enable the &quot;Details mode&quot; need create at least one detail.</p></body></html></source>
|
||||||
<translation><html> <head /> <body> <p> Modalità per lavorare con i pezzi del modello. Questi pezzi del modello sono la base per andare alla fase successiva &quot; dettagli mode&quot;. Prima si sarà in grado di abilitare i &quot; Dettagli mode&quot; devono creare almeno un dettaglio. </ p> </ body> </ html></translation>
|
<translation><html> <head/> <body> <p> Modalità per lavorare con i pezzi del modello. Questi pezzi del modello sono la base per andare alla fase successiva &quot; dettagli mode&quot;. Prima si sarà in grado di abilitare i &quot; Dettagli mode&quot; devono creare almeno un dettaglio. </p> </body> </html></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source><html><head/><body><p>Mode for working with details. Before you will be able to enable the &quot;Details mode&quot; need create at least one detail on the stage &quot;Draw mode&quot;. Details created on this stage will be used for creating a layout. </p></body></html></source>
|
<source><html><head/><body><p>Mode for working with details. Before you will be able to enable the &quot;Details mode&quot; need create at least one detail on the stage &quot;Draw mode&quot;. Details created on this stage will be used for creating a layout. </p></body></html></source>
|
||||||
|
|
|
@ -411,7 +411,7 @@
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
||||||
<translation><html><head/><body><р>Показать полный расчет в окне сообщения</p></body</html></translation>
|
<translation><html><head/><body><p>Показать полный расчет в окне сообщения</p></body></html></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Point label</source>
|
<source>Point label</source>
|
||||||
|
@ -929,7 +929,7 @@
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
||||||
<translation><html><head/><body><р>Показать полный расчет в окне сообщения</p></body</html></translation>
|
<translation><html><head/><body><p>Показать полный расчет в окне сообщения</p></body></html></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Axis point</source>
|
<source>Axis point</source>
|
||||||
|
@ -2483,7 +2483,7 @@ Apply settings anyway?</source>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
||||||
<translation><html><head/><body><р>Показать полный расчет в окне сообщения</p></body</html></translation>
|
<translation><html><head/><body><p>Показать полный расчет в окне сообщения</p></body></html></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Axis point</source>
|
<source>Axis point</source>
|
||||||
|
@ -3268,7 +3268,7 @@ Apply settings anyway?</source>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
||||||
<translation><html><head/><body><р>Показать полный расчёт в окне сообщения</p></body</html></translation>
|
<translation><html><head/><body><p>Показать полный расчёт в окне сообщения</p></body></html></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Point label</source>
|
<source>Point label</source>
|
||||||
|
@ -3714,7 +3714,7 @@ Apply settings anyway?</source>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
||||||
<translation type="unfinished"></translation>
|
<translation><html><head/><body><p>Показать полный расчет в окне сообщения</p></body></html></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Origin Point:</source>
|
<source>Origin Point:</source>
|
||||||
|
@ -4081,7 +4081,7 @@ Apply settings anyway?</source>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
||||||
<translation type="unfinished"></translation>
|
<translation><html><head/><body><p>Показать полный расчет в окне сообщения</p></body></html></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Edit first control point angle</source>
|
<source>Edit first control point angle</source>
|
||||||
|
@ -4200,7 +4200,7 @@ Apply settings anyway?</source>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
<source><html><head/><body><p>Show full calculation in message box</p></body></html></source>
|
||||||
<translation type="unfinished"></translation>
|
<translation><html><head/><body><p>Показать полный расчет в окне сообщения</p></body></html></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Edit first control point angle</source>
|
<source>Edit first control point angle</source>
|
||||||
|
|
|
@ -392,6 +392,98 @@ void TST_TSTranslation::TestPunctuation()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TST_TSTranslation::TestHTMLTags_data()
|
||||||
|
{
|
||||||
|
const QStringList locales = SupportedLocales();
|
||||||
|
|
||||||
|
{
|
||||||
|
QDir dir(TS_DIR);
|
||||||
|
const QStringList fileNames = dir.entryList(QStringList("valentina*.ts"));
|
||||||
|
QVERIFY2(locales.size() == fileNames.size()-1, "Unexpected count of files.");
|
||||||
|
}
|
||||||
|
|
||||||
|
QTest::addColumn<QString>("source");
|
||||||
|
QTest::addColumn<QString>("translation");
|
||||||
|
|
||||||
|
for(int j = 0; j < locales.size(); ++j)
|
||||||
|
{
|
||||||
|
const QString filename = QString("valentina_%1.ts").arg(locales.at(j));
|
||||||
|
|
||||||
|
const QDomNodeList messages = LoadTSFile(filename);
|
||||||
|
if (messages.isEmpty())
|
||||||
|
{
|
||||||
|
QFAIL("Can't begin test.");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (qint32 i = 0, num = messages.size(); i < num; ++i)
|
||||||
|
{
|
||||||
|
const QDomElement message = messages.at(i).toElement();
|
||||||
|
if (message.isNull() == false)
|
||||||
|
{
|
||||||
|
const QString source = message.firstChildElement(TagSource).text();
|
||||||
|
if (source.isEmpty())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QDomElement translationTag = message.firstChildElement(TagTranslation);
|
||||||
|
if (translationTag.hasAttribute(AttrType))
|
||||||
|
{
|
||||||
|
const QString attrVal = translationTag.attribute(AttrType);
|
||||||
|
if (attrVal == AttrValVanished || attrVal == AttrValUnfinished || attrVal == AttrValObsolete)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const QString translation = translationTag.text();
|
||||||
|
if (translation.isEmpty())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString message = QString("File '%1'.").arg(filename);
|
||||||
|
QTest::newRow(qUtf8Printable(message)) << source << translation;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const QString message = QString("File '%2'. Message %1 is null.").arg(i).arg(filename);
|
||||||
|
QFAIL(qUtf8Printable(message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TST_TSTranslation::TestHTMLTags()
|
||||||
|
{
|
||||||
|
QFETCH(QString, source);
|
||||||
|
QFETCH(QString, translation);
|
||||||
|
|
||||||
|
static const QStringList tags = QStringList() << QLatin1String("p")
|
||||||
|
<< QLatin1String("html")
|
||||||
|
<< QLatin1String("body");
|
||||||
|
static const QString pattern("{1}.*>");
|
||||||
|
for (int i=0; i < tags.size(); ++i)
|
||||||
|
{
|
||||||
|
const QRegularExpression openRegex(QLatin1String("<") + tags.at(i) + pattern,
|
||||||
|
QRegularExpression::DotMatchesEverythingOption);
|
||||||
|
if (source.contains(openRegex))
|
||||||
|
{
|
||||||
|
const int countOpenTag = source.count(openRegex);
|
||||||
|
const QRegularExpression closeRegex(QLatin1String("</") + tags.at(i) + pattern,
|
||||||
|
QRegularExpression::DotMatchesEverythingOption);
|
||||||
|
const int countCloseTag = translation.count(closeRegex);
|
||||||
|
if (not translation.contains(closeRegex) || countCloseTag != countOpenTag)
|
||||||
|
{
|
||||||
|
const QString message = QString("Tag mismatch. Tag: '<%1>'. ").arg(tags.at(i)) +
|
||||||
|
QString("Original name:'%1'").arg(source) + QString(", translated name:'%1'").arg(translation);
|
||||||
|
QFAIL(qUtf8Printable(message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomNodeList TST_TSTranslation::LoadTSFile(const QString &filename)
|
QDomNodeList TST_TSTranslation::LoadTSFile(const QString &filename)
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,8 @@ private slots:
|
||||||
void CheckPlaceMarkerExist();
|
void CheckPlaceMarkerExist();
|
||||||
void TestPunctuation_data();
|
void TestPunctuation_data();
|
||||||
void TestPunctuation();
|
void TestPunctuation();
|
||||||
|
void TestHTMLTags_data();
|
||||||
|
void TestHTMLTags();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(TST_TSTranslation)
|
Q_DISABLE_COPY(TST_TSTranslation)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user