ISC-HEI / isc-hei-report

A typst template for reports in the ISC @ HEI curricula
https://isc.hevs.ch
MIT License
6 stars 2 forks source link

added toc-title project parameter #6

Closed LordBaryhobal closed 4 months ago

LordBaryhobal commented 4 months ago

added project parameter to change the default table of contents title (default: "Table des matières") fixes #4

Example:

#show: project.with(
  language: "en",
  toc-title: "Table of contents"
)
LordBaryhobal commented 4 months ago

It could also be a good idea to add some automatic values depending on the language. This could be done by setting the default value to auto and using a dictionary of translatable words.

For example:

#let langs = (
  fr: (
    toc-title: "Table des matières"
  ),
  en: (
    toc-title: "Table of contents"
  )
)

#let i18n(lang, key) = {
  if not lang in langs {
    lang = "fr"
  }
  let keys = langs.at(lang)
  if not key in keys {
    panic("I18n key " + key + "doesn't exist")
  }
  return keys.at(key)
}
#let project(
  toc-title: auto
) = {
  if toc-title == auto {
    toc-title = i18n(language, "toc-title")
  }
}
pmudry commented 4 months ago

Accepted as a temporary fix, thank you ! A nicer solution will be implemented using your suggestion refered in #8.