Mc-Zen / tidy

A documentation generator for Typst in Typst.
https://typst.app/universe/package/tidy
MIT License
57 stars 2 forks source link

Allow localization through `style-args` for hard-coded strings #17

Closed mkpoli closed 8 months ago

mkpoli commented 8 months ago

For packages, especially templates, if one is only useful in a specific language that is not English, such as University thesis in monolingual countries (in Chinese or Japanese, etc.), or if a pacakge want to provided multi-lingual documentation, localization will become a requirement.

There are some baked-in strings such as Parameters and Defaults: that are currently customizable through custom styles. However, If one only wants to change the locale but keep the styles the same, it would be very much cost to do that. Instead, it would be helpful to allow localization through style-args.

Mc-Zen commented 8 months ago

Hi @mkpoli , yes I agree with you.

The theme customization is very clunky unfortunately and this will change when Typst adds custom types. I'll do a full rework of the customization interface then so it is based on show and set rules. It will be much easier to add such options then but I will still add support for those two now.

Mc-Zen commented 8 months ago

I've added the option local-names to show-module.

local-names (dictionary): Language-specific names for strings used in the output. Currently, these are parameters and default. You can for example use: local-names: (parameters: [Paramètres], default: [défault])