[gtkada] Do the i18n/l10n routines work?
Jacob Sparre Andersen
sparre at nbi.dk
Tue Jan 9 16:53:23 CET 2001
I have tried to get the package Gtkada.Intl to work, but
until now without much luck.
Have anybody else had success using package Gtkada.Intl?
I have written a small example to test the package:
------------------------------------------------------------
-- The file "gtkada_intl_eksempel.adb":
with Ada.Text_IO; use Ada.Text_IO;
with Gtkada.Intl; use Gtkada.Intl;
procedure Gtkada_Intl_Eksempel is
begin
Bind_Text_Domain ("hilsner", "/usr/share/locale");
Text_Domain ("hilsner");
Put_Line (Gettext ("Hej verden"));
end Gtkada_Intl_Eksempel;
------------------------------------------------------------
This program compiles fine on my Linux box:
$ gnatmake gtkada_intl_eksempel -cargs -gnati1 -gnatf -gnato `gtkada-config`
gnatgcc -c -gnati1 -gnatf -gnato gtkada_intl_eksempel.adb
gnatbind -x gtkada_intl_eksempel.ali
gnatlink -lgtkada -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm gtkada_intl_eksempel.ali
It runs and gives the expected output:
$ ./gtkada_intl_eksempel
Hej verden
Then we write a ".po" file with a translation of the text:
#-----------------------------------------------------------
# The file "hilsner-fr.po":
# Translations for "Gtkada_Intl_Eksempel".
# Copyright (C) 2000 Free Software Foundation, Inc.
# Jacob Sparre Andersen <sparre at nbi.dk>, 2000.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 20001230-1\n"
"POT-Creation-Date: 2000-12-30 19:15+0100\n"
"PO-Revision-Date: 2000-12-31 00:40+0100\n"
"Last-Translator: Jacob Sparre Andersen <sparre at nbi.dk>\n"
"Language-Team: none <nowhere at near.here>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8-bit\n"
msgid "Hej verden"
msgstr "Salut le monde"
#-----------------------------------------------------------
We compile and install the file (needs root privileges):
$ msgfmt hilsner-fr.po -o hilsner-fr.gmo
$ cp hilsner-fr.gmo /usr/share/locale/fr/LC_MESSAGES/hilsner.mo
Now we should be able to see the French translation by
setting the environment variable LANG to the ISO language
code for French:
$ setenv LANG fr_FR.ISO-8859-1
$ ./gtkada_intl_eksempel
Hej verden
But we still get the original Danish text!
Shouldn't the output here have been "Salut le monde"?
What did I do wrong?
Jacob
--
"The universe isn't for the likes of me to understand. I only work here."
More information about the gtkada
mailing list