How to change i18n tables of packages?

I use the theorion package and it is all nice except that I want to make one change to a translation choice they have made. When I set the language to de they translated “theorem” to “Theorem” and I would like to use “Satz”.

I know that it is possible to create a completely new environment which uses “Satz”, but is there some mechanism to hook into their i18n table from my document? Basically, I want to modify this dictionary entry from within my document.

Looking and adapting the example at theorion – Typst Universe you can use:

#theorem(title: "Euclid's Satz", supplement: [Satz])[
    There are infinitely many prime numbers.
  ]

or

  // 3. Custom theorem environment for yourself
  #let (theorem-counter, theorem-box, theorem, show-theorem) = make-frame(
    "theorem",
    "Satz", // supplement, string or dictionary like `(en: "Theorem")`, or `theorion-i18n-map.at("theorem")` for built-in i18n support
    counter: theorem-counter, // inherit the old counter, `none` by default
    inherited-levels: 2, // useful when you need a new counter
    inherited-from: heading, // heading or just another counter
    render: (prefix: none, title: "", full-title: auto, body) => [#strong[#full-title.]#sym.space#emph(body)],
  )
  #show: show-theorem

  #theorem(title: "Euclid's Satz")[
    There are infinitely many prime numbers.
  ]

image

1 Like

There is no package API, so if it’s possible, you can override entries. #(theorion-i18n-map.at("theorem").de.de = "Satz") does work, but it’s better to upstream the changes or use a more direct API like shown above.

1 Like