Sven Neumann wrote:
> > Hi all,
> >
> > I just studied the GtkItemFactory code...
> >
> > It seems we're doing _many_ useless translations in the menu system.
> > For example all calls to menus_set_sensitive() are using strings
> > which are marked with N_().
> >
> > However it's totally sufficient to pass the untranslated (english)
> > text to _all_ item factory functions because GtkItemFactory uses
> > the translate function _only_ when creating the menu labels.
> >
> > These label are never touched after creation, as the menu paths are
> > stored separately and untranslated.
> >
> > I'm quite sure that I got the semantics of the item factory code
> > right. Could anyone verify this please? It could save us lots of
> > work and reduce the size of the po files drastically...
> I think you are right that marking the strings for translation is not
> needed in a few places, but changing this will not significantly reduce
> the size of the po files since duplicate strings are only listed once
> in the gimp.pot file.

I have already patched my local tree:

- removed the menus_set_[sensitive|state]_glue() functions
- changed all calls to the ones without "_glue"
- removed N_() from all calls to these functions.

...and it works. The english strings are the _identifiers_ by which the
GtkItemFactory finds the item to (un)sensitive. The translations are
only used to create the menu labels and are totally irrelevant

> BTW: I came to the conclusion that plug-ins should register their menu
> entries using the N_(...) macro, not the _(...) macro. This is now done
> inconsistently. As my setup still suffers from the problem that all
> plug-in menu paths are translated to "Datei", I can not really test if
> I'm correct here. What do you think?

You're right, the plugins have to register with their english menu paths.
The translation is done only in menus.c:menu_translate() which _only_
gets called from gtk_item_factory_create_item(), so we have to mark
only the strings which finally are passed to this function and none
of the strings which are passed to other GtkItemFactory functions.

I did some debugging there and noticed that gettext() returns "/Datei/tearoff1"
for _any_ string which has the form "*/tearoff1" (!!!!).

This is either a bug in our po-files, a bug in gettext or a feature of gettext
which allows to do some magic by adding kinof identifiers after a slash?

Seems we need a guru here...


Reply via email to