static QString dataType(const TranslatorMessage &m)
{
- QByteArray fileName = m.fileName().toAscii();
+ QByteArray fileName = m.fileName().toLatin1();
unsigned int extHash = 0;
int pos = fileName.count() - 1;
for (int pass = 0; pass < 4 && pos >=0; ++pass, --pos) {
{
// ### This needs to be reviewed, to reflect the updated XLIFF-PO spec.
if (!makePhs || ch < 7 || ch > 0x0d)
- return QString::fromAscii("&#x%1;").arg(QString::number(ch, 16));
+ return QString::fromLatin1("&#x%1;").arg(QString::number(ch, 16));
CharMnemonic cm = charCodeMnemonics[int(ch) - 7];
QString name = QLatin1String(cm.mnemonic);
char escapechar = cm.escape;
static int id = 0;
- return QString::fromAscii("<ph id=\"ph%1\" ctype=\"x-ch-%2\">\\%3</ph>")
+ return QString::fromLatin1("<ph id=\"ph%1\" ctype=\"x-ch-%2\">\\%3</ph>")
.arg(++id) .arg(name) .arg(escapechar);
}
static void writeTransUnits(QTextStream &ts, const TranslatorMessage &msg, const QRegExp &drops, int indent)
{
static int msgid;
- QString msgidstr = !msg.id().isEmpty() ? msg.id() : QString::fromAscii("_msg%1").arg(++msgid);
+ QString msgidstr = !msg.id().isEmpty() ? msg.id() : QString::fromLatin1("_msg%1").arg(++msgid);
QStringList translns = msg.translations();
QHash<QString, QString>::const_iterator it;
for (int i = 0; i < ch.count(); ++i) {
QChar chr = ch.at(i);
if (accum.endsWith(QLatin1Char('\\')))
- accum[accum.size() - 1] = QLatin1Char(charFromEscape(chr.toAscii()));
+ accum[accum.size() - 1] = QLatin1Char(charFromEscape(chr.toLatin1()));
else
accum.append(chr);
}
QCOMPARE(QObject::tr(" \tspace and tab at the start"), QString(" \tSPACE AND TAB AT THE START"));
QCOMPARE(QObject::tr(" string that does not exist"), QString(" string that does not exist"));
- QCOMPARE(QCoreApplication::translate("CubeForm", "Test"), QString::fromAscii("BBBB"));
+ QCOMPARE(QCoreApplication::translate("CubeForm", "Test"), QString::fromLatin1("BBBB"));
QCOMPARE(QCoreApplication::translate("", "Test", "Empty context"), QString("AAAA"));
// Test plurals
QString txed = QCoreApplication::translate("Plurals", "There are %n houses", 0, QCoreApplication::UnicodeUTF8, 0);
- QCOMPARE(QString::fromAscii("[%1]").arg(txed), QString("[There are 0 houses]"));
+ QCOMPARE(QString::fromLatin1("[%1]").arg(txed), QString("[There are 0 houses]"));
QCOMPARE(QCoreApplication::translate("Plurals", "There are %n houses", 0, QCoreApplication::UnicodeUTF8, 1), QString("There is 1 house"));
QCOMPARE(QCoreApplication::translate("Plurals", "There are %n houses", 0, QCoreApplication::UnicodeUTF8, 2), QString("There are 2 houses"));
QCOMPARE(QCoreApplication::translate("Plurals", "There are %n houses", 0, QCoreApplication::UnicodeUTF8, 3), QString("There are 3 houses"));
QCOMPARE(tr("There are %n cars", "More Plurals", 3) , QString("There are 3 cars"));
- QCOMPARE(QCoreApplication::translate("no_en", "Kj\370r K\345re, kj\346re"), QString::fromAscii("Drive K\345re, dear"));
- QCOMPARE(QCoreApplication::translate("en_no", "Drive K\345re, dear"), QString::fromAscii("Kj\370r K\345re, kj\346re"));
- QCOMPARE(QCoreApplication::translate("en_ch", "Chinese symbol:"), QString::fromAscii("Chinese symbol:%1").arg(QChar(0x7c1f)));
+ QCOMPARE(QCoreApplication::translate("no_en", "Kj\370r K\345re, kj\346re"), QString::fromLatin1("Drive K\345re, dear"));
+ QCOMPARE(QCoreApplication::translate("en_no", "Drive K\345re, dear"), QString::fromLatin1("Kj\370r K\345re, kj\346re"));
+ QCOMPARE(QCoreApplication::translate("en_ch", "Chinese symbol:"), QString::fromLatin1("Chinese symbol:%1").arg(QChar(0x7c1f)));
// printf("halo\r\nhallo");
// QCOMPARE(tr("This\r\nwill fail"), QString("THIS\nWILL FAIL")); // \r\n = 0d 0a
qApp->installTranslator(&translator);
QCOMPARE(QCoreApplication::translate("FooBar", "this contains an umlaut \xfc ü"),
- QString::fromAscii("random stuff with umlaut"));
+ QString::fromLatin1("random stuff with umlaut"));
QCOMPARE(QCoreApplication::translate("FooBar", "umlaut \xc3\xbc ü in utf8"),
- QString::fromAscii("more random stuff with umlaut"));
+ QString::fromLatin1("more random stuff with umlaut"));
}
void tst_lrelease::compressed()
QVERIFY(translator.load("testdata/compressed.qm"));
qApp->installTranslator(&translator);
- QCOMPARE(QCoreApplication::translate("Context1", "Foo"), QString::fromAscii("in first context"));
- QCOMPARE(QCoreApplication::translate("Context2", "Bar"), QString::fromAscii("in second context"));
+ QCOMPARE(QCoreApplication::translate("Context1", "Foo"), QString::fromLatin1("in first context"));
+ QCOMPARE(QCoreApplication::translate("Context2", "Bar"), QString::fromLatin1("in second context"));
- QCOMPARE(QCoreApplication::translate("Action1", "Component Name"), QString::fromAscii("translation in first context"));
- QCOMPARE(QCoreApplication::translate("Action2", "Component Name"), QString::fromAscii("translation in second context"));
- QCOMPARE(QCoreApplication::translate("Action3", "Component Name"), QString::fromAscii("translation in third context"));
+ QCOMPARE(QCoreApplication::translate("Action1", "Component Name"), QString::fromLatin1("translation in first context"));
+ QCOMPARE(QCoreApplication::translate("Action2", "Component Name"), QString::fromLatin1("translation in second context"));
+ QCOMPARE(QCoreApplication::translate("Action3", "Component Name"), QString::fromLatin1("translation in third context"));
}
QVERIFY(translator.load("testdata/idbased.qm"));
qApp->installTranslator(&translator);
- QCOMPARE(qtTrId("test_id"), QString::fromAscii("This is a test string."));
- QCOMPARE(qtTrId("untranslated_id"), QString::fromAscii("This has no translation."));
+ QCOMPARE(qtTrId("test_id"), QString::fromLatin1("This is a test string."));
+ QCOMPARE(qtTrId("untranslated_id"), QString::fromLatin1("This has no translation."));
}
void tst_lrelease::markuntranslated()
QVERIFY(translator.load("testdata/idbased.qm"));
qApp->installTranslator(&translator);
- QCOMPARE(qtTrId("test_id"), QString::fromAscii("This is a test string."));
- QCOMPARE(qtTrId("untranslated_id"), QString::fromAscii("#This has no translation."));
+ QCOMPARE(qtTrId("test_id"), QString::fromLatin1("This is a test string."));
+ QCOMPARE(qtTrId("untranslated_id"), QString::fromLatin1("#This has no translation."));
}
void tst_lrelease::dupes()