[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: New i18n interface for KDE 4
From:       Chusslove Illich <caslav.ilic () gmx ! net>
Date:       2005-09-07 17:59:22
Message-ID: 200509071959.25546.caslav.ilic () gmx ! net
[Download RAW message or body]


> [: 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 (Часлав Илић)

[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic