Re: [PATCH] improving on i18n

2000-12-07 Thread Zbigniew Chyla

On Wed, 2000-12-06 at 15:24:58, Zbigniew Chyla wrote:

> (...)
> Thanks tor this! It should be no problem for translators - I have another
> patch, that doesn't _require_ modified translations. If you replace
> _("File") with Q_("!menu!File") in your code, old translations (containing
> only "File") will still work. I'll send improved patch tomorrow.

Attached patch implements new version of the Q_() macro. As I said before,
adding new prefixes to strings doesn't break existing translations.

This time I don't include whole po/Makefile.in.in but only small patch
adding "--keyword=Q_" to the list of xgettext options. Patch is being
applied by autogen.sh after running gettextize. Many GNOME apps
(eg. gnumeric) modify po/Makefile.in.in this way.


Zbigniew


diff -ruN /home/cyba/gcvs/gimp/ChangeLog gimp/ChangeLog
--- /home/cyba/gcvs/gimp/ChangeLog  Sun Dec  3 20:16:03 2000
+++ gimp/ChangeLog  Wed Dec  6 19:32:58 2000
@@ -1,3 +1,33 @@
+2000-12-06  Zbigniew Chyla  <[EMAIL PROTECTED]>
+
+   I18n improvement - added support for Q_() macro (replacement for _()
+   allowing to add a prefix of the form "!some_prefix!" to the
+   string and thus making it possible to translate it differently in
+   different contexts).
+
+   * libgimp/gimpintl.h, libgimp/libgimp-intl.h: included "gimputils.h",
+   defined Q_() macro.
+
+   * libgimp/gimputils.h: added functions declarations:
+   gimp_i18n_qualifier_prefix_gettext(),
+   gimp_i18n_qualifier_prefix_dgettext(),
+   gimp_i18n_qualifier_prefix_noop().
+
+   * libgimp/gimputils.c: included "gimpintl.h", added functions:
+   gimp_i18n_qualifier_prefix_gettext(),
+   gimp_i18n_qualifier_prefix_dgettext(),
+   gimp_i18n_qualifier_prefix_noop().
+
+   * autogen.sh: patching po/Makefile.in.in (with
+   po/Makefile.in.in.i18npatch) after running gettextize.
+
+   * po/Makefile.in.in.i18n: new file - patch for po/Makefile.in.in (file
+   provided by gettextize), adds "--keyword=Q_" to the list of xgettext
+   options.
+
+   * po-libgimp/Makefile.in.in, po-plug-ins/Makefile.in.in: added
+   "--keyword=Q_" to the list of xgettext options.
+
 2000-11-30  Andy Thomas <[EMAIL PROTECTED]>
 
* app/curves.c
diff -ruN /home/cyba/gcvs/gimp/libgimp/gimputils.h gimp/libgimp/gimputils.h
--- /home/cyba/gcvs/gimp/libgimp/gimputils.hThu Nov 23 12:38:50 2000
+++ gimp/libgimp/gimputils.hWed Dec  6 19:32:58 2000
@@ -45,13 +45,12 @@
  const gchar *exceptions);
 gchar * gimp_strcompress (const gchar *source);
 #endif  /* GLIB <= 1.3 */
-
+gchar *gimp_i18n_qualifier_prefix_gettext (const gchar *string);
+gchar *gimp_i18n_qualifier_prefix_dgettext (const gchar *domain, const gchar *string);
+gchar *gimp_i18n_qualifier_prefix_noop (const gchar *string);
 
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
 
 #endif /* __GIMPUTILS_H__ */
-
-
-
diff -ruN /home/cyba/gcvs/gimp/libgimp/libgimp-intl.h gimp/libgimp/libgimp-intl.h
--- /home/cyba/gcvs/gimp/libgimp/libgimp-intl.h Thu Nov 23 12:38:50 2000
+++ gimp/libgimp/libgimp-intl.h Wed Dec  6 19:32:58 2000
@@ -22,10 +22,12 @@
 #ifndef __LIBGIMP_INTL_H__
 #define __LIBGIMP_INTL_H__
 
+#include "gimputils.h"
 
 #ifdef ENABLE_NLS
 #include 
 #define _(String) dgettext ("gimp-libgimp", String)
+#define Q_(String) gimp_i18n_qualifier_prefix_dgettext ("gimp-libgimp", String)
 #undef gettext
 #define gettext(String) dgettext ("gimp-libgimp", String)
 #ifdef gettext_noop
@@ -37,6 +39,7 @@
 /* Stubs that do something close enough.  */
 #define gettext(String) (String)
 #define _(String) (String)
+#define Q_(String) gimp_i18n_qualifier_prefix_noop (String)
 #define N_(String) (String)
 #endif
 
