diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-03-09 16:34:49 +0100 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-03-25 19:16:29 +0100 |
commit | 753a08ae0e1204b148cf3935f87349eefe75d338 (patch) | |
tree | 193ff5b6a131bba519336c31727d708ddab43032 /src/corelib/kernel/qtranslator.cpp | |
parent | 1fefff6d1f99dbcf1a453424753ad5562fb675ef (diff) |
QtCore: replace QLatin1String/QLatin1Char with _L1/u'' where applicable
As a drive-by, did also minor refactorings/improvements.
Task-number: QTBUG-98434
Change-Id: I81964176ae2f07ea63674c96f47f9c6aa046854f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Diffstat (limited to 'src/corelib/kernel/qtranslator.cpp')
-rw-r--r-- | src/corelib/kernel/qtranslator.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 1d0c613c17..9f0ce2a825 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -485,8 +485,8 @@ bool QTranslator::load(const QString & filename, const QString & directory, QString prefix; if (QFileInfo(filename).isRelative()) { prefix = directory; - if (prefix.length() && !prefix.endsWith(QLatin1Char('/'))) - prefix += QLatin1Char('/'); + if (prefix.length() && !prefix.endsWith(u'/')) + prefix += u'/'; } const QString suffixOrDotQM = suffix.isNull() ? dotQmLiteral() : suffix; @@ -530,7 +530,7 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo QTranslatorPrivate *d = this; bool ok = false; - if (realname.startsWith(QLatin1Char(':'))) { + if (realname.startsWith(u':')) { // If the translation is in a non-compressed resource file, the data is already in // memory, so no need to use QFile to copy it again. Q_ASSERT(!d->resource); @@ -645,8 +645,8 @@ static QString find_translation(const QLocale & locale, QString path; if (QFileInfo(filename).isRelative()) { path = directory; - if (!path.isEmpty() && !path.endsWith(QLatin1Char('/'))) - path += QLatin1Char('/'); + if (!path.isEmpty() && !path.endsWith(u'/')) + path += u'/'; } const QString suffixOrDotQM = suffix.isNull() ? dotQmLiteral() : suffix; @@ -667,7 +667,7 @@ static QString find_translation(const QLocale & locale, #endif for (QString localeName : qAsConst(languages)) { - localeName.replace(QLatin1Char('-'), QLatin1Char('_')); + localeName.replace(u'-', u'_'); // try the complete locale name first and progressively truncate from // the end until a matching language tag is found (with or without suffix) @@ -682,7 +682,7 @@ static QString find_translation(const QLocale & locale, realname.truncate(realNameBaseSize); - int rightmost = localeName.lastIndexOf(QLatin1Char('_')); + int rightmost = localeName.lastIndexOf(u'_'); if (rightmost <= 0) break; // no truncations anymore, break localeName.truncate(rightmost); |