feat(redesign): i18n language selection#2197
Conversation
✅ Deploy Preview for expressjscom-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@g-francesca, Are we going to use .mdx file in future? Why underscore is excluded inside pattern? |
Moved translation files from locales to ui under src/i18n and updated all corresponding references across the project.
@ShubhamOulkar I added mdx in case you want to use it in the future, but if this is not the case, we can remove it. |
|
Technically, using MDX is ideal if we want to use components inside our Markdown, so that’s fine. |
astro/src/pages/404.astro
Outdated
| <div> | ||
| <Button as="a" href={`/${lang}/`} variant="primary">{t('404.goHome')}</Button> | ||
| </div> |
There was a problem hiding this comment.
We should add a call to action to report it in case it’s an error, like we have on the website.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
While running locally, i18n works for this page. But once it’s built, it doesn’t work because the pages are static and Astro only compiles a single 404 page. I suppose that if the page weren’t static, i18n would work for this, but we can’t enable server rendering since the site is built with GitHub Actions, and changing the infrastructure isn’t something we want to do.
There was a problem hiding this comment.
LGTM, you can merge it if no one else suggests changes. It’s been a heavy week and I only had the chance to review the PR today
Important note: on the current site we have a banner saying that translations might be outdated. We shouldn’t add that in this redesign, because they actually won’t be outdated anymore since we now have automation that ensures they’re always up to date.
It’s true that we still have some mixed content, though. So instead, we should add a button at the very end like ‘Want to help translate?’ and link it to the contribution section that explains how to translate the site.
But that can be done in a future PR.
Thank you for the review @bjohansebas. I'm merging the PR, and I've noted your comment about the help with translations. |


preview: https://deploy-preview-2197--expressjscom-preview.netlify.app/
This PR implements internationalization (i18n) support for the Express.js documentation site with a language selector component that allows users to switch between 10 supported languages.
Key Features
useTranslationsutility to replace hardcoded content throughout the siteastro/src/i18n/locales/)Important Notes
Large Diff Size: The PR appears very large (a lot of files under
de/content collection) because German markdown content was added for demo purposes only to showcase the full i18n functionality. These files can be removed to start with a clean folder structure if preferred. The 404 page ensures graceful fallback for missing language content.Translation Review Needed: All UI translations in the locale JSON files were generated with AI assistance and should be reviewed by native speakers for accuracy and cultural appropriateness.
Technical Changes
/{lang}/...)Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.