Skip to content

feat: finalize basic i18n support #133

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

Merged
merged 5 commits into from
Jul 12, 2024
Merged

feat: finalize basic i18n support #133

merged 5 commits into from
Jul 12, 2024

Conversation

Nemikolh
Copy link
Member

This PR completes the initial i18n support added in #127 for the remaining part of the UI where text should be customizable.

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

cloudflare-workers-and-pages bot commented Jul 12, 2024

Deploying tutorialkit-demo-page with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5468bcd
Status: ✅  Deploy successful!
Preview URL: https://5291945c.tutorialkit-demo-page.pages.dev
Branch Preview URL: https://joan-i18n-missing-places.tutorialkit-demo-page.pages.dev

View logs

Copy link

Deploying tutorialkit-docs-page with  Cloudflare Pages  Cloudflare Pages

Latest commit: a47d0ec
Status: ✅  Deploy successful!
Preview URL: https://a5a7917c.tutorialkit-docs-page.pages.dev
Branch Preview URL: https://joan-i18n-missing-places.tutorialkit-docs-page.pages.dev

View logs

Copy link
Member

@AriPerkkio AriPerkkio left a comment

Choose a reason for hiding this comment

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

Looks good to me!

In future we'll need to be careful with the packages/components/react package. Exported public components should not define any texts that need localizing. They should always accept them as props. Maybe we should set up ESLint rule that prevents using/importing i18n in those files.

@Nemikolh
Copy link
Member Author

Exported public components should not define any texts that need localizing. They should always accept them as props.

That's a very good point. Maybe we should write that down in a README.md or CONTRIBUTING.md.

What do you think?

@AriPerkkio
Copy link
Member

That would be great. I've been planning to create good CONTRIBUTING.md once #128 is done.

For ESLint I've used this kind of rule before: https://gist.github.com/AriPerkkio/fab0f24753b0f8457b63da187a4aee9e. That restricts importing from specific directories from files that inside specific directories. E.g. prevent importing from packages/admin in files that are inside packages/user.

@Nemikolh
Copy link
Member Author

Nemikolh commented Jul 12, 2024

Oh interesting! I like a lot the idea of using eslint to enforce this.

From a quick look around, this eslint rule came up: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md

It's not perfect but it would catch a few usecase.

@Nemikolh Nemikolh requested a review from AriPerkkio July 12, 2024 11:24
@Nemikolh Nemikolh merged commit 09d8bf7 into main Jul 12, 2024
9 checks passed
@Nemikolh Nemikolh deleted the joan/i18n-missing-places branch July 12, 2024 13:05
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