demexp-dev
[Top][All Lists]
Advanced

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

[Demexp-dev] [Sylvain Le Gall] Re: Issue to use ocaml-gettext with lablg


From: David MENTRE
Subject: [Demexp-dev] [Sylvain Le Gall] Re: Issue to use ocaml-gettext with lablgtk
Date: Tue, 24 Jan 2006 21:33:04 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Answer of Sylvain.

d.

--- Begin Message --- Subject: Re: Issue to use ocaml-gettext with lablgtk Date: Tue, 24 Jan 2006 21:20:52 +0100 User-agent: Mutt/1.5.11
Hello,

On Tue, Jan 24, 2006 at 07:52:16PM +0100, David MENTRE wrote:
> Hello Sylvain,
> 
> I'm making progress, but more issues appear. :-)
> 
> David MENTRE <address@hidden> writes:
> 
> > 2006/1/23, Sylvain Le Gall <address@hidden>:
> >> For a GTK2 program, i recommend to use codeset = Some "UTF-8".
> >
> > Ok. I'll fix that.
> 
> done.
> 
> >> If you use a ".glade" file, use GettextStub.Native (because the
> >> translatable string stored in the file are translated using C gettext).
> >
> > Ok, that explains my issue.
> 
> Ok, using GettextStub.Native the translation works!
>

Great ! (at least my work is not a piece of crap ;-) ).

> Here is my definition of my program's Gettext module:
> 
> module Gettext = Gettext.Program
>     (struct
>       let textdomain   = "demexp"
>       let codeset      = Some "UTF-8"
>       let dir          = None
>       let dependencies = Gettext.init
>     end)
>     (GettextStub.Native)
> 
> The .glade translation works when calling my program with:
>  $ echo $LANG
>  fr_FR.UTF-8
> 
>  $ ./gtk2-clnt/demexp-gtk2-client --gettext-dir build/share/locale/po/ 
> 
> A question: why do I need to give the final po/ directory? I though that
> I should give "build/share/locale/", as the default for gettext-dir is
> ["/usr/share/locale"; "/usr/local/share/locale"].
> 
> 

I will take a look at that.

> 
> But now working translation raises another issue: call to printf are
> modified!!
> 
> For example, if at the end of a module I put:
>   let _ = Printf.printf "1.0 = %3.3f\n" 1.0
> 
> I get as result when launching above program:
>   1.0 = 1,000
> 
> It is obvious that the locale is taken into account for printing the
> string. But this seems quite strange to me, as I do not use an _s
> function in this call to printf.
> 
> This behaviour is a issue to me because:
> 
>  - I want to control when a sentence is interpreted as translatable or
>    not;
> 
>  - I'm having autotest where I check hard-coded results for certain
>    function calls. This behaviour breaks them.
> 
> 

Humm, i think that a C printf call is used in the Printf module, which
take into account that locale you have set using LANG.

Maybe, you should try something like "env LC_NUMERIC=C myprogram" which
should give you the expected result (if C is bind to english, otherwise
try LC_NUMERIC=en_US).

> 
> > However, I'm also using "_s" functions. I suppose I have to define a
> > second module for those translations. How am I supposed to use both
> > modules? What should be the init sequence? (BTW, I would be nice to
> > put a word on this in your documentation)
> 
> Ok, it seems that call to "f_" and the like are working with
> GettextStub.Native, so I don't need to use simultaneously
> GettextStub.Native and GettextCamomile.Map.
> 
> Is it an issue to use GettextStub.Native?
> 

What are _s functions ? Why should it be an issue to use
GettextStub.Native ?

> 
> Best wishes,
> d.

Kind regard
Sylvain Le Gall


--- End Message ---

-- 
 address@hidden

reply via email to

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