Translation
Kx Markdown can request an automatic translation of the front of a practice line.
Translation uses the thash instruction. The resulting translation is stored as a language-specific answer.
Request a Translation
Section titled “Request a Translation”An empty thash requests a translation:
- ¿Cómo estás? [thash:]By default, thash translates the front into English.
After Kx Toolbox performs the translation, the translated text is placed in the appropriate language-specific answer.
For example:
- ¿Cómo estás? [thash:d7662631, ans-en-N: "How are you?"]Choose the Translation Language
Section titled “Choose the Translation Language”Use a language suffix when you want to explicitly select the target language.
English:
[thash-en:]Spanish:
[thash-es:]The currently supported forms demonstrated here are:
[thash:][thash-en:][thash-es:]The unsuffixed form:
[thash:]defaults to English.
Translation Direction
Section titled “Translation Direction”The target language determines which language-specific answer receives the translation.
Spanish content can be translated into English:
- ¿Dónde está la biblioteca? [thash-en:]After translation:
- ¿Dónde está la biblioteca? [thash:76e1a039, ans-en-N: "Where is the library?"]English content can be translated into Spanish:
- Where is the station? [thash-es:]After translation:
- Where is the station? [thash:b634fa8f, ans-es-N: "¿Dónde está la estación?"]The resulting answer therefore records the target language of the translation.
Translation Results
Section titled “Translation Results”Translations use the normal language-specific answer syntax.
English:
[ans-en-N: "How are you?"]Spanish:
[ans-es-N: "¿Dónde está la estación?"]The general relationship is:
front ↓translation request ↓translated answer
[thash-en:] ↓[ans-en-N: "..."]
[thash-es:] ↓[ans-es-N: "..."]The answer contains the translated text. thash manages the translation request and its relationship to the front.
Translation Hash
Section titled “Translation Hash”Once a translation has been generated, thash contains a hash associated with the front content:
[thash:d7662631]A completed line therefore looks like:
- ¿Cómo estás? [thash:d7662631, ans-en-N: "How are you?"]The two values have different jobs:
thash:d7662631identifies the front content associated with the translation, while:
ans-en-N: "How are you?"contains the translated result.
The hash allows Kx Toolbox to determine whether an existing translation still belongs to the current front.
If the front changes, the stored hash no longer matches the front content. The translation can then be generated again and both the answer and hash updated.
Conceptually:
Front ↓Compare front with thash ↓Still matches? ├─ yes → keep existing translation └─ no → translate again ↓ update answer + update thashThis prevents a translation generated from an earlier version of the front from remaining attached after the front has changed.
Example
Section titled “Example”A translation request might begin as:
- ¿Qué día es hoy? [thash:]After translation it can become:
- ¿Qué día es hoy? [thash:56918c6c, ans-en-N: "What day is today?"]If the front is later edited, the existing hash provides the information Kx Toolbox needs to recognize that the translation should be refreshed.
