gettext domain(s) and Bonobo



While trying to figure out why menus are not translated in bonobo
version of gnumeric I ran into a potential problem related to gettext.
While it is not the cause of untranslated menues in gnumeric, it will
prevent gnome stock menue items from being translated.

In gnome-libs (libgnomeui/gnome-app-helper.c), menu labels are set 
using function that check both program domain and gnome-libs domain:
gnome_app_helper_gettext (const gchar *str)
{
	char *s;

        s = gettext (str);
	if ( s == str )
	        s = dgettext (PACKAGE, str);

	return s;
}
  
In Bonobo, labels strings are acquired through  gettext only.
>From function menu_toplevel_create_label() [gnome-ui-handler.c]:

        ...
	label = gtk_accel_label_new (gettext (item->label));
        ...

 And indeed, it translates only labels it can find in program's
domain.  I inserted a few "fprintf(stderr,..." functions there (I know
it is a bad habit) and it printed for gnumeric:

textdomain in menu_parse: gnumeric
label: _File
translation: _File
textdomain in menu_parse: gnumeric
label: _New
translation: Novyi
textdomain in menu_parse: gnumeric
label: _Open...
translation: _Open...

_File and _Open have to be translated using gnome-libs domain.
(Obviously, gnumeric problem is a separate one -- it does not show
 Novyi instead of _New. I am yet to find out why.) 

I think that domain problem is even bigger --- e.g. if gill object
is plugged into abiword, then, when menu is replaced by gill menu
we will loose translations. E.g. when I insert image or mines component
in gnumeric it still searching gnumeric domain:

...
user activation request
textdomain in menu_parse: gnumeric
label: Game
translation: Game
textdomain in menu_parse: gnumeric
label: New Game
translation: New Game
...
 

 There should be some way to pass gettext domain and use
dgettext(COMPONENT_DOMAIN, str) for strings translation.  In any case
"gnome-libs" DOMAIN should also be checked.


 
     Sergey



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]