Skip to content

Feature Suggestion: setting the default language to be the current language specified in the text function #6

@danielFHcode

Description

@danielFHcode

In the README file, one of the planned features is said to be:

  • Adding set and get method to set default language for a whole document

But typst already has a way of globally (or locally) getting and setting the language for the document - the lang field of the text function (see docs).

So what if we just set the default language to be context text.lang?:

#set text(lang: "en")
#day-name(1) // monday

#set text(lang: "fr")
#day-name(1) // lundi

This would be a breaking change, but seeing as how most people who use a date in a specific language, also probably write the rest of the text in that language, and also considering that this package is not at version 1 yet, I don't think this is much of an issue.

It seams like a pretty elegant solution to me, but even if another way of setting the default is chosen, I think that at least the default of the default should be the language specified in the text function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions