demexp-dev
[Top][All Lists]
Advanced

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

[Demexp-dev] Issue to use ocaml-gettext with lablgtk


From: David MENTRE
Subject: [Demexp-dev] Issue to use ocaml-gettext with lablgtk
Date: Mon, 23 Jan 2006 19:59:48 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Hello Sylvain,

I'm trying to translated a Glade-2 interface with ocaml-gettext but it
does not seem to work.

In my program, I define module DemexpGettext:

<<demexpGettext.ml>>=
module Gettext = Gettext.Program
    (struct
      let textdomain   = "demexp"
      let codeset      = None
      let dir          = None
      let dependencies = Gettext.init
    end)
    (GettextCamomile.Map)
@ 


Then, I use it in the main module of my program, before calling
GMain.Main.main. 

<<demexp-gtk2-client.ml>>=
let gettext_args, _ = DemexpGettext.Gettext.init
@ 
[...]

I parse command line.

<<demexp-gtk2-client.ml>>=
let cmdline_options =
  Arg.align ([
[...]
 ] @ gettext_args)
@ 

Function [[parse_cmdline]] parses command line options. It sets global
flags defined in [[Clntflags]] (see \codechunkref{code:clntflags}).

<<demexp-gtk2-client.ml>>=
let parse_cmdline () =
  let anon_fun url =
    flag_url_list := url :: !flag_url_list in
  Arg.parse cmdline_options anon_fun usage_msg
@ 

<<demexp-gtk2-client.ml>>=
let _ = 
  parse_cmdline ();
[...]
    GMain.Main.main ();
[...]
@


I do a "make install-buildpo" that installs compiled MO files in local
build/share/locale/ directory.

Then I call my program as follow, but Glade interface is not translated:
./gtk2-clnt/demexp-gtk2-client --gettext-dir 
~/pub/expdem/demexp--dev--0.7/build/share/locale/ --gettext-language fr_FR.UTF-8

(I have tried various variations, fr, fr_FR, with no more success)

Is it the right way to use your library? Have I missed something to
initialize (I'm a bit lost in all the Gettext modules)? Any suggestion?

BTW, it would be nice to have a --gettext-debug mode where ocaml-gettext
prints what it is doing and where is it looking for on stderr.

Best wishes,
d.
-- 
pub  1024D/A3AD7A2A 2004-10-03 David MENTRE <address@hidden>
 5996 CC46 4612 9CA4 3562  D7AC 6C67 9E96 A3AD 7A2A





reply via email to

[Prev in Thread] Current Thread [Next in Thread]