- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13
feat: add translation switcher to website #284
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
Co-authored-by: Copilot <[email protected]>
| Could you please do a quick review? @YDX-2147483647 @Its-Just-Nans | 
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.
- 
English are generally longer than Japanese. Therefore, some expressions take too much space and need to be simplified. 
- 
The translation framework is kinda ad hoc. For example, en-US.tsxis never referenced, so the type checker might neglect it.
- 
I've just noticed that the footer is missing in TranslationComponent.docs/website/src/components/ui/common/Footer.tsx Lines 35 to 41 in 4e3161c Translated by{" "} <a href={githubOrganizationUrl} class="text-gray-600 hover:text-gray-800 transition-colors" > Typst Japanese Community </a> 
        
          
                website/src/translation/en-US.tsx
              
                Outdated
          
        
      | case "langVersion": | ||
| return <>English Version</>; | ||
| case "translationRate": | ||
| return <>Translation rate</>; | 
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.
Co-authored-by: Y.D.X. <[email protected]>
Co-authored-by: Y.D.X. <[email protected]>
Co-authored-by: Y.D.X. <[email protected]>
Co-authored-by: Y.D.X. <[email protected]>
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 implements a translation switcher system for the website by refactoring the translation architecture to support multiple languages centrally.
- Extracts shared translation types and interfaces into a central index file
- Adds English (en-US) translation alongside existing Japanese (ja-JP) translation
- Updates all import paths to use the new centralized translation structure
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description | 
|---|---|
| website/src/translation/index.tsx | Creates central translation types and exports current language selection | 
| website/src/translation/ja-JP.tsx | Refactors to use shared types and updates import paths | 
| website/src/translation/en-US.tsx | Adds complete English translation implementation | 
| website/src/components/ui/common/*.tsx | Updates import paths to use centralized translation module | 
| website/src/components/ui/*.tsx | Updates import paths to use centralized translation module | 
| website/src/components/templates/*.tsx | Updates import paths to use centralized translation module | 
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| case "translated": | ||
| return <>Translated</>; | ||
| case "translatedMessage": | ||
| return <>This page has been translated into English.</>; | 
    
      
    
      Copilot
AI
    
    
    
      Sep 3, 2025 
    
  
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.
The message 'This page has been translated into English' is misleading for an English translation file. Since this is the English version, it should indicate the page is in English or original content, not that it was translated into English.
| return <>This page has been translated into English.</>; | |
| return <>This page is in English.</>; | 
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.
I also find this a bit odd, but in the first place, the original (English) version shouldn’t need to display translation status, nor should it. Since en-US.tsx is just a sample for i18n support, I think it’s fine to leave it as is.
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.
Better, but Footer.tsx was not comitted? Was that intentional?
779e3a0    to
    f44f181      
    Compare
  
    Co-authored-by: Y.D.X. <[email protected]>
| I accidentally forgot to commit  | 
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.
Great!


cf. #233