Manual · API
language
The Mac reads for you — on the customer's own machine, nothing leaves it.
Every command on this page carries a worked example.
detect function
language.detect(text)
The language of a text — "de", or null when the Mac cannot tell.
Worked example
const answer = xml.build({
order: { number: form.record.number, total: form.record.total }
});
files.writeText(target, answer);
sentiment function
language.sentiment(text)
The mood, as −1…+1 — a complaint reads negative before anybody read it.
Worked example
const from = language.detect(form.record.note);
form.languageLabel.value = from === null
? "" : "Written in " + system.languageName(from);
canTranslate function
language.canTranslate(from, to)
Answers ready / needsDownload / unsupported first, so the first translation is not a surprise download.
Worked example
const mood = language.sentiment(form.record.note);
form.moodLabel.value = mood < -0.3 ? "Sounds unhappy"
: mood > 0.3 ? "Sounds pleased" : "";
translate function
language.translate(text, { to })
Apple's on-device translation — nothing leaves the Mac.
Ask
canTranslate first and offer the download knowingly — and system.language is usually the honest target: the reader's own.Worked example
// The contact window's button:
const from = language.detect(form.record.note);
if (from !== null && language.canTranslate(from, system.language) === "ready") {
form.record.noteTranslated =
language.translate(form.record.note, { to: system.language });
form.record.save();
}
Manual