package ocsigen-i18n

All checked builds pass
  1. Overview
  2. Docs
Internationalisation of OCaml apps

Install

dune-project
 Dependency

Authors

Maintainers

Sources

6.0.0.tar.gz
md5=dfed0db1af2dc9ceb67cbe1bc57ae606
sha512=ac069ff33ecddb6f730ebb00b28e24cb75d0d788e02192bbede1838ae225f1a8ed00696f09f04a76f5627fac9659095219644e6675266816cec16b4f154abc97

doc/templates.html

Template syntax

Translations are defined in a TSV file. The first column is the key (used as the OCaml function name). The following columns are the translations for each language, in the order specified by the --languages option.

Simple strings

foo	This is a simple key.	Ceci est une clé toute simple.

Variables

{{x}} defines a labelled argument ~x:

bar	I am {{x}}.	Je suis {{x}}.

Typed variables

{{x %d}} defines a labelled argument ~x with a format specifier:

bu	I am {{x %s}} ({{n %d}}).	Je suis {{x %s}} ({{n %d}}).

Conditional values

{{{c?if_true||if_false}}} defines an optional boolean argument ?(c=false).

baz	There {{{c?are||is}}} apple{{{c?s||}}} here!	Il y a {{{c?des||une}}} pomme{{{c?s||}}} ici !

Notes

  • Languages do not need to use the same variables. The compiler generates a function taking all parameters it detects across all languages.
  • A variable name used twice refers to the same argument.
  • The TSV file must end with a newline.