module Simple_gettext:sig
..end
open Simple_gettext
...
Simple_gettext.textdomain "mathplot";
...
print_endline (i18n "Hello %s!" name);
Then use xgettext-ocaml -o foo.pot *.ml
More information: overview of gettext
Why did you develop yet another gettext binding? Why not use the existing gettext binding (OCamlGettext)?
OCamlGettext is:
val bindtextdomain : string -> string -> unit
bindtextdomain domainname dirname
tells to use directory dirname
to look for translations for domainname
val textdomain : string -> unit
val i18n : ('a, unit, string) Pervasives.format -> 'a
i18n msgid args
returns the string msgid
translated using current domain (set using Simple_gettext.textdomain
)val i18n_ : string -> string
i18n_ msgid
returns the string verbatim. Useful for messages translated later (using Simple_gettext.gettext
or Simple_gettext.dgettext
) in the programval gettext : string -> string
gettext msgid
returns the string msgid
translated using the current domain (set using Simple_gettext.textdomain
)val dgettext : string -> string -> string
dgettext domainname msgid
returns the string msgid
translated using domainname