NAME
ort_lang_xliff_extract
—
extract translatable strings from ort
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_extract
(const struct
ort_lang_xliff *args, const struct config *cfg,
FILE *f, struct msgq *mq);
DESCRIPTION
Outputs an XLIFF 1.2 file to f consisting of
translatable labels in cfg with the parameters in
args. 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_COPY
mask is set, the translation emits both<source>
and<target>
directives, otherwise it emits only<source>
.
Only translatable components (e.g,. an enumeration item) with labels are queued for translation.
Generated content conforms to the strict XLIFF 1.2 schema.
RETURN VALUES
Returns zero on failure, non-zero on success. Failure occurs with memory exhaustion or failure to write to f.
EXAMPLES
A simple scenario of creating a configuration, parsing standard input, linking, then extracting translations is as follows.
struct config *cfg; struct ort_lang_xliff args; struct msgq mq = TAILQ_HEAD_INITIALIZER(mq); memset(&args, 0, sizeof(struct ort_lang_xliff)); if ((cfg = ort_config_alloc()) == NULL) err(1, NULL); if (ort_parse_file(cfg, stdin, "<stdin>") && ort_parse_close(cfg)) ort_lang_xliff_extract(&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);