KI18n
klocalizedstring.cpp
49static void splitLocale(const QString &aLocale, QStringView &language, QStringView &country, QStringView &modifier, QStringView &charset)
50{
58 }
65 }
111static void appendLanguagesFromVariable(QStringList &languages, const char *envar, bool isList = false)
196 QString toString(const QByteArray &domain, const QStringList &languages, Kuit::VisualFormat format, bool isArgument = false) const;
197 QString substituteSimple(const QString &translation, const QStringList &arguments, QChar plchar = QLatin1Char('%'), bool isPartial = false) const;
198 QString formatMarkup(const QByteArray &domain, const QString &language, const QString &context, const QString &text, Kuit::VisualFormat format) const;
312 qCDebug(KI18N) << "languages changes from" << staticsKLSP->languages << "to" << staticsKLSP->localeLanguages;
373KLocalizedString::KLocalizedString(const char *domain, const char *context, const char *text, const char *plural, bool markupAware)
444 msgstr = msgid_plural.isNull() || n == 1 ? QString::fromUtf8(msgid) : QString::fromUtf8(msgid_plural);
448 qCWarning(KI18N) << "KLocalizedString: Domain is not set for this string, translation will not work. Please see https://api.kde.org/frameworks/ki18n/html/prg_guide.html msgid:" << msgid << "msgid_plural:" << msgid_plural
499QString KLocalizedStringPrivate::toString(const QByteArray &domain, const QStringList &languages, Kuit::VisualFormat format, bool isArgument) const
517 qCWarning(KI18N) << "Plural argument to message" << shortenMessage(QString::fromUtf8(text)) << "not supplied before conversion.";
534 translateRaw(resolvedDomain, resolvedLanguages, context, text, plural, number, language, rawTranslation);
566 qCWarning(KI18N) << "Scripted message" << shortenMessage(translation) << "without ordinary translation, discarded.";
567 translation = plural.isEmpty() || number == 1 ? QString::fromUtf8(text) : QString::fromUtf8(plural);
581 QString resdArg = kls.d->toString(kls.d->domain, resolvedLanguages, resolvedFormat, isArgumentSub);
602 finalTranslation = formatMarkup(resolvedDomain, language, QString::fromUtf8(context), finalTranslation, resolvedFormat);
610 scriptedTranslation = substituteTranscript(scriptedTranslation, language, *country, finalTranslation, resolvedArguments, resolvedValues, fallback);
616 scriptedTranslation = formatMarkup(resolvedDomain, language, QString::fromUtf8(context), scriptedTranslation, resolvedFormat);
637QString KLocalizedStringPrivate::substituteSimple(const QString &translationString, const QStringList &arguments, QChar plchar, bool isPartial) const
735 qCWarning(KI18N).nospace() << "Placeholder %" << QString::number(i + 1) << " skipped in message " << shortenMessage(translation.toString());
741 qCWarning(KI18N) << arguments.size() << "instead of" << ords.size() << "arguments to message" << shortenMessage(translation.toString())
800 QString ptext = substituteSimple(scriptedTranslation.mid(ppos, tpos - ppos), arguments, s->scriptPlchar, true);
806 tpos = resolveInterpolation(scriptedTranslation, tpos, language, country, ordinaryTranslation, arguments, values, result, fallbackLocal);
827 finalTranslation.append(substituteSimple(scriptedTranslation.mid(ppos), arguments, s->scriptPlchar, true));
866 qCWarning(KI18N) << "Unclosed interpolation" << scriptedTranslation.mid(pos, tpos - pos) << "in message" << shortenMessage(scriptedTranslation);
882 while (!scriptedTranslation[tpos].isSpace() && scriptedTranslation.mid(tpos, ielen) != s->endInterp) {
895 qCWarning(KI18N) << "Unclosed quote in interpolation" << scriptedTranslation.mid(pos, tpos - pos) << "in message"
907 tpos = resolveInterpolation(scriptedTranslation, tpos, language, country, ordinaryTranslation, arguments, values, resultLocal, fallbackLocal);
930 qCWarning(KI18N) << "Non-terminated interpolation" << scriptedTranslation.mid(pos, tpos - pos) << "in message"
990 qCWarning(KI18N) << "Interpolation" << scriptedTranslation.mid(pos, tpos - pos) << "in" << shortenMessage(scriptedTranslation)
1051 s->ktrs->eval(iargs, language, country, msgctxt, dynamicContext, msgid, arguments, values, finalTranslation, s->scriptModulesToLoad, scriptError, fallback);
1056 qCWarning(KI18N) << "Post call" << pcall << "for message" << shortenMessage(msgid) << "failed:" << scriptError;
1111KLocalizedString KLocalizedString::subs(ulong a, int fieldWidth, int base, QChar fillChar) const
1120KLocalizedString KLocalizedString::subs(qlonglong a, int fieldWidth, int base, QChar fillChar) const
1129KLocalizedString KLocalizedString::subs(qulonglong a, int fieldWidth, int base, QChar fillChar) const
1138KLocalizedString KLocalizedString::subs(double a, int fieldWidth, char format, int precision, QChar fillChar) const
1141 kls.d->arguments.append(QStringLiteral("%L1").arg(a, fieldWidth, format, precision, fillChar));
1166KLocalizedString KLocalizedString::subs(const KLocalizedString &a, int fieldWidth, QChar fillChar) const
1251 return language == s->codeLanguage || !KCatalog::catalogLocaleDir(s->applicationDomain, language).isEmpty();
1271const KCatalog &KLocalizedStringPrivate::getCatalog(const QByteArray &domain, const QString &language)
1289void KLocalizedStringPrivate::locateScriptingModule(const QByteArray &domain, const QString &language)
1296 QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("locale/%1/%2/%3/%3.js").arg(language, s->scriptDir, QLatin1String{domain}));
1427KLocalizedString ki18ndcp(const char *domain, const char *context, const char *singular, const char *plural)
1467KLocalizedString kxi18ndcp(const char *domain, const char *context, const char *singular, const char *plural)
Class for producing and handling localized messages.
Definition klocalizedstring.h:45
static QSet< QString > availableDomainTranslations(const QByteArray &domain)
Definition klocalizedstring.cpp:1259
KLocalizedString inContext(const QString &key, const QString &value) const
Add dynamic context to the message.
Definition klocalizedstring.cpp:1180
static QByteArray applicationDomain()
Get the application's main translation domain.
Definition klocalizedstring.cpp:1215
static QStringList languages()
Get the languages for which translations will be made.
Definition klocalizedstring.cpp:1222
KLocalizedString withDomain(const char *domain) const
Indicate to look for translation in the given domain.
Definition klocalizedstring.cpp:1070
static QString localizedFilePath(const QString &filePath)
Find a path to the localized file for the given original path.
Definition klocalizedstring.cpp:1356
KLocalizedString withFormat(Kuit::VisualFormat format) const
Indicate to resolve KUIT markup into given visual format.
Definition klocalizedstring.cpp:1077
KLocalizedString withLanguages(const QStringList &languages) const
Indicate to look for translation only in given languages.
Definition klocalizedstring.cpp:1063
KLocalizedString ignoreMarkup() const
Do not resolve KUIT markup.
Definition klocalizedstring.cpp:1194
KLocalizedString & operator=(const KLocalizedString &rhs)
Assignment operator.
Definition klocalizedstring.cpp:394
static QString removeAcceleratorMarker(const QString &label)
Remove accelerator marker from a UI text label.
Definition klocalizedstring.cpp:1382
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:1387
static QSet< QString > availableApplicationTranslations()
Definition klocalizedstring.cpp:1254
QByteArray untranslatedText() const
Returns the untranslated text.
Definition klocalizedstring.cpp:1201
KLocalizedString subs(int a, int fieldWidth=0, int base=10, QChar fillChar=QLatin1Char(' ')) const
Substitute an int argument into the message.
Definition klocalizedstring.cpp:1084
static void setLanguages(const QStringList &languages)
Set the languages for which translations will be made.
Definition klocalizedstring.cpp:1229
KLocalizedString relaxSubs() const
Relax matching between placeholders and arguments.
Definition klocalizedstring.cpp:1187
static void setApplicationDomain(const QByteArray &domain)
Set the given domain as application's main domain.
Definition klocalizedstring.cpp:1206
static bool isApplicationTranslatedInto(const QString &language)
Check whether the translation catalog file in the given language for the set application translation ...
Definition klocalizedstring.cpp:1247
KIOCORE_EXPORT QString number(KIO::filesize_t size)
QStringView country(QStringView ifopt)
KGuiItem ok()
bool isEmpty() const const
bool isNull() const const
QCoreApplication * instance()
LanguageChange
Type type() const const
QString decodeName(const QByteArray &localFileName)
QString fileName() const const
bool isDir() const const
bool isFile() const const
bool isReadable() const const
QString path() const const
const_iterator constEnd() const const
const_iterator constFind(const Key &key) const const
bool contains(const Key &key) const const
iterator end()
iterator find(const Key &key)
iterator insert(const Key &key, const T &value)
T value(const Key &key) const const
void append(QList< T > &&value)
const_reference at(qsizetype i) const const
iterator begin()
void clear()
iterator end()
bool isEmpty() const const
void resize(qsizetype size)
qsizetype size() const const
QLocale system()
QStringList uiLanguages() const const
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
virtual bool eventFilter(QObject *watched, QEvent *event)
void installEventFilter(QObject *filterObj)
iterator insert(const T &value)
GenericDataLocation
QString locate(StandardLocation type, const QString &fileName, LocateOptions options)
QString & append(QChar ch)
QString arg(Args &&... args) const const
void clear()
QString fromUtf8(QByteArrayView str)
qsizetype indexOf(QChar ch, qsizetype from, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
QString left(qsizetype n) const const
qsizetype length() const const
QString mid(qsizetype position, qsizetype n) const const
QString number(double n, char format, int precision)
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)
QStringList split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
int toInt(bool *ok, int base) const const
QString join(QChar separator) const const
qsizetype removeDuplicates()
QStringView left(qsizetype length) const const
QStringView mid(qsizetype start, qsizetype length) const const
qsizetype indexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
qsizetype length() const const
int toInt(bool *ok, int base) const const
QString toString() const const
void truncate(qsizetype length)
SkipEmptyParts
bool isValid() const const
void append(T &&t)
const T & at(qsizetype i) const const
T & last()
qsizetype size() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:08:21 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:08:21 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.