Chapter 1. Overview

Table of Contents

What is ocaml-gettext?
How is ocaml-gettext related to gettext?

What is ocaml-gettext?

ocaml-gettext is a library to support string translation in OCaml. It provides a simple interface to help programmers and translators to create programs that can support different languages. This allows the internationalisation of programs.

ocaml-gettext provides two main functionalities:

  • translate English strings into localised strings (depending on which gettext data are installed),

  • convert charset from the one used by the translator into the charset of the user.

The library is build according three points of view:

  • for the programmer: this library provides functions that can be used in OCaml,

  • for the translator: this library provides a standard file format (PO file) to help the translator,

  • for the user: this library provides a set of command line options to set the language and the charset.

ocaml-gettext was initially only a wrapper of gettext. It comes with a patch against the source of xgettext to add support of the OCaml language. As i already used this approach, i was convinced that this library should be better integrated by using more advanced features of OCaml (such as camlp4).

As a result of porting gettext to ocaml-gettext, we have :

  • a library that can understood the native format of gettext file (MO file),

  • two implementations: a wrapper around gettext and a pure OCaml implementation using camomile,

  • ocaml-gettext: a command line tool to help you to extract, to merge and to install gettext data.