Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Wire up i18n for the React frontend #1962

Merged
merged 20 commits into from
Oct 19, 2023
Merged

Wire up i18n for the React frontend #1962

merged 20 commits into from
Oct 19, 2023

Conversation

t3chguy
Copy link
Member

@t3chguy t3chguy commented Oct 17, 2023

No description provided.

@t3chguy t3chguy added the T-Enhancement New feature of request label Oct 17, 2023
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 17, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: f5b096f
Status: ✅  Deploy successful!
Preview URL: https://284d9b24.matrix-authentication-service-docs.pages.dev
Branch Preview URL: https://t3chguy-i18n.matrix-authentication-service-docs.pages.dev

View logs

@sandhose sandhose added A-Frontend Changes on the React frontend A-I18n Area: Internationalization labels Oct 17, 2023
@t3chguy t3chguy marked this pull request as ready for review October 17, 2023 14:34
This has multiple advantages:

 - the JSON files get hashes
 - we can preload assets
 - it loads the assets correctly if the app is mounted somewhere else
 - we have an explicit list of supported languages created a build time
It turns out that wasn't really needed, the import glob was enough
Copy link
Member

@sandhose sandhose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TYVM! Pretty happy with this setup :)

I did a few small changes, mainly:

  • include the i18next-parser config in the lint/tsc pipeline, so that it gets formatted and typechecked
  • load the translations through the vite assets pipeline, not just the public folder, so that they get unique hashes for better caching

One follow up I would like to do is to integrate a language picker in Storybook (which is broken right now but I'll fix in another PR)

@sandhose sandhose enabled auto-merge (squash) October 19, 2023 12:39
@sandhose sandhose merged commit 4364805 into main Oct 19, 2023
16 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Frontend Changes on the React frontend A-I18n Area: Internationalization T-Enhancement New feature of request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants