NAME
ort_lang_xliff_update —
update translations from
configuration
LIBRARY
library “libort-lang-xliff”
SYNOPSIS
#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);
DESCRIPTION
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:
- unsigned int flags
- If the
ORT_LANG_XLIFF_COPYmask is set and a translation is not provided for a given label, use the default label instead of erroring out. - FILE **in
- XLIFF 1.2 input files consisting of existing translations.
- const char *const *fnames
- The filenames (for informational purposes only) of files in in.
- size_t insz
- The number of elements in in and fnames.
RETURN VALUES
Returns one of the following values:
EXAMPLES
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);