Internationalizing a simple Gnome Panel Applet .........?


I'm trying to rewrite the openoffice quickstart panel applet for Gnome.

You can try it at
Ot the Debian Sarge package

It works well, but it needs i18n now, and I need help.


I could easily i12ize a simple GTK hello world application,
but I can't do the same for a panel applet.

Below is the small code for the hello world applet,
(taken from )
#include <string.h>
#include <panel-applet.h>
#include <gtk/gtklabel.h>

static gboolean
myexample_applet_fill (PanelApplet * applet, const gchar * iid,
                                                 gpointer data)
  GtkWidget *label;
  if (strcmp (iid, "OAFIID:ExampleApplet") != 0)
    return FALSE;
  label = gtk_label_new (_("Hello"));
  gtk_container_add (GTK_CONTAINER (applet), label);
  gtk_widget_show_all (GTK_WIDGET (applet));
  return TRUE;
                             "The Hello World Applet",
                             "0", myexample_applet_fill, NULL);

Here is the ExampleApplet.server file:
<oaf_server iid="OAFIID:ExampleApplet_Factory" type="exe"

        <oaf_attribute name="repo_ids" type="stringv">
                <item value="IDL:Bonobo/GenericFactory:1.0"/>
                <item value="IDL:Bonobo/Unknown:1.0"/>
        <oaf_attribute name="name" type="string" value="Example Applet
        <oaf_attribute name="description" type="string" value="Factory
to create the example applet"/>

<oaf_server iid="OAFIID:ExampleApplet" type="factory"

        <oaf_attribute name="repo_ids" type="stringv">
                <item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/>
                <item value="IDL:Bonobo/Control:1.0"/>
                <item value="IDL:Bonobo/Unknown:1.0"/>
        <oaf_attribute name="name" type="string" value="Example Applet"/>
        <oaf_attribute name="description" type="string" value="An
example applet"/>
        <oaf_attribute name="panel:category" type="string"
        <oaf_attribute name="panel:icon" type="string" value="myicon.png"/>
I have unsuccessfully tried to add the following to the C code:
#include <glib.h>
#include <glib/gi18n.h>
#include <libintl.h>
#include <locale.h>
 setlocale(LC_ALL, "");
 bindtextdomain( "ExampleApplet", "/usr/share/locale" );
 textdomain( "ExampleApplet" );
I did the following to compile and create the mo file:

xgettext --keyword=_ ExampleApplet.c -o ExampleApplet.pot
msginit -l fr_FR -i ExampleApplet.pot -o ExampleApplet.po
vi test2i18n.po  (and I translate "Hello" to "Bonjour")
msgfmt -c -v ExampleApplet.po -o
cp -f /usr/share/locale/fr/LC_MESSAGES/
gcc $(pkg-config --cflags --libs libpanelapplet-2.0) \
                            -o ExampleApplet test2i18n.c
cp -f ExampleApplet /usr/lib/gnome-panel/
cp -f test2i18n.server /usr/lib/bonobo/servers/ExampleApplet.server

All this have no effect, I still get "Hello" instead of "Bonjour".
What did I forget ?
I really would like to understand what needs to be done to have a well
i12ized panel applet

thanks in advance,

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