[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: David MENTRE
Subject: [Demexp-dev] Re: Issue to use ocaml-gettext with lablgtk
Date: Tue, 24 Jan 2006 19:52:16 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

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.


>> 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!

Here is my definition of my program's Gettext module:

module Gettext = Gettext.Program
      let textdomain   = "demexp"
      let codeset      = Some "UTF-8"
      let dir          = None
      let dependencies = Gettext.init

The .glade translation works when calling my program with:
 $ echo $LANG

 $ ./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"].

But now working translation raises another issue: call to printf are

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

 - I'm having autotest where I check hard-coded results for certain
   function calls. This behaviour breaks them.

> 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?

Best wishes,
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]