Skip to content
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

refactor(core): localization #1316

Merged
merged 30 commits into from
Aug 30, 2024
Merged

refactor(core): localization #1316

merged 30 commits into from
Aug 30, 2024

Conversation

jorgemoya
Copy link
Contributor

@jorgemoya jorgemoya commented Aug 29, 2024

Note: Review by commit if needed & remove white spaces.

What/Why?

The PR addresses missing translations on some pages and aims to normalize how translations are handled throughout the project.

Configuration Changes

  • Updated next-intl version and adjusted the configuration accordingly.
  • Renamed navigation.ts to routing.ts for consistency with documentation.
  • Introduced the defineRouting function.
  • Simplified the translation setup by using a single NextIntlClientProvider in RootLayout to pass all messages, making the use of next-intl hooks in client components easier.
  • Standardized the use of translation hooks by:
    • Using useTranslations in both client and server components without async functions.
    • Using await getTranslations in server components with async functions.
    • Same case for formatter.
  • Removed the need to pass the locale to these hooks (not needed).

Translations

  • Added translations for all strings, except those in components/ui.
  • Shuffle translations to have pages as parent groups.
  • Renamed some translations keys for clarity.
  • Add Components root group for better organization.

Docs

  • Updated docs to match new use cases.

Testing

Locally translations work.

@jorgemoya jorgemoya requested a review from a team as a code owner August 29, 2024 18:56
Copy link

vercel bot commented Aug 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
catalyst 🔄 Building (Inspect) Visit Preview 💬 Add feedback Aug 30, 2024 4:06pm
catalyst-latest ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 30, 2024 4:06pm
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
catalyst-1millionproducts-store ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2024 4:06pm
catalyst-au ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2024 4:06pm
catalyst-staging ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2024 4:06pm
catalyst-test-store ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2024 4:06pm
catalyst-uk ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2024 4:06pm
catalyst-unstable ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2024 4:06pm

Copy link

changeset-bot bot commented Aug 29, 2024

🦋 Changeset detected

Latest commit: dd0eeb7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jorgemoya
Copy link
Contributor Author

@bc-andreadao For this PR I updated the docs to better showcase the simplified use of translations. Please let me know if you have any feedback. Thanks!

core/app/[locale]/not-found.tsx Outdated Show resolved Hide resolved
core/app/[locale]/store-selector/page.tsx Outdated Show resolved Hide resolved
docs/localization.md Outdated Show resolved Hide resolved
@chanceaclark
Copy link
Contributor

ℹ️ Hide whitespace changes helps with review

@bc-andreadao
Copy link
Collaborator

Thanks @jorgemoya !

@jorgemoya jorgemoya added this pull request to the merge queue Aug 30, 2024
Merged via the queue into main with commit 4aea109 Aug 30, 2024
13 of 14 checks passed
@jorgemoya jorgemoya deleted the refactor-localization branch August 30, 2024 16:32
@github-actions github-actions bot mentioned this pull request Aug 30, 2024
Copy link
Contributor

⚡️🏠 Lighthouse report

Lighthouse ran against https://catalyst-latest-91c645lrj-bigcommerce-platform.vercel.app

🖥️ Desktop

We ran Lighthouse against the changes on a desktop and produced this report. Here's the summary:

Category Score
🟢 Performance 99
🟢 Accessibility 100
🟢 Best practices 96
🟠 SEO 82

📱 Mobile

We ran Lighthouse against the changes on a mobile and produced this report. Here's the summary:

Category Score
🟢 Performance 93
🟢 Accessibility 100
🟢 Best practices 96
🟠 SEO 85

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.

3 participants