diff -ruN /home/cyba/gcvs/gimp/libgimp/gimpintl.h gimp/libgimp/gimpintl.h
--- /home/cyba/gcvs/gimp/libgimp/gimpintl.h Thu Nov 23 12:38:48 2000
+++ gimp/libgimp/gimpintl.h Wed Dec  6 19:32:58 2000
@@ -25,6 +25,8 @@
 #include 
 #include 
 
+#include "gimputils.h"
+
 /* Copied from gnome-i18n.h by Tom Tromey <[EMAIL PROTECTED]>
  * Heavily modified by Daniel Egger <[EMAIL PROTECTED]>
  * So be sure to hit me instead of him if something is wrong here
@@ -40,6 +42,7 @@
 #ifdef ENABLE_NLS
 #include 
 #define _(String) gettext (String)
+#define Q_(String) gimp_i18n_qualifier_prefix_gettext (String)
 #ifdef gettext_noop
 #define N_(String) gettext_noop (String)
 #else
@@ -53,6 +56,7 @@
 #define dcgettext(Domain,Message,Type) (Message)
 #define bindtextdomain(Domain,Directory) (Domain)
 #define _(String) (String)
+#define Q_(String) gimp_i18n_qualifier_prefix_noop (String)
 #define N_(String) (String)
 #endif
 
diff -ruN /home/cyba/gcvs/gimp/libgimp/gimputils.c gimp/libgimp/gimputils.c
--- /home/cyba/gcvs/gimp/libgimp/gimputils.cThu Nov 23 12:38:50 2000
+++ gimp/libgimp/gimputils.cWed Dec  6 19:32:58 2000
@@ -23,8 +23,12 @@
 #include 
 #include 
 
+#include

Re: [PATCH] improving on i18n

2000-12-06 Thread Zbigniew Chyla

On Wed, 2000-12-06 at 14:19:02, Sven Neumann wrote:

> I have discussed your patch with Mitch and it really looks safe. The 
> problem we see is that most likely translators will find a lot of 
> collisions and each string marked with your Q_ macro will end up being
> untranslated in all languages until translators change the po-files
> (...)

Thanks tor this! It should be no problem for translators - I have another
patch, that doesn't _require_ modified translations. If you replace
_("File") with Q_("!menu!File") in your code, old translations (containing
only "File") will still work. I'll send improved patch tomorrow.

> I'd still prefer a clean solution that would give every translator the
> chance to apply different translations for every string without the need
> to change the original string. This would make it possible to work around
> (...)

So do I :-)
Believe me, I _hate_ gettext, but it's the only thing we have _now_.


Zbigniew



Re: [PATCH] improving on i18n

2000-12-06 Thread Sven Neumann

  Zbigniew Chyla <[EMAIL PROTECTED]> writes:

> This patch _fixes_ GIMP translations. Currently it's _impossible_ to
> correctly translate GIMP to any slavic language (and probably many others).
> Polish GIMP users keep saying "Can you speak Polish? Translation is broken!"
> and the only thing we can say is "Sorry, it's developers' fault, but please
> wait another 1-2 years for GIMP 1.4/2.0 release and hopefully it will be
> useable".
> Patch is extremely simple, it doesn't touch existing code at all. Why don't
> you like it?

I have discussed your patch with Mitch and it really looks safe. The 
problem we see is that most likely translators will find a lot of 
collisions and each string marked with your Q_ macro will end up being
untranslated in all languages until translators change the po-files
again. Since we want to release 1.2.0 real soon now this change would
significantly degrade the status of i18n we have reached so far. I suggest
we reconsider applying your patch after 1.2.0 so it could become part of
the 1.2.x series but early enough before a release to give translators a 
chance to update translations. To do so we'd need a list of colliding 
strings from all translators as soon as possible.

I'd still prefer a clean solution that would give every translator the
chance to apply different translations for every string without the need
to change the original string. This would make it possible to work around
collisions without breaking the translation for all other supported
languages.


Salut, Sven




Re: [PATCH] improving on i18n

2000-12-05 Thread Marc Lehmann

On Tue, Dec 05, 2000 at 09:40:28PM +, Nick Lamb <[EMAIL PROTECTED]> wrote:
> > And givne that a large amount of similar fixes went into the gimp not too
> > long ago this patch really should be considered.
> 
> Those fixes made Gimp have more bugs. No more patches like that thanks.

Well, those patches actually made i18n work again. so if they added new bugs
the patches were problematic. so this means a patch must be looked at on a
per-patch-basis.

Anyway, if Sven *still* does not want that that's reason enough for me to
also now want it ;)

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED] |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |



Re: [PATCH] improving on i18n

2000-12-05 Thread Nick Lamb

On Tue, Dec 05, 2000 at 07:39:11PM +0100, Marc Lehmann wrote:
> > This patch _fixes_ GIMP translations. Currently it's _impossible_ to
> 
> And givne that a large amount of similar fixes went into the gimp not too
> long ago this patch really should be considered.

Those fixes made Gimp have more bugs. No more patches like that thanks.

Nick.



Re: [PATCH] improving on i18n

2000-12-05 Thread Marc Lehmann

On Tue, Dec 05, 2000 at 05:34:18PM +0100, Zbigniew Chyla 
<[EMAIL PROTECTED]> wrote:
> > Probably a good idea, but I doubt we can count this as a bugfix. We 
> > should consider integrating a fix like this after the 1.2 release.
> 
> This patch _fixes_ GIMP translations. Currently it's _impossible_ to

And givne that a large amount of similar fixes went into the gimp not too
long ago this patch really should be considered.

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED] |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |



Re: [PATCH] improving on i18n

2000-12-05 Thread Sven Neumann

Hi,

  Zbigniew Chyla <[EMAIL PROTECTED]> writes:

> On Tue, 2000-12-05 at 16:01:17, Sven Neumann wrote:
> 
> > Probably a good idea, but I doubt we can count this as a bugfix. We 
> > should consider integrating a fix like this after the 1.2 release.
> 
> This patch _fixes_ GIMP translations. Currently it's _impossible_ to
> correctly translate GIMP to any slavic language (and probably many others).
> Polish GIMP users keep saying "Can you speak Polish? Translation is broken!"
> and the only thing we can say is "Sorry, it's developers' fault, but please
> wait another 1-2 years for GIMP 1.4/2.0 release and hopefully it will be
> useable".
> Patch is extremely simple, it doesn't touch existing code at all. Why don't
> you like it?

Because we are very close to the stable release we are working towards for
over a year now. I18n is its final state for months and noone complained 
about it recently. Every time we changed stuff with respect to i18n, it 
produced lots of problems and I'm very happy that it seems to be working 
for most people now. We are not going to change anything here before 1.2.

> > But actually I would prefer a real solution instead of something hacked
> > around gettext. 
> 
> What do you expect me to do? Create replacement for gettext? 

Actually yes. I hope that a better system than gettext evolves so we can
use it for the 1.3.x series.

> I want GIMP _1.2_ to be correctly translated and I don't see any other 
> proposals besides my patch.

Sorry, I don't see any solution either. It's simply too late to fix this
know.


Salut, Sven





Re: [PATCH] improving on i18n

2000-12-05 Thread Zbigniew Chyla

On Tue, 2000-12-05 at 16:01:17, Sven Neumann wrote:

> Probably a good idea, but I doubt we can count this as a bugfix. We 
> should consider integrating a fix like this after the 1.2 release.

This patch _fixes_ GIMP translations. Currently it's _impossible_ to
correctly translate GIMP to any slavic language (and probably many others).
Polish GIMP users keep saying "Can you speak Polish? Translation is broken!"
and the only thing we can say is "Sorry, it's developers' fault, but please
wait another 1-2 years for GIMP 1.4/2.0 release and hopefully it will be
useable".
Patch is extremely simple, it doesn't touch existing code at all. Why don't
you like it?

> But actually I would prefer a real solution instead of something hacked
> around gettext. 

What do you expect me to do? Create replacement for gettext? Actually I _am_
going to create one, but I doubt whether it could be done before the 1.2
release and even if I manage to do this, I'm sure you wold say "I doubt we
can count this as a bugfix". I want GIMP _1.2_ to be correctly translated
and I don't see any other proposals besides my patch.


Zbigniew

-- 
 "GNOME is an open, free, and productive desktop environment that sparks
  innovation and excitement among users and developers worldwide.
  Microsoft Windows is not."
 -- Sun Microsystems



Re: [PATCH] improving on i18n

2000-12-05 Thread Sven Neumann

Zbigniew Chyla <[EMAIL PROTECTED]> writes:

> As you probably already know there are lots of problems with current i18n
> tools. Every genuine inscription can have only one equivalent in particular
> language when using gettext. In the case of GIMP this is really serious
> problem because of huge .po files (and thus many collisions).
> The authors of Freeciv worked out an easy method of the partial solving this
> problem. My patch is based on code from Freeciv.
> Every string marked for translation can be preceded with a prefix in the
> form "!prefix!". Thanks to this prefix, two appearances of the same
> string can have different meanings. The prefix can be omited in
> translated string, but leaving it will not influence displayed text because
> it will be always stripped (it is helpful for translators who don't know
> this solution). You should just use Q_() macro instead of _() in your code
> to use this feature.

Probably a good idea, but I doubt we can count this as a bugfix. We 
should consider integrating a fix like this after the 1.2 release.
But actually I would prefer a real solution instead of something hacked
around gettext. 


Salut, Sven