I'd like to get i18n working in my OCaml code (translating text messages into the user's preferred language). Most translatable strings are the first non-labelled argument to one of a small group of functions. e.g.
- Text output:
print "Feed '%s':" new_feed
- Errors:
raise_safe "Local feed file '%s' does not exist" path
- Logging:
log_warning ~ex "Error checking signature for %s" feed
In the GUI code, strings in ~label
arguments should be extracted too.
Is there some way I can extract these strings automatically? To make things more interesting, I use some syntax extensions (e.g. Lwt) too.
I see there is an ocaml-gettext package, but:
- It only seems to support a fixed set of functions (
f_
,s_
, etc). - OPAM says nothing uses it.
- It failed to install (had to unset
$NAME
first), then failed to uninstall too, which also suggests it's not heavily used.
What do people actually use/recommend?