ORT_LANG_XLIFF_UPDATE(3) | Library Functions Manual | ORT_LANG_XLIFF_UPDATE(3) |
ort_lang_xliff_update
—
update translations from configuration
library “libort-lang-xliff”
#include
<sys/queue.h>
#include <stdio.h>
#include <ort.h>
#include
<ort-lang-xliff.h>
int
ort_lang_xliff_update
(const struct
ort_lang_xliff *args, const struct config *cfg,
FILE *f, struct msgq *mq);
Outputs XLIFF 1.2 file to f merging existing
translations in args with new translations in
cfg. Errors and warnings are enqueued to
mq, if not NULL
. The arguments
recgnised in args are as follows:
ORT_LANG_XLIFF_COPY
mask is set and a
translation is not provided for a given label, use the default label
instead of erroring out.Returns one of the following values:
A simple scenario of creating a configuration, parsing standard input, linking, then joining with a translation file fr.xlf.
struct config *cfg; struct ort_lang_xliff args; struct msgq mq = TAILQ_HEAD_INITIALIZER(mq); FILE *f; const char *fname = "fr.xlf"; if ((f = fopen(fname, "r")) == NULL) err(1, "%s", fname); memset(&args, 0, sizeof(struct ort_lang_xliff)); args.in = &f; args.fnames = &fname; args.insz = 1; if ((cfg = ort_config_alloc()) == NULL) err(1, NULL); if (ort_parse_file(cfg, stdin, "<stdin>") && ort_parse_close(cfg)) ort_lang_xliff_update(&args, cfg, stdout, &mq); ort_write_msg_file(stderr, &cfg.mq); ort_write_msg_file(stderr, &mq); ort_config_free(cfg); ort_msgq_free(&mq);
October 25, 2021 | OpenBSD 6.7 |