kdecore: remove non-operational KLocalizedString::inContext() method

non-operational since 5185c917de

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-15 01:06:53 +03:00
parent 625373ffa8
commit 0d2c0aba3f
3 changed files with 1 additions and 39 deletions

View file

@ -62,7 +62,6 @@ class KLocalizedStringPrivate
pluraln number;
int numberOrd;
QByteArray ctxt;
QHash<QString, QString> dynctxt;
QByteArray msg;
QByteArray plural;
@ -470,14 +469,6 @@ KLocalizedString KLocalizedString::subs(const QString &a, int fieldWidth,
return kls;
}
KLocalizedString KLocalizedString::inContext(const QString &key,
const QString &text) const
{
KLocalizedString kls(*this);
kls.d->dynctxt[key] = text;
return kls;
}
KLocalizedString ki18n(const char* msg)
{
return KLocalizedString(NULL, msg, NULL);

View file

@ -227,23 +227,6 @@ class KLocalizedStringPrivate;
* QString trName = ki18n("Georgia").toString("countries");
* \endcode
*
* Translators have a capability to script translations at runtime, which is
* for the most part transparent to the programmer. However, sometimes the
* programmer may help by providing some @e dynamic context to the message,
* using the inContext method of KLocalizedString. Unlike the ordinary
* context, this one changes at runtime; translators have the means to fetch
* it and use it to script the translation properly. An example:
* \code
* KLocalizedString ks = ki18nc("%1 is user name; may have "
* "dynamic context gender=[male,female]",
* "%1 went offline");
* if (knownUsers.contains(user) && !knownUsers[user].gender.isEmpty()) {
* ks = ks.inContext("gender", knownUsers[user].gender);
* }
* QString msg = ks.subs(user).toString();
* \endcode
* Several dynamic contexts, with different keys, can be added like this.
*
* \section subs_notes Placeholder Substitution
*
* Hopefully, for the most part placeholders are being substituted the way
@ -484,16 +467,6 @@ public:
KLocalizedString subs (const QString &a, int fieldWidth = 0,
const QChar &fillChar = QLatin1Char(' ')) const;
/**
* Adds dynamic context to the message.
*
* @param key context key
* @param text context value
* @return resultant KLocalizedString
*/
KLocalizedString inContext (const QString &key,
const QString &text) const;
/**
* @internal Called from KLocale on addition or removal of catalogs.
*/

View file

@ -572,8 +572,6 @@ void KFontChooser::Private::_k_family_chosen_slot(const QString& family)
}
// Filter style strings and add to the listbox.
QString pureFamily;
splitFontString(family, &pureFamily);
QStringList filteredStyles;
qtStyles.clear();
styleIDs.clear();
@ -594,7 +592,7 @@ void KFontChooser::Private::_k_family_chosen_slot(const QString& family)
// noun-adjective congruence wrt. gender of the family name).
// The message provides the dynamic context 'family', which is
// the family name to which the style string corresponds.
QString fstyle = ki18nc("@item Font style", "%1").subs(style).inContext("family", pureFamily).toString();
QString fstyle = ki18nc("@item Font style", "%1").subs(style).toString();
if (!filteredStyles.contains(fstyle)) {
filteredStyles.append(fstyle);
qtStyles.insert(fstyle, style);