Skip to content

Make all components with English text functional client components #414

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 9 commits into
base: master
Choose a base branch
from

Conversation

danielhjacobs
Copy link
Collaborator

This unlocks client-side translations (#358) and will be necessary whether we use next-export-i18n or custom translation code. I feel like no one wants to accept #358 yet, but doing this first can make the commits there a lot cleaner.

@danielhjacobs danielhjacobs force-pushed the make-all-pages-client branch 4 times, most recently from 6d496a9 to 8e00524 Compare May 7, 2025 16:41
@danielhjacobs danielhjacobs force-pushed the make-all-pages-client branch from 8e00524 to f8dcb10 Compare May 28, 2025 15:38
@danielhjacobs danielhjacobs requested a review from kjarosh May 30, 2025 20:23
@danielhjacobs
Copy link
Collaborator Author

Why this will be needed:

Assuming we want to keep serving the website client-side, the website language needs to be checked client-side in order to apply translations. That means changing the language needs to, in some way, be done by JavaScript. next-export-i18n has two ways to do that: check the window.location.search or window.localStorage, and as window is only available client-side, either way it will only work on client components. Therefore, every component with English text (including the header and footer) needs to be a client component.

@danielhjacobs
Copy link
Collaborator Author

For a draft with translations that build upon this, see danielhjacobs#4

@torokati44
Copy link
Member

Since the current website was mostly your work originally, do you think you could spare some minutes to review this, @Dinnerbone? Only if your time and energy allows it, of course!

@danielhjacobs
Copy link
Collaborator Author

danielhjacobs commented Jun 16, 2025

Of note is there's something, previously discussed on Discord, that should probably be done to improve the performance of this, specifically when it comes to the compatibility and AVM2 compatibility pages. Namely, the avm2-report should be copied to the website's static files folder (https://github.com/ruffle-rs/ruffle-rs.github.io/tree/master/public) in a pre-build step, instead of using the new fetch-report route.

The two places with const reportReq = await fetch("/compatibility/fetch-report"); can then const reportReq = await fetch("/avm2-report.json"); instead.

Edit: Done

@danielhjacobs danielhjacobs force-pushed the make-all-pages-client branch from 532a4c9 to 1ad0707 Compare June 16, 2025 14:29
@danielhjacobs danielhjacobs force-pushed the make-all-pages-client branch from 1ad0707 to dc19b3d Compare June 16, 2025 14:34
@danielhjacobs danielhjacobs requested a review from Dinnerbone June 16, 2025 17:27
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