Skip to content

Improve Japanese translation and theme font rendering #11322

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

Merged
merged 3 commits into from
May 9, 2024
Merged

Improve Japanese translation and theme font rendering #11322

merged 3 commits into from
May 9, 2024

Conversation

mpcjazz
Copy link
Contributor

@mpcjazz mpcjazz commented May 9, 2024

  • Please commit to the dev branch
  • For contributing new features, please supplement and improve the corresponding user guide documents
  • For bug fixes, please describe the problem and solution via code comments
  • For text improvements (such as typos and wording adjustments), please submit directly

Completely revised the Japanese translation to make it more consistent with actual application operations.

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
Zuoqiu-Yingyi Yingyi / 颖逸
@88250 88250 changed the title Improved Japanese translation Improve Japanese translation May 9, 2024
mpcjazz added 2 commits May 9, 2024 12:59

Verified

This commit was signed with the committer’s verified signature.
Zuoqiu-Yingyi Yingyi / 颖逸

Verified

This commit was signed with the committer’s verified signature.
Zuoqiu-Yingyi Yingyi / 颖逸
@mpcjazz
Copy link
Contributor Author

mpcjazz commented May 9, 2024

Problem

Current default theme's system-ui font-family specifies the following two Chinese fonts:

  • "Hiragino Sans GB" (macOS)
  • "Microsoft Yahei" (Windows)

These fonts are also installed by default on macOS and Windows with Japanese locales, so Chinese fonts will be displayed even if Japanese is selected as the SiYuan interface language.

Solution 1

Add a Japanese font to the current system-ui font-family:

/* theme.css */
:root {
  --b3-font-family: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", "Hiragino Sans", "Hiragino Sans GB", "Yu Gothic UI", "Microsoft Yahei", sans-serif, "Apple Color Emoji", "Noto Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Android Emoji", "EmojiSymbols";
}

Specifying Japanese fonts as above will degrade the specificity of Chinese fonts and cause new problems in Chinese environments where the Japanese fonts specified here are installed. Also, specifying an internationalized font such as "Segoe UI" did not work either.

Solution 2

Use the :lang() pseudo-class to specify a Japanese font only when Japanese is selected as the interface language:

/* theme.css */
:lang(ja_JP):root {
  --b3-font-family: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", "Hiragino Sans", "Yu Gothic UI", sans-serif, "Apple Color Emoji", "Noto Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Android Emoji", "EmojiSymbols";
}

In this way, appropriate Japanese fonts can be specified without affecting other language environments.

Fixes

Using solution 2, assign "Hiragino Sans" (macOS) and "Yu Gothic UI" (Windows) to system-ui font-family in the current theme.css. This allows the default theme SiYuan, to display appropriate Japanese fonts when Japanese is selected as the interface language.

@88250 88250 added this to the 3.0.14 milestone May 9, 2024
@88250 88250 requested a review from Vanessa219 May 9, 2024 08:43
@88250 88250 changed the title Improve Japanese translation Improve Japanese translation and theme font rendering May 9, 2024
@Vanessa219 Vanessa219 merged commit 5d47fe4 into siyuan-note:dev May 9, 2024
1 check passed
@88250
Copy link
Member

88250 commented May 9, 2024

Thanks for the contribution!
感谢贡献!

@TCOTC TCOTC mentioned this pull request Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants