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



Hello,

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

You can try it at http://gorfou.fr/contrib/ooqstart-gnome/ooqstart-0.8.9.tgz
Ot the Debian Sarge package
http://gorfou.fr/contrib/ooqstart-gnome/ooqstart-gnome_0.8.9-1_i386.deb

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 http://www.gnome.org/projects/ORBit2/appletstutorial.html )
ExampleApplet.c:
========================================
#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;
}
PANEL_APPLET_BONOBO_FACTORY ("OAFIID:ExampleApplet_Factory",
                             PANEL_TYPE_APPLET,
                             "The Hello World Applet",
                             "0", myexample_applet_fill, NULL);
========================================

Here is the ExampleApplet.server file:
========================================
<oaf_info>
<oaf_server iid="OAFIID:ExampleApplet_Factory" type="exe"
            location="/usr/lib/gnome-panel/ExampleApplet">

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

<oaf_server iid="OAFIID:ExampleApplet" type="factory"
            location="OAFIID:ExampleApplet_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>
        <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"
value="Amusements"/>
        <oaf_attribute name="panel:icon" type="string" value="myicon.png"/>
</oaf_server>
</oaf_info>
==========================================================
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 ExampleApplet.mo
cp -f ExampleApplet.mo /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,
Christophe




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