Skip to content

Translation

Kx Markdown can request an automatic translation of the front of a practice line.

Translation is controlled with a thash instruction.

An empty thash requests a translation:

- ¿Cómo estás? [thash:]

By default, thash translates the front content into English.

After translation, Kx Toolbox places the translated text into the appropriate answer instruction.

For example:

- ¿Cómo estás? [thash:d7662631, ans-en-N: "How are you?"]

The translation becomes an English answer, while thash contains the hash associated with the front content.

Use a language suffix to explicitly select the target language.

[thash-en:]

requests an English translation.

[thash-es:]

requests a Spanish translation.

For example:

- Where is the station? [thash-es:, ans-es-N: "¿Dónde está la estación?"]

The general forms are:

[thash:]
[thash-en:]
[thash-es:]

thash without a language suffix defaults to English.

After a translation has been generated, the empty thash value is replaced by a hash:

[thash:d7662631]

The hash identifies the front content used to produce the translation.

A completed translated line can therefore look like:

- ¿Cómo estás? [thash:d7662631, ans-en-N: "How are you?"]

The translation hash allows Kx Toolbox to determine whether the existing translation still corresponds to the current front.

If the front changes, its existing hash no longer matches.

Kx Toolbox can then translate the changed front again and update both the translation and its hash.

Conceptually:

Front
Hash front content
Compare with thash
Different?
↓ yes
Translate front again
Update answer + thash

This helps prevent an old translation from remaining attached to practice content that has changed.

The generated translation is stored using the normal language-specific answer syntax.

English:

[ans-en-N: "How are you?"]

Spanish:

[ans-es-N: "¿Dónde está la estación?"]

The answer language therefore records the language of the resulting translation.