Skip to content

Fix broken Central Kurdish text in agentic UI on macOS#4088

Open
wojtekn wants to merge 1 commit into
trunkfrom
fix-kurdish-font-agentic-ui
Open

Fix broken Central Kurdish text in agentic UI on macOS#4088
wojtekn wants to merge 1 commit into
trunkfrom
fix-kurdish-font-agentic-ui

Conversation

@wojtekn

@wojtekn wojtekn commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Related issues

Companion to #4062, which fixed the same font problem in the default (legacy) renderer. This applies the equivalent fix to the agentic UI (apps/ui), which is a separate renderer and did not inherit it. Agentic UI is currently behind the enableAgenticUi flag, so this is not user-facing yet — it's landing the fix before that renderer ships more broadly.

How AI was used in this PR

Used Claude Code to confirm apps/ui is a distinct renderer that missed the original fix, trace how locale reaches it, select the token-based approach that fits the design-system theming, and verify behavior. I reviewed the diff, the specificity reasoning, and the font license myself. AI-verified: TypeScript passes; Vite emits + references the hashed woff2; and running the real @wordpress/i18n against the shipped ckb translations resolves lang="ckb" and dir="rtl". It could not verify actual glyph rendering / dark mode — that needs a human on macOS (see below).

Proposed Changes

The agentic UI is a separate renderer from the one fixed in #4062. It hardcoded <html lang="en"> and only loaded translation data — it never reflected the active locale on the document. Two consequences on macOS in Central Kurdish:

  • Kurdish text broke, because the system font (San Francisco) lacks glyphs for letters like ێ ۆ ڵ.
  • Right-to-left locales rendered left-to-right, since dir was never set.

This bundles the same OFL-licensed Vazirmatn font (applied only for the ckb locale, so other languages are visually unchanged) and, on bootstrap, sets the document's lang and dir from the resolved locale. The per-entry translation loader that was duplicated across the three entry points is consolidated into one shared helper, so all of them (Electron, hosted, local studio ui) behave consistently.

For Kurdish users, agentic UI text now renders legibly and in the correct direction; the font flows through the design system's typography tokens plus the @wordpress/components controls that set their own font.

CleanShot 2026-07-06 at 15 49 19@2x

Testing Instructions

  1. On macOS, launch Studio with the agentic UI enabled (enableAgenticUi feature flag).
  2. Set the language to کوردیی ناوەندی.
  3. Confirm Kurdish text renders correctly (letters ێ ۆ ڵ don't break words) across the UI — including inputs, tooltips and dropdowns — and that layout is right-to-left.
  4. Switch to a non-Kurdish language and confirm appearance and direction are unchanged.
  5. Check both light and dark appearance.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

The agentic UI (apps/ui) is a separate renderer that never reflected the
active locale on the document element — it hardcoded lang="en" and only
loaded i18n data. As a result Kurdish text broke on macOS (the system
font lacks glyphs like ێ ۆ ڵ) and RTL locales rendered left-to-right.

Bundle the OFL-licensed Vazirmatn font (applied only for ckb) and set
document lang/dir from the resolved locale on bootstrap via a shared
applyLocale helper, replacing the duplicated per-entry translation loader.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wojtekn wojtekn requested review from a team and shaunandrews July 6, 2026 13:51
@wojtekn

wojtekn commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@shaunandrews, in this PR, I'm also fixing LTR language support. We may need to fix more, for example, should the browser window be on the far left instead of the middle in LTR mode?

@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 11058f6 vs trunk

app-size

Metric trunk 11058f6 Diff Change
App Size (Mac) 1345.25 MB 1345.35 MB +0.11 MB ⚪ 0.0%

site-editor

Metric trunk 11058f6 Diff Change
load 734 ms 1108 ms +374 ms 🔴 51.0%

site-startup

Metric trunk 11058f6 Diff Change
siteCreation 6519 ms 6543 ms +24 ms ⚪ 0.0%
siteStartup 2390 ms 2390 ms 0 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@katinthehatsite

Copy link
Copy Markdown
Contributor

The changes look good in the agentic UI and nothing seems to be broken:

Screenshot 2026-07-07 at 10 08 13 AM

I am finding the explanations in the How AI was used and Proposed changes slightly long and redundant as it could easily be simplified into a two-sentence gist. Perhaps it is a personal preference but I think they could definitely omit some details.

Comment thread apps/ui/src/index.css
scrollbar-color: gray transparent;
}

/* Central Kurdish: prepend the bundled Vazirmatn so Kurdish letters render

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not sure the 8-line explanation comment is needed here, it can either be simplified to be more straight to the point or can go completely

Comment thread apps/ui/src/index.css
@@ -1,3 +1,15 @@
/* Bundled font for Central Kurdish (ckb). macOS's system font (San Francisco)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be shortened?

@katinthehatsite katinthehatsite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I approved the changes because they work as expected. Left a couple of comments regarding simplifying the explanations as they seem quite verbose and not completely necessary, in my opinion

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