Skip to content

Commit 0bfc361

Browse files
committed
docs(admin): describe the guarded label lookup, not the old one
The JSDoc on resolvePluginPageLabel and the inline comment in AdminCommandPalette both still said every declared label goes through the shared Lingui instance. Since declaredLabelTranslator that is only true when the catalog has an entry for the label.
1 parent b011873 commit 0bfc361

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

packages/admin/src/components/AdminCommandPalette.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ export function buildNavItems(
252252
if (config.enabled === false) continue;
253253
if (config.adminPages && config.adminPages.length > 0) {
254254
for (const page of config.adminPages) {
255-
// Same treatment as the sidebar: declared labels go through the
256-
// shared i18n instance so plugin catalogs can localize them.
255+
// Plugin page labels are translated only when the catalog has
256+
// an entry for them; otherwise they render as declared.
257257
const label = resolvePluginPageLabel(page.label, pluginId, translateLabel);
258258

259259
items.push({

packages/admin/src/components/Sidebar.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,12 @@ export function NavIcon({
321321

322322
/**
323323
* Resolve the display label for a plugin admin page (sidebar + command
324-
* palette). Declared labels are run through the shared Lingui instance:
325-
* plugins that load their own catalog — with the English label as msgid —
326-
* get localized nav items. The catalog is shared with the admin, so common
327-
* labels like "Settings" pick up the admin's own translations even without
328-
* a plugin catalog (deliberate: a localized admin shouldn't show stray
329-
* English nav items). Labels with no catalog entry anywhere fall back to
330-
* the literal string. Pages without a label prettify the plugin id
331-
* ("my-shop" → "My Shop").
324+
* palette). Declared labels are translated only when the active catalog has
325+
* an entry for them; otherwise they are returned as declared. Plugins that
326+
* load their own catalog — with the English label as msgid — get localized
327+
* nav items, and common labels like "Settings" pick up the admin's own
328+
* translations even without a plugin catalog. Pages without a label prettify
329+
* the plugin id ("my-shop" → "My Shop").
332330
*/
333331
export function resolvePluginPageLabel(
334332
label: string | undefined,

0 commit comments

Comments
 (0)