Fix broken Central Kurdish text in agentic UI on macOS#4088
Conversation
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>
|
@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? |
📊 Performance Test ResultsComparing 11058f6 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
| scrollbar-color: gray transparent; | ||
| } | ||
|
|
||
| /* Central Kurdish: prepend the bundled Vazirmatn so Kurdish letters render |
There was a problem hiding this comment.
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
| @@ -1,3 +1,15 @@ | |||
| /* Bundled font for Central Kurdish (ckb). macOS's system font (San Francisco) | |||
There was a problem hiding this comment.
Can this be shortened?
katinthehatsite
left a comment
There was a problem hiding this comment.
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

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 theenableAgenticUiflag, 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/i18nagainst the shippedckbtranslations resolveslang="ckb"anddir="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:dirwas never set.This bundles the same OFL-licensed Vazirmatn font (applied only for the
ckblocale, so other languages are visually unchanged) and, on bootstrap, sets the document'slanganddirfrom 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, localstudio 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/componentscontrols that set their own font.Testing Instructions
enableAgenticUifeature flag).Pre-merge Checklist