Skip to content

Instantly share code, notes, and snippets.

@appare45
Created April 10, 2026 07:34
Show Gist options
  • Select an option

  • Save appare45/95977ed9e037ee1d57a14737f65bcdb9 to your computer and use it in GitHub Desktop.

Select an option

Save appare45/95977ed9e037ee1d57a14737f65bcdb9 to your computer and use it in GitHub Desktop.
Typstで多言語対応したいときに見る
#let t(it) = {
if type(it) == dictionary {
context it.at(text.lang, default: it.at(it.keys().first()))
} else {
it
}
}
#let hoge = (
ja: "日本語",
en: "English",
)
#set text(lang: ja)
#t(hoge) // => 日本語
#set text(lang: en)
#t(hoge) // => English
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment