[Top][All Lists]

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

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

From: Sylvain Le Gall
Subject: [Demexp-dev] Re: Issue to use ocaml-gettext with lablgtk
Date: Tue, 24 Jan 2006 22:05:35 +0100
User-agent: Mutt/1.5.11


On Tue, Jan 24, 2006 at 09:53:55PM +0100, David MENTRE wrote:
> Sylvain,
> [ Could you keep demexp-dev in the Cc:? It allows archiving of emails
>   for future people having same issue as me. ]

OK, sorry i don't have seen the CC.

> "Sylvain Le Gall" <address@hidden> writes:
> >> 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
> >
> > 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.
> Hmmm, I'm quite suprised that Printf is using C printf. But I checked in
> 3.08.2 source code and you are indeed right: Printf.scan_format is
> calling external format_float which has a call to C sprintf.
> > 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).
> Yes, using LANG=C when calling my program solves the issue. But for my
> autotests, I need to do that *from* the program. Do you see a way to set
> the locale from OCaml, for a given part of the code?

Humm, there is a way, but it is C code and it is not really clean:

/* Change language.  */
setenv ("LANGUAGE", "fr", 1);

/* Make change known.  */
  extern int  _nl_msg_cat_cntr;

(from the gettext manual:

> >> > 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 ?
> Sorry, I was confused, I meant s_, f_ & Co. functions.

No problem.

> > Why should it be an issue to use GettextStub.Native ?
> I don't know. :) I suppose that, as you have made gettext through
> Camomile available, there are some advantages to use it over the stub
> version?

Well, the avantage of camomile is that you can produce full ocaml native
application (almost without C binding). The only other advantage, is not
really "external developper" visible: it is a little bit cleaner because
you have better control of thread unsafe variable. But it is not an
issue, both implementation should work well.

Kind regard
Sylvain Le Gall

reply via email to

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