Skip to content

Conversation

@baptistegrimaud
Copy link
Contributor

@baptistegrimaud baptistegrimaud commented Jan 29, 2026

Fixes #317.

Description

Resolves i18n context conflicts when multiple components of different JavaScript modules are rendered on the same page. It ensures a single i18next instance is shared, with proper namespace handling via React context.

Components must use the useTranslation() hook to prevent hydration mismatches and enable seamless client-side translations across modules.

Checklist

Tests

  • I've provided Unit and/or Integration Tests

Tip

Documentation to guide the reviews: How to do a code review

@baptistegrimaud baptistegrimaud force-pushed the fix-i18n-with-multiple-js-modules branch from 2d07cff to de8d0ca Compare January 29, 2026 23:54
@baptistegrimaud baptistegrimaud force-pushed the fix-i18n-with-multiple-js-modules branch from de8d0ca to 264f716 Compare January 29, 2026 23:55
@baptistegrimaud baptistegrimaud marked this pull request as ready for review January 30, 2026 07:33
@baptistegrimaud baptistegrimaud requested a review from a team as a code owner January 30, 2026 07:33
@GauBen
Copy link
Member

GauBen commented Jan 30, 2026

Too bad we're forced to use useTranslation, but at least we don't need to specify the namespace.

We can keep changes in hydrogen, but I'd like the create-module hello world to stay the same (it does not make much sense to have a data-testid in a hello world plus the correct way to run client-only code is by using <Island clientOnly ... />)

@GauBen
Copy link
Member

GauBen commented Jan 30, 2026

All good!

@baptistegrimaud baptistegrimaud enabled auto-merge (squash) January 30, 2026 16:14
@baptistegrimaud baptistegrimaud merged commit 464ebe3 into main Feb 3, 2026
12 checks passed
@baptistegrimaud baptistegrimaud deleted the fix-i18n-with-multiple-js-modules branch February 3, 2026 08:24
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.

Multiple JS modules on the same page will create conflicting i18next instances

3 participants