Skip to content

Languages and environment

Every message of Kova, from the compiler’s errors to a built program’s runtime errors, exists in English and in French:

Terminal window
KOVA_LANG=fr kova run app.kova
Terminal window
erreur: types différents : `String` attendu, `Int` donné

The language is chosen, in this order, by:

  1. header { lang := fr } at the top of the program;
  2. KOVA_LANG (en, fr);
  3. the system’s language: LC_ALL, LC_MESSAGES, LANG;
  4. English.

A built executable carries every language and picks its own when it starts, so the same file speaks French on a French computer and English elsewhere.

The messages live in locales/en.kova and locales/fr.kova, written in Kova itself. Running a translation file, kova run locales/fr.kova, runs nothing: it lists the messages still missing compared with the other languages. A new language is a new file there, plus one line in the compiler’s list of languages (LANGUAGES in src/locale.rs).

VariableEffect
KOVA_LANGthe language of Kova’s messages: en, fr
KOVA_SEEDa number: random, shuffled and chosen repeat the same draws (never secure)
KOVA_LOGthe level of log: debug, info, warning, error; it wins over the program
NO_COLORset: no colors, even on a terminal
FORCE_COLORset: colors even when the output is not a terminal
KOVA_UI_SCRIPT1: a ui program opens no window, prints its views and reads its clicks from its input
KOVA_UI_HIDDEN1: the window is never shown (Windows, macOS)
KOVA_LEAKS1: a text never freed stops the program with the code 102 (used by Kova’s own tests)
TZthe time zone of Date.today and DateTime.now, as everywhere on Linux and macOS