package ocsigen-i18n
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
md5=dfed0db1af2dc9ceb67cbe1bc57ae606
sha512=ac069ff33ecddb6f730ebb00b28e24cb75d0d788e02192bbede1838ae225f1a8ed00696f09f04a76f5627fac9659095219644e6675266816cec16b4f154abc97
doc/ppx.html
PPX rewriter
The ocsigen-i18n-rewriter PPX extension transforms [%i18n ...] expressions into calls to the generated translation functions.
Setup
Add the PPX to your dune file:
(preprocess (pps ocsigen-i18n -- --default-module MyI18n))
where MyI18n is the name of the module generated by ocsigen-i18n-generator (the basename of the output file, capitalized).
Without dune, use:
-ppx 'ocsigen-i18n-rewriter --default-module MyI18n'
Expressions
The PPX supports the following forms:
Expression | Meaning |
|---|---|
| Calls |
| Calls |
| Passes a labelled argument |
| Calls |
| Calls |
Module affixing
To avoid redundancy when using multiple i18n modules, you can auto-prefix and auto-suffix module names:
(preprocess (pps ocsigen-i18n -- --default-module MyI18n --prefix Pr_ --suffix _i18n))
With this configuration, [%i18n Feature.foo] becomes Pr_Feature_i18n.Tr.foo ().
Important: Do not name your i18n file s.tsv, as S is reserved for the string module.