PATCH: i18nc not working under windows

Chusslove Illich caslav.ilic at gmx.net
Mon Nov 10 19:50:00 GMT 2008


> [: Patrick Spendrin :]
> [...] On Windows the dcgettext call doesn't work because LC_MESSAGES is
> not defined correctly. The attached patch replaces the dcgettext calls
> with dgettext ones [...]

I'm not happy about introducing extra code to work around a problem that
should be handled on a more basic level, so it would be nice if this
(temporary?) code would be well compartmentalized (dpngettext_expr is used
by i18ncp(), so I guess it needs replacement too). For example:

  #ifndef Q_OS_WIN32
  #define DPGETTEXT_LOCAL dpgettext_expr
  #define DNPGETTEXT_LOCAL dnpgettext_expr
  #else
  static const char *dpgettext_expr_win32 (...)
  {
      ...
  }
  static const char *dnpgettext_expr_win32 (...)
  {
      ...
  }
  #define DPGETTEXT_LOCAL dpgettext_expr_win32
  #define DNPGETTEXT_LOCAL dnpgettext_expr_win32
  #endif

  ...

  QString KCatalog::translate (...)
  {
      ...
      return QString::fromUtf8(DPGETTEXT_LOCAL(d->name, msgctxt, msgid));
  }

Also, if the nature of "LC_MESSAGES is not defined correctly" is serious
enough, perhaps it would warrant support in the Gettext itself (gettext.h is
copied over from Gettext package)? Because, as it is now, any context-using
gettextized app would have to introduce similar workaround. The port of call
for that is bug-gnu-gettext at gnu.org.

-- 
Chusslove Illich (Часлав Илић)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081110/b40421d4/attachment.sig>


More information about the kde-core-devel mailing list