C API reference · Kjarni 0.2.8
translator
kjarni_translator_config_default
struct KjarniTranslatorConfig kjarni_translator_config_default(void);
Get default translator configuration.
kjarni_translator_new
enum KjarniErrorCode kjarni_translator_new(const struct KjarniTranslatorConfig *config, struct KjarniTranslator **out);
Create a new Translator. Downloads the model on first use.
Safety
configmust be null (defaults) or point to a valid config whose strings are null or nul-terminated.outmust be a valid, writable pointer.
kjarni_translator_free
void kjarni_translator_free(struct KjarniTranslator *translator);
Free a Translator.
Safety
translatormust be null, or a handle fromkjarni_translator_newnot already freed.
kjarni_translator_translate
enum KjarniErrorCode kjarni_translator_translate(const struct KjarniTranslator *translator, const char *text, const char *from, const char *to, char **out);
Translate a text. A null from or to uses the translator's default for it;
with neither a language nor a default, this fails with
KJARNI_ERROR_INVALID_CONFIG.
Safety
translatormust be a live handle;texta nul-terminated string;fromandtonull or nul-terminated.outmust be a valid, writable pointer. On success it receives a string the caller frees withkjarni_string_free; on failure it is set to null.
Kjarni runs the same engine on every platform: