-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add zh-Hans (Chinese, simplified) translation #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Would Feedback from the Chinese community is informative. Since the appropriate font family may differ between languages, it would be good to either make fonts easily replaceable or switch to a font that can be used consistently across many languages. Also, I think it would be convenient to make it easy to extend the social icons in the header. |
Yes, that's the most accurate code. However, I don't want it to be too specific. Considering that only one single Chinese translation is provided at present, I think In fact, I've considered between
How about changing
I inspect the current design and have no idea how can the former be implemented… |
3fcbc2f to
5bd8769
Compare
✅ Deploy Preview for typst-docs-web ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Implements the idea in typst-jp/docs#303 (comment) Blocks typst-community#21
Implements the idea in typst-jp/docs#303 (comment) Blocks typst-community#21
Implements the idea in typst-jp/docs#303 (comment) Blocks typst-community#21
Implements the idea in typst-jp/docs#303 (comment) Blocks typst-community#21
Implements the idea in typst-jp/docs#303 (comment) Blocks typst-community#21
|
Hi! I'm marking this PR as ready for review. Switching to Chinese fonts requires nontrivial edits. We found that maintaining a git patch is simpler and more reliable. Therefore, the problem becomes out of the scope of typst-docs-web. With that said, if you plan to deal with #42 in the near future, then this PR still needs to be postponed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for Simplified Chinese (zh-Hans) translation to the documentation website. The translation is maintained by the Typst Chinese Community and uses QQ as the primary social platform instead of Discord, which is more popular in China.
Key changes:
- New Chinese translation file with localized strings for all UI elements and documentation metadata
- Language option "zh-Hans" added to metadata type definitions and JSON schema
- Import switch case added to dynamically load the Chinese translation module
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/translation/zh-Hans.tsx | Complete Chinese translation implementation with QQ social link validation and bilingual site notice |
| src/translation/index.tsx | Added zh-Hans case to the language import switch statement |
| src/metadata.ts | Extended language type union to include "zh-Hans" |
| metadata.schema.json | Added "zh-Hans" to the allowed language enum values |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This is outside the scope of this PR, but it would be helpful if tsc could detect whether switch cases are exhaustive. export const assertNever = (_: never): never => {
throw new Error("Unreachable code executed in assertNever");
} default:
return assertNever(props); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is outside the scope of this PR, but it would be helpful if tsc could detect whether switch cases are exhaustive.
Wow, I didn't know typescript is capable of that!
LLM shows me a few alternative methods. How about using the one below? It'll also assist with runtime debugging.
default:
- return null;
+ const exhaustiveCheck: never = props;
+ return exhaustiveCheck;|
The approach looks good, but I personally prefer using props satisfies never;
throw new Error("Unreachable code executed.");Also, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3w36zj6
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I'm not a native Chinese speaker, I can't evaluate the translation content, but the implementation seems good to me.
In the future, if any of the core maintainers of typst-cn show interest, we could consider adding reviewers to the CODEOWNERS file.

Blocked by #20.Preview: https://ydx-2147483647.github.io/typst/.
Feedbacks from the Chinese community
Resolved in feat: support general social links and icons #39 and fix: import translations lazily #43.
Other known issues that need to be fixed outside typst-docs-web
The following issues are out of the scope of typst-docs-web.
Font: BIZ UDGothic is not suitable for Chinese. Although we can recognize they're Han characters, it feels strange.
Resolved by keeping a patch. https://github.com/YDX-2147483647/typst/blob/2d150225d88c3399905ab51e9efff108fc64514b/docs-web-scripts/0001-fix-use-Chinese-fonts.patch
**译者注:**collides with 💡./reference/math/attachshould be put at/reference/math/attach/, to be consistent with other pages.Some
"in HTML are“”, e.g.,<span class=“typ-key”>.