Skip to content

Add document locale support#49

Merged
Mc-Zen merged 5 commits intoMc-Zen:mainfrom
F0rgenet:add-locales
Apr 26, 2025
Merged

Add document locale support#49
Mc-Zen merged 5 commits intoMc-Zen:mainfrom
F0rgenet:add-locales

Conversation

@F0rgenet
Copy link
Copy Markdown
Contributor

@F0rgenet F0rgenet commented Apr 8, 2025

Adds possibility to use

#set text(lang: "fr")

I used this file to determine all supported languages:
https://github.com/typst/typst/blob/main/crates/typst-library/src/text/lang.rs

Users can still use local-names argument to provide additional translations/customization (it will be prioritized), this PR is backwards compatible

This one needs attention, maybe it could be done better than i did

Closes #47

@F0rgenet
Copy link
Copy Markdown
Contributor Author

F0rgenet commented Apr 8, 2025

I have rebased this branch on main (with previous commits), it seems that github doesn't care about PRs that depend on each other, maybe if you will merge previous, this PR will add only one commit

@F0rgenet
Copy link
Copy Markdown
Contributor Author

F0rgenet commented Apr 8, 2025

I also suggest option in repo settings when PRs need approval only for new contributors

@Mc-Zen
Copy link
Copy Markdown
Owner

Mc-Zen commented Apr 9, 2025

Actually it is already set to Require approval for first-time contributors but only now after I merged your former PR, GitHub considers you a not-first-time contributor I guess.

@F0rgenet
Copy link
Copy Markdown
Contributor Author

F0rgenet commented Apr 9, 2025

Also, feel free to correct my wording — im not a native English speaker. I understand English better than I speak it, so I might make some mistakes here and there

For the same reason, I would prefer not to write a documentation block for this feature if you decide to merge it :)

@F0rgenet
Copy link
Copy Markdown
Contributor Author

F0rgenet commented Apr 9, 2025

And should we update custom-style.typ in funny-math example? Should custom styles respect multiple languages?

@Mc-Zen
Copy link
Copy Markdown
Owner

Mc-Zen commented Apr 17, 2025

Hi, I'm sorry that I'm only now getting back to your PR but I had some other important duties this week.

I like the idea and would like to adopt this feature but I have one or two suggestions.

  • Let us make the parameter local-names of show-module default to auto. auto means "use the language currently set with the predefined translations".
  • I also think that partial overrides would make sense if the user only does not like the word for "variables" for example.

I will add a commit to address these points.

@Mc-Zen
Copy link
Copy Markdown
Owner

Mc-Zen commented Apr 17, 2025

Later, with custom types, translations could be solved much easier and more natively I think but that's a story for a future time.

@Mc-Zen Mc-Zen merged commit 7bdff6c into Mc-Zen:main Apr 26, 2025
1 check passed
@Mc-Zen
Copy link
Copy Markdown
Owner

Mc-Zen commented Apr 26, 2025

Thank you!

@Mc-Zen
Copy link
Copy Markdown
Owner

Mc-Zen commented Apr 26, 2025

I just released an update with the new feature included. It should be on Typst Universe by the start of the next week :)

@F0rgenet F0rgenet deleted the add-locales branch April 27, 2025 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add outline localization support

2 participants