New i18n interface for KDE 4

Chusslove Illich caslav.ilic at gmx.net
Wed Sep 7 18:59:22 BST 2005


> [: Chusslove Illich :]
> I favor the first approach, with KI18n inherited from QString.

Perhaps it would help if I would be more to the point. I would basically 
like us to replace the i18n() that we have now:

  QString i18n(const char* text);

with:

  class KI18n : public QString
  {
  private:
    KI18n(const char* text);
    ...
  public:
    friend KI18n i18n(const char* text) { return KI18n(text); }
    ...
    KI18n arg(const QString& a, int fieldWidth = 0) const;
    ...
  }

i18n() becomes just a wrapper for KI18n constructor, and the constructor 
does all the job that former i18n() did, plus some extra when needed. The 
arg() methods of KI18n would look like:

  KI18n KI18n::arg(const QString& a, int fieldWidth) const
  {
    KI18n ki(*this);
    ki.QString::operator=(QString::arg(a, fieldWidth));
    ...(argument capturing stuff)...
    return ki;
  }

This fills the underlying QString using QString's arg(), but may also 
capture the argument if delayed translation is needed.

Is this kind of change feasible?

-- 
Chusslove Illich (Часлав Илић)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050907/a0170d3b/attachment.sig>


More information about the kde-core-devel mailing list