Skip to content

Conversation

@YDX-2147483647
Copy link
Member

@YDX-2147483647 YDX-2147483647 commented Oct 15, 2025

Blocked by #20.

Preview: https://ydx-2147483647.github.io/typst/.

Feedbacks from the Chinese community

Other known issues that need to be fixed outside typst-docs-web

The following issues are out of the scope of typst-docs-web.

@3w36zj6
Copy link
Member

3w36zj6 commented Oct 18, 2025

Would zh-cmn-Hans-CN be better than zh-Hans?

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.

@YDX-2147483647
Copy link
Member Author

Would zh-cmn-Hans-CN be better than zh-Hans?

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 zh-Hans is better.

In fact, I've considered between zh-Hans and zh-CN. I chose zh-Hans because CLReq uses that.
图片

Also, I think it would be convenient to make it easy to extend the social icons in the header.

How about changing discordServerUrl: string; githubRepositoryUrl: string to social: OrderedMap<'github' | 'discord' | 'qq' | 'homepage' | …, { url: string, icon: Fragment, aria_text: string }>?
This can also support reordering the icons in the Header and Footer.

either make fonts easily replaceable or switch to a font that can be used consistently across many languages

I inspect the current design and have no idea how can the former be implemented…
As for the latter, I guess Source Han Sans & Serif are the only options?

@netlify
Copy link

netlify bot commented Oct 31, 2025

Deploy Preview for typst-docs-web ready!

Name Link
🔨 Latest commit 56dc286
🔍 Latest deploy log https://app.netlify.com/projects/typst-docs-web/deploys/693d551cf36df4000803dc52
😎 Deploy Preview https://deploy-preview-21--typst-docs-web.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

YDX-2147483647 added a commit to YDX-2147483647/typst-docs-web that referenced this pull request Nov 21, 2025
YDX-2147483647 added a commit to YDX-2147483647/typst-docs-web that referenced this pull request Dec 4, 2025
YDX-2147483647 added a commit to YDX-2147483647/typst-docs-web that referenced this pull request Dec 4, 2025
YDX-2147483647 added a commit to YDX-2147483647/typst-docs-web that referenced this pull request Dec 5, 2025
YDX-2147483647 added a commit to YDX-2147483647/typst-docs-web that referenced this pull request Dec 5, 2025
YDX-2147483647 added a commit to YDX-2147483647/typst-docs-web that referenced this pull request Dec 5, 2025
@YDX-2147483647
Copy link
Member Author

YDX-2147483647 commented Dec 11, 2025

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.

@YDX-2147483647 YDX-2147483647 marked this pull request as ready for review December 11, 2025 13:09
@3w36zj6 3w36zj6 requested a review from Copilot December 13, 2025 08:44
Copy link
Contributor

Copilot AI left a 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.

@3w36zj6
Copy link
Member

3w36zj6 commented Dec 13, 2025

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);

Copy link
Contributor

Copilot AI left a 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.

Copy link
Member Author

@YDX-2147483647 YDX-2147483647 left a 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;

@3w36zj6
Copy link
Member

3w36zj6 commented Dec 13, 2025

The approach looks good, but I personally prefer using satisfies:

props satisfies never;
throw new Error("Unreachable code executed.");

Also, the never type represents something that can never be reached and does not exist at runtime. Therefore returning a value inferred as never is meaningless. Throwing an Error is the appropriate choice.

Copy link
Contributor

Copilot AI left a 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.

Copy link
Contributor

Copilot AI left a 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.

Copy link
Member

@3w36zj6 3w36zj6 left a 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.

@3w36zj6 3w36zj6 changed the title chore: add zh-Hans (Chinese, simplified) translation feat: add zh-Hans (Chinese, simplified) translation Dec 13, 2025
@3w36zj6 3w36zj6 merged commit 3e1eb3b into typst-community:main Dec 13, 2025
23 checks passed
@YDX-2147483647 YDX-2147483647 deleted the zh branch December 13, 2025 15:07
YDX-2147483647 added a commit to YDX-2147483647/typst that referenced this pull request Dec 13, 2025
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.

2 participants