Skip to content

feat: improve some translation options #1995

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

isolcat
Copy link

@isolcat isolcat commented Mar 23, 2025

Summary

This pull request addresses issue #1971 by adding configurable translation options to the theme-default package in Rspress. The changes enable dynamic translation for the following components:

  • SidebarMenu/index.tsx: Replaced hardcoded "Menu" with t('menuText').
  • CopyCodeButton.tsx: Replaced hardcoded "Copy code" with t('copyCode').
  • code/index.tsx: Replaced hardcoded "Toggle code wrap" with t('toggleCodeWrap').

To support these translations, I added new entries (menuText, copyCode, toggleCodeWrap) to i18n.json with default English and Chinese values. The useI18n hook is utilized to dynamically fetch translations

Note:I personally believe the search box width adjustment (to 960px with full-screen below 640px) is not necessary, as the current design appears sufficient

Related Issue

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

netlify bot commented Mar 23, 2025

Deploy Preview for aquamarine-blini-95325f ready!

Name Link
🔨 Latest commit 0c714c4
🔍 Latest deploy log https://app.netlify.com/sites/aquamarine-blini-95325f/deploys/67e41453d4d34b0008e48d22
😎 Deploy Preview https://deploy-preview-1995--aquamarine-blini-95325f.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 94 (🟢 up 8 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

Copy link

netlify bot commented Mar 23, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit 0c714c4
🔍 Latest deploy log https://app.netlify.com/sites/rspress-v2/deploys/67e4145352c4850008b4019c
😎 Deploy Preview https://deploy-preview-1995--rspress-v2.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 site configuration.

@Timeless0911 Timeless0911 changed the title feat:improve some translation options feat: improve some translation options Mar 24, 2025
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.

2 participants