KI18n
klocalizedstring.cpp
46 static void splitLocale(const QString &aLocale, QString &language, QString &country, QString &modifier, QString &charset)
113 static void appendLanguagesFromVariable(QStringList &languages, const char *envar, bool isList = false)
204 QString toString(const QByteArray &domain, const QStringList &languages, Kuit::VisualFormat format, bool isArgument = false) const;
205 QString substituteSimple(const QString &translation, const QStringList &arguments, QChar plchar = QLatin1Char('%'), bool isPartial = false) const;
206 QString formatMarkup(const QByteArray &domain, const QString &language, const QString &context, const QString &text, Kuit::VisualFormat format) const;
350 KLocalizedString::KLocalizedString(const char *domain, const char *context, const char *text, const char *plural, bool markupAware)
418 msgstr = msgid_plural.isNull() || n == 1 ? QString::fromUtf8(msgid) : QString::fromUtf8(msgid_plural);
422 qCWarning(KI18N) << "KLocalizedString: Using an empty domain, fix the code. msgid:" << msgid << "msgid_plural:" << msgid_plural
473 QString KLocalizedStringPrivate::toString(const QByteArray &domain, const QStringList &languages, Kuit::VisualFormat format, bool isArgument) const
491 qCWarning(KI18N) << "Plural argument to message" << shortenMessage(QString::fromUtf8(text)) << "not supplied before conversion.";
508 translateRaw(resolvedDomain, resolvedLanguages, context, text, plural, number, language, rawTranslation);
540 qCWarning(KI18N) << "Scripted message" << shortenMessage(translation) << "without ordinary translation, discarded.";
541 translation = plural.isEmpty() || number == 1 ? QString::fromUtf8(text) : QString::fromUtf8(plural);
555 QString resdArg = kls.d->toString(kls.d->domain, resolvedLanguages, resolvedFormat, isArgumentSub);
576 finalTranslation = formatMarkup(resolvedDomain, language, QString::fromUtf8(context), finalTranslation, resolvedFormat);
583 scriptedTranslation = substituteTranscript(scriptedTranslation, language, country, finalTranslation, resolvedArguments, resolvedValues, fallback);
589 scriptedTranslation = formatMarkup(resolvedDomain, language, QString::fromUtf8(context), scriptedTranslation, resolvedFormat);
607 QString KLocalizedStringPrivate::substituteSimple(const QString &translation, const QStringList &arguments, QChar plchar, bool isPartial) const
704 qCWarning(KI18N).nospace() << "Placeholder %" << QString::number(i + 1) << " skipped in message " << shortenMessage(translation);
710 qCWarning(KI18N) << arguments.size() << "instead of" << ords.size() << "arguments to message" << shortenMessage(translation)
769 QString ptext = substituteSimple(scriptedTranslation.mid(ppos, tpos - ppos), arguments, s->scriptPlchar, true);
775 tpos = resolveInterpolation(scriptedTranslation, tpos, language, country, ordinaryTranslation, arguments, values, result, fallbackLocal);
796 finalTranslation.append(substituteSimple(scriptedTranslation.mid(ppos), arguments, s->scriptPlchar, true));
835 qCWarning(KI18N) << "Unclosed interpolation" << scriptedTranslation.mid(pos, tpos - pos) << "in message" << shortenMessage(scriptedTranslation);
851 while (!scriptedTranslation[tpos].isSpace() && scriptedTranslation.mid(tpos, ielen) != s->endInterp) {
864 qCWarning(KI18N) << "Unclosed quote in interpolation" << scriptedTranslation.mid(pos, tpos - pos) << "in message"
876 tpos = resolveInterpolation(scriptedTranslation, tpos, language, country, ordinaryTranslation, arguments, values, resultLocal, fallbackLocal);
899 qCWarning(KI18N) << "Non-terminated interpolation" << scriptedTranslation.mid(pos, tpos - pos) << "in message"
959 qCWarning(KI18N) << "Interpolation" << scriptedTranslation.mid(pos, tpos - pos) << "in" << shortenMessage(scriptedTranslation)
1040 qCWarning(KI18N) << "Post call" << pcall << "for message" << shortenMessage(msgid) << "failed:" << scriptError;
1077 KLocalizedString KLocalizedString::subs(uint a, int fieldWidth, int base, QChar fillChar) const
1086 KLocalizedString KLocalizedString::subs(long a, int fieldWidth, int base, QChar fillChar) const
1095 KLocalizedString KLocalizedString::subs(ulong a, int fieldWidth, int base, QChar fillChar) const
1104 KLocalizedString KLocalizedString::subs(qlonglong a, int fieldWidth, int base, QChar fillChar) const
1113 KLocalizedString KLocalizedString::subs(qulonglong a, int fieldWidth, int base, QChar fillChar) const
1122 KLocalizedString KLocalizedString::subs(double a, int fieldWidth, char format, int precision, QChar fillChar) const
1125 kls.d->arguments.append(QStringLiteral("%L1").arg(a, fieldWidth, format, precision, fillChar));
1140 KLocalizedString KLocalizedString::subs(const QString &a, int fieldWidth, QChar fillChar) const
1150 KLocalizedString KLocalizedString::subs(const KLocalizedString &a, int fieldWidth, QChar fillChar) const
1235 return language == s->codeLanguage || !KCatalog::catalogLocaleDir(s->applicationDomain, language).isEmpty();
1255 const KCatalog &KLocalizedStringPrivate::getCatalog(const QByteArray &domain, const QString &language)
1273 void KLocalizedStringPrivate::locateScriptingModule(const QByteArray &domain, const QString &language)
1280 QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("locale/%1/%2/%3/%3.js").arg(language, s->scriptDir, QLatin1String{domain}));
1364 QString KLocalizedString::translateQt(const char *context, const char *sourceText, const char *comment, int n)
1409 KLocalizedStringPrivate::translateRaw(domain, s->languages, comment, sourceText, nullptr, 0, language, translation);
1413 KLocalizedStringPrivate::translateRaw(domain, s->languages, context, sourceText, nullptr, 0, language, translation);
1416 KLocalizedStringPrivate::translateRaw(domain, s->languages, nullptr, sourceText, nullptr, 0, language, translation);
1502 KLocalizedString ki18ndcp(const char *domain, const char *context, const char *singular, const char *plural)
1542 KLocalizedString kxi18ndcp(const char *domain, const char *context, const char *singular, const char *plural)
void append(const T &value)
QString path() const const
bool isNull() const const
const T value(const Key &key) const const
int toInt(bool *ok, int base) const const
QStringView country(QStringView ifopt)
bool isValid() const const
QString number(int n, int base)
Class for producing and handling localized messages.
Definition: klocalizedstring.h:98
QString fromUtf8(const char *str, int size)
KLocalizedString KI18N_EXPORT ki18nc(const char *context, const char *text)
Create non-finalized translated string with context.
Definition: klocalizedstring.cpp:1472
KLocalizedString withDomain(const char *domain) const
Indicate to look for translation in the given domain.
Definition: klocalizedstring.cpp:1054
KLocalizedString KI18N_EXPORT kxi18ndc(const char *domain, const char *context, const char *text)
Create non-finalized markup-aware translated string from domain with context.
Definition: klocalizedstring.cpp:1532
bool isDir() const const
KLocalizedString KI18N_EXPORT kxi18ndcp(const char *domain, const char *context, const char *singular, const char *plural)
Create non-finalized markup-aware translated string from domain with context and plural.
Definition: klocalizedstring.cpp:1542
QStringList split(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
KLocalizedString KI18N_EXPORT kxi18n(const char *text)
Create non-finalized markup-aware translated string.
Definition: klocalizedstring.cpp:1507
KLocalizedString & operator=(const KLocalizedString &rhs)
Assignment operator.
Definition: klocalizedstring.cpp:371
KLocalizedString relaxSubs() const
Relax matching between placeholders and arguments.
Definition: klocalizedstring.cpp:1171
void clear()
KLocalizedString KI18N_EXPORT ki18ndc(const char *domain, const char *context, const char *text)
Create non-finalized translated string from domain with context.
Definition: klocalizedstring.cpp:1492
static void addDomainLocaleDir(const QByteArray &domain, const QString &path)
Load locales for a domain from a specific location This is useful for resources which have their tran...
Definition: klocalizedstring.cpp:1462
static bool isApplicationTranslatedInto(const QString &language)
Check whether the translation catalog file in the given language for the set application translation ...
Definition: klocalizedstring.cpp:1231
QStringView left(qsizetype length) const const
QString locate(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options)
KLocalizedString ignoreMarkup() const
Do not resolve KUIT markup.
Definition: klocalizedstring.cpp:1178
bool isFile() const const
KLocalizedString subs(int a, int fieldWidth=0, int base=10, QChar fillChar=QLatin1Char(' ')) const
Substitute an int argument into the message.
Definition: klocalizedstring.cpp:1068
QByteArray untranslatedText() const
Returns the untranslated text.
Definition: klocalizedstring.cpp:1185
Q_GLOBAL_STATIC(Internal::StaticControl, s_instance) class ControlPrivate
QLocale system()
static void removeQtDomain(const char *domain)
Remove a domain from Qt translation lookup.
Definition: klocalizedstring.cpp:1448
int size() const const
KLocalizedString KI18N_EXPORT ki18ncp(const char *context, const char *singular, const char *plural)
Create non-finalized translated string with context and plural.
Definition: klocalizedstring.cpp:1482
KLocalizedString KI18N_EXPORT ki18ndcp(const char *domain, const char *context, const char *singular, const char *plural)
Create non-finalized translated string from domain with context and plural.
Definition: klocalizedstring.cpp:1502
static void insertQtDomain(const char *domain)
Add another domain to search for Qt translations.
Definition: klocalizedstring.cpp:1429
QHash::const_iterator constEnd() const const
static QStringList languages()
Get the languages for which translations will be made.
Definition: klocalizedstring.cpp:1206
static QSet< QString > availableDomainTranslations(const QByteArray &domain)
Definition: klocalizedstring.cpp:1243
SkipEmptyParts
const T & at(int i) const const
bool isEmpty() const const
int length() const const
const T & at(int i) const const
int toInt(bool *ok, int base) const const
bool isEmpty() const const
KLocalizedString KI18N_EXPORT ki18n(const char *text)
Create non-finalized translated string.
Definition: klocalizedstring.cpp:1467
void resize(int size)
QString join(const QString &separator) const const
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const const
QHash::const_iterator constFind(const Key &key) const const
QString fileName() const const
static QSet< QString > availableApplicationTranslations()
Definition: klocalizedstring.cpp:1238
QString & replace(int position, int n, QChar after)
KLocalizedString withFormat(Kuit::VisualFormat format) const
Indicate to resolve KUIT markup into given visual format.
Definition: klocalizedstring.cpp:1061
T & last()
KLocalizedString KI18N_EXPORT kxi18ncp(const char *context, const char *singular, const char *plural)
Create non-finalized markup-aware translated string.
Definition: klocalizedstring.cpp:1522
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const const
LocaleWrapper locale()
static void setLanguages(const QStringList &languages)
Set the languages for which translations will be made.
Definition: klocalizedstring.cpp:1213
GenericDataLocation
bool isEmpty() const const
bool isEmpty() const const
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString left(int n) const const
static QString removeAcceleratorMarker(const QString &label)
Remove accelerator marker from a UI text label.
Definition: klocalizedstring.cpp:1358
KLocalizedString KI18N_EXPORT ki18np(const char *singular, const char *plural)
Create non-finalized translated string with plural.
Definition: klocalizedstring.cpp:1477
QSet::iterator insert(const T &value)
int size() const const
KIOCORE_EXPORT QString number(KIO::filesize_t size)
KLocalizedString KI18N_EXPORT ki18ndp(const char *domain, const char *singular, const char *plural)
Create non-finalized translated string from domain with plural.
Definition: klocalizedstring.cpp:1497
KLocalizedString KI18N_EXPORT ki18nd(const char *domain, const char *text)
Create non-finalized translated string from domain.
Definition: klocalizedstring.cpp:1487
KGuiItem ok()
static void setApplicationDomain(const char *domain)
Set the given domain as application's main domain.
Definition: klocalizedstring.cpp:1190
KLocalizedString withLanguages(const QStringList &languages) const
Indicate to look for translation only in given languages.
Definition: klocalizedstring.cpp:1047
KLocalizedString inContext(const QString &key, const QString &value) const
Add dynamic context to the message.
Definition: klocalizedstring.cpp:1164
KLocalizedString KI18N_EXPORT kxi18np(const char *singular, const char *plural)
Create non-finalized markup-aware translated string with plural.
Definition: klocalizedstring.cpp:1517
KLocalizedString KI18N_EXPORT kxi18nc(const char *context, const char *text)
Create non-finalized markup-aware translated string with context.
Definition: klocalizedstring.cpp:1512
QString mid(int position, int n) const const
KLocalizedString KI18N_EXPORT kxi18ndp(const char *domain, const char *singular, const char *plural)
Create non-finalized markup-aware translated string from domain with plural.
Definition: klocalizedstring.cpp:1537
static QByteArray applicationDomain()
Get the application's main translation domain.
Definition: klocalizedstring.cpp:1199
QVector< V > values(const QMultiHash< K, V > &c)
static QString translateQt(const char *context, const char *text, const char *comment, int n)
Translate a message with Qt semantics.
Definition: klocalizedstring.cpp:1364
static QString localizedFilePath(const QString &filePath)
Find a path to the localized file for the given original path.
Definition: klocalizedstring.cpp:1332
QString & append(QChar ch)
bool isReadable() const const
QStringRef leftRef(int n) const const
KLocalizedString KI18N_EXPORT kxi18nd(const char *domain, const char *text)
Create non-finalized markup-aware translated string from domain.
Definition: klocalizedstring.cpp:1527
QString decodeName(const QByteArray &localFileName)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Sep 23 2023 04:12:26 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Sep 23 2023 04:12:26 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.