Skip to content

MSD: Load locale data for the interim omnibar#109882

Closed
StevenDufresne wants to merge 2 commits intorefactor/interim-omnibar-hooks-data-flowfrom
fix/interim-omnibar-locale
Closed

MSD: Load locale data for the interim omnibar#109882
StevenDufresne wants to merge 2 commits intorefactor/interim-omnibar-hooks-data-flowfrom
fix/interim-omnibar-locale

Conversation

@StevenDufresne
Copy link
Copy Markdown
Contributor

Part of DOTMSD-1199
Stacked on #109881

Proposed Changes

Why are these changes being made?

The interim omnibar hydrates independently from the main dashboard Layout (which provides the I18nProvider), so without this it always renders in English — regardless of the user's language setting.

Testing Instructions

  1. Set your account language to a non-English locale (e.g. French, Arabic).
  2. Enable the dashboard/omnibar feature flag and hard-reload a Dashboard page.
  3. Confirm the omnibar text is translated (e.g. "My Sites", "Write", notifications tooltip).
  4. For RTL languages, confirm the layout flips.
  5. Switch back to English and confirm no regression.

Note: expect a brief English frame before the locale JSON resolves — the refactor uses incremental React renders rather than blocking on all data before a single render.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you tested accessibility for your changes? Ensure the feature remains usable with various user agents (e.g., browsers), interfaces (e.g., keyboard navigation), and assistive technologies (e.g., screen readers) (PCYsg-S3g-p2).
  • Have you used memoizing on expensive computations?
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

The interim omnibar hydrates independently from the main dashboard
`Layout`, which provides the `I18nProvider`, so it was always rendering
in English. Fetch and apply the user's locale data via a dedicated
query so the Masterbar re-renders with translated strings after the
locale JSON arrives.

Ports the change from #109762 onto the hooks-based data flow.

Fixes: DOTMSD-1199

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@matticbot
Copy link
Copy Markdown
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • help-center
  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug fix/interim-omnibar-locale on your sandbox.

Replace the `useQuery`-for-side-effect pattern with a plain `useEffect`
that fetches the locale JSON and applies it to `defaultI18n`. The hook
now also gates the "full" omnibar render on locale readiness so
bootstrapped non-English users see the SSR-matching placeholder until
their translations are applied — no flash of English content with
real user/site data.

For English bootstrapped users, `localeVersion` starts at 1 so the
gate opens as soon as hydration commits (no extra frame).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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