mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kdecore: remove non-operational KLocalizedString::inContext() method
non-operational since 5185c917de
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
625373ffa8
commit
0d2c0aba3f
3 changed files with 1 additions and 39 deletions
|
@ -62,7 +62,6 @@ class KLocalizedStringPrivate
|
||||||
pluraln number;
|
pluraln number;
|
||||||
int numberOrd;
|
int numberOrd;
|
||||||
QByteArray ctxt;
|
QByteArray ctxt;
|
||||||
QHash<QString, QString> dynctxt;
|
|
||||||
QByteArray msg;
|
QByteArray msg;
|
||||||
QByteArray plural;
|
QByteArray plural;
|
||||||
|
|
||||||
|
@ -470,14 +469,6 @@ KLocalizedString KLocalizedString::subs(const QString &a, int fieldWidth,
|
||||||
return kls;
|
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)
|
KLocalizedString ki18n(const char* msg)
|
||||||
{
|
{
|
||||||
return KLocalizedString(NULL, msg, NULL);
|
return KLocalizedString(NULL, msg, NULL);
|
||||||
|
|
|
@ -227,23 +227,6 @@ class KLocalizedStringPrivate;
|
||||||
* QString trName = ki18n("Georgia").toString("countries");
|
* QString trName = ki18n("Georgia").toString("countries");
|
||||||
* \endcode
|
* \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
|
* \section subs_notes Placeholder Substitution
|
||||||
*
|
*
|
||||||
* Hopefully, for the most part placeholders are being substituted the way
|
* Hopefully, for the most part placeholders are being substituted the way
|
||||||
|
@ -484,16 +467,6 @@ public:
|
||||||
KLocalizedString subs (const QString &a, int fieldWidth = 0,
|
KLocalizedString subs (const QString &a, int fieldWidth = 0,
|
||||||
const QChar &fillChar = QLatin1Char(' ')) const;
|
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.
|
* @internal Called from KLocale on addition or removal of catalogs.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -572,8 +572,6 @@ void KFontChooser::Private::_k_family_chosen_slot(const QString& family)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter style strings and add to the listbox.
|
// Filter style strings and add to the listbox.
|
||||||
QString pureFamily;
|
|
||||||
splitFontString(family, &pureFamily);
|
|
||||||
QStringList filteredStyles;
|
QStringList filteredStyles;
|
||||||
qtStyles.clear();
|
qtStyles.clear();
|
||||||
styleIDs.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).
|
// noun-adjective congruence wrt. gender of the family name).
|
||||||
// The message provides the dynamic context 'family', which is
|
// The message provides the dynamic context 'family', which is
|
||||||
// the family name to which the style string corresponds.
|
// 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)) {
|
if (!filteredStyles.contains(fstyle)) {
|
||||||
filteredStyles.append(fstyle);
|
filteredStyles.append(fstyle);
|
||||||
qtStyles.insert(fstyle, style);
|
qtStyles.insert(fstyle, style);
|
||||||
|
|
Loading…
Add table
Reference in a new issue