You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Access internal localization from typst document #7536
feature requestNew feature or requesti18nAbout language- or script-specific features. May need attention from native speakers.scriptingAbout Typst's coding capabilities
When setting a document's language, some parts of the document are translated (ie outline).
In particular for package development, it would be nice to be able to access it
Implementation wise, I was thinking of either:
exposing a function, like localize(word: str, lang: lang.text | auto | none = auto)
exposing a map, like localization, and if you want to access the default outline translation, you'd access with #context localization.outline
The first option is error prone (if the word does not exist) and can be misleading (could hint at user made localization which is not its purpose), while the second option can be rather verbose when working in multilingual contexts (would need to do {set(lang: "fr"); #context localization.outline} to get a different language)
Something to keep in mind is that relying on context for both function would probably wrap the output in a context block, which might be unwanted in some cases
Let me know if I missed an already existing way to do this
Use Case
This feature would be useful for libraries that try to supplement typst in a generic way. I'm looking at Touying for example, that implements its own translations of outline because it wants to set the title of the slide to the title of the outline, and can't work its way backwards to extract the name from the outline body.
Reacted by Forgenet, Liara, jqwv and Johannes Schöneberger
I am working on a package to mimic the varioref LaTeX package, and that would be useful to me for implementing things like “figure 3 on the preceding page”.
feature requestNew feature or requesti18nAbout language- or script-specific features. May need attention from native speakers.scriptingAbout Typst's coding capabilities
Activity
ortolot commentedon Dec 17, 2025
I am working on a package to mimic the varioref LaTeX package, and that would be useful to me for implementing things like “figure 3 on the preceding page”.