OCaml (GNU gettext utilities)

Next: , Previous: , Up: Individual Programming Languages [Contents][Index]


16.5.22 OCaml

RPMs

ocaml, ocaml-gettext-devel

Ubuntu packages

ocaml, opam
opam install gettext-stub

File extension

ml

String syntax

"abc"

gettext shorthand

(s_ "abc") or, for format strings, (f_ "abc")

gettext/ngettext functions

s_, f_, sn_, fn_, and also gettext, fgettext, dgettext, fdgettext, dcgettext, fdcgettext, ngettext, fngettext, dngettext, fdngettext, dcngettext, fdcngettext.

textdomain

textdomain field in first parameter of Gettext.Program

bindtextdomain

dir field in first parameter of Gettext.Program

setlocale

Prerequisite

Declare the libraries gettext.base and gettext-stub in the ‘dune’ file.

Use or emulate GNU gettext

Use (assuming that you pass GettextStub.Native as second parameter of Gettext.Program)

Extractor

xgettext

Formatting with positions

In the source code: Printf.fprintf "%d %d"
In the msgid: "%d %d"
In the msgstr: "%2$d %1$d"
Note: This does not work yet; it depends on the completion of https://github.com/gildor478/ocaml-gettext/issues/39.

Portability

fully portable

po-mode marking

An example is available in the examples directory: hello-ocaml.

AltStyle によって変換されたページ (->オリジナル) /