Module Simple_gettext

module Simple_gettext: sig .. end

Internationalisation of your program / library


Example

Typical use:

     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

Simple_gettext vs OCamlGettext

Why did you develop yet another gettext binding? Why not use the existing gettext binding (OCamlGettext)?

OCamlGettext is:

Functions

val bindtextdomain : string -> string -> unit

bindtextdomain domainname dirname tells to use directory dirname to look for translations for domainname

val textdomain : string -> unit

textdomain domainname sets current domain used by Simple_gettext.gettext

val i18n : ('a, unit, string) Stdlib.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 program

val 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