本文整理汇总了C++中TranslatorMessage::extraComment方法的典型用法代码示例。如果您正苦于以下问题:C++ TranslatorMessage::extraComment方法的具体用法?C++ TranslatorMessage::extraComment怎么用?C++ TranslatorMessage::extraComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TranslatorMessage
的用法示例。
在下文中一共展示了TranslatorMessage::extraComment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeComment
static void writeComment(QTextStream &ts, const TranslatorMessage &msg, const QRegExp &drops, int indent)
{
if (!msg.comment().isEmpty()) {
writeIndent(ts, indent);
ts << "<context-group><context context-type=\"" << contextMsgctxt << "\">"
<< protect(msg.comment(), false)
<< "</context></context-group>\n";
}
if (!msg.oldComment().isEmpty()) {
writeIndent(ts, indent);
ts << "<context-group><context context-type=\"" << contextOldMsgctxt << "\">"
<< protect(msg.oldComment(), false)
<< "</context></context-group>\n";
}
writeExtras(ts, indent, msg.extras(), drops);
if (!msg.extraComment().isEmpty()) {
writeIndent(ts, indent);
ts << "<note annotates=\"source\" from=\"developer\">"
<< protect(msg.extraComment()) << "</note>\n";
}
if (!msg.translatorComment().isEmpty()) {
writeIndent(ts, indent);
ts << "<note from=\"translator\">"
<< protect(msg.translatorComment()) << "</note>\n";
}
}
示例2: extend
void Translator::extend(const TranslatorMessage &msg, ConversionData &cd)
{
int index = find(msg);
if (index == -1) {
append(msg);
} else {
TranslatorMessage &emsg = m_messages[index];
if (emsg.sourceText().isEmpty()) {
delIndex(index);
emsg.setSourceText(msg.sourceText());
addIndex(index, msg);
} else if (!msg.sourceText().isEmpty() && emsg.sourceText() != msg.sourceText()) {
cd.appendError(QString::fromLatin1("Contradicting source strings for message with id '%1'.")
.arg(emsg.id()));
return;
}
if (emsg.extras().isEmpty()) {
emsg.setExtras(msg.extras());
} else if (!msg.extras().isEmpty() && emsg.extras() != msg.extras()) {
cd.appendError(QString::fromLatin1("Contradicting meta data for for %1.")
.arg(!emsg.id().isEmpty()
? QString::fromLatin1("message with id '%1'").arg(emsg.id())
: QString::fromLatin1("message '%1'").arg(makeMsgId(msg))));
return;
}
emsg.addReferenceUniq(msg.fileName(), msg.lineNumber());
if (!msg.extraComment().isEmpty()) {
QString cmt = emsg.extraComment();
if (!cmt.isEmpty()) {
QStringList cmts = cmt.split(QLatin1String("\n----------\n"));
if (!cmts.contains(msg.extraComment())) {
cmts.append(msg.extraComment());
cmt = cmts.join(QLatin1String("\n----------\n"));
}
} else {
cmt = msg.extraComment();
}
emsg.setExtraComment(cmt);
}
}
}
示例3: extend
void Translator::extend(const TranslatorMessage &msg)
{
int index = find(msg);
if (index == -1) {
append(msg);
} else {
TranslatorMessage &emsg = m_messages[index];
emsg.addReferenceUniq(msg.fileName(), msg.lineNumber());
if (!msg.extraComment().isEmpty()) {
QString cmt = emsg.extraComment();
if (!cmt.isEmpty())
cmt.append(QLatin1String("\n----------\n"));
cmt.append(msg.extraComment());
emsg.setExtraComment(cmt);
}
if (msg.isUtf8() != emsg.isUtf8()) {
emsg.setUtf8(true);
emsg.setNonUtf8(true);
}
}
}