Skip to content

feat: add localized plugin metadata and resource menus#4082

Open
seakee wants to merge 4 commits into
router-for-me:devfrom
seakee:feat/plugin-locales
Open

feat: add localized plugin metadata and resource menus#4082
seakee wants to merge 4 commits into
router-for-me:devfrom
seakee:feat/plugin-locales

Conversation

@seakee

@seakee seakee commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

This adds localization support for plugin-facing metadata across the plugin store, SDK schemas, and management/resource menu surfaces.

Background

Plugin display data currently has a single language path for names, authors, descriptions, config field descriptions, and resource menu labels. This makes plugin store listings and management UI menus hard to localize without custom frontend-side mapping.

Changes

  • Add optional locale maps to plugin SDK types:
    • plugin metadata display fields
    • config field descriptions
    • management/resource route menu text
  • Add plugin store locale metadata parsing and normalization.
  • Preserve localized plugin metadata in generated install manifests.
  • Add preferred locale resolution from:
    • locale query parameter
    • X-Locale header
    • Accept-Language
  • Forward the resolved locale to plugin management/resource handlers through X-Locale.
  • Localize plugin store list entries, installed plugin metadata, config fields, and resource menu labels.
  • Fix resource menu launch URLs so default query parameters remain navigable while route dispatch still matches path-only resource handlers.
  • Harden locale handling:
    • clone and normalize locale maps before exposing host snapshots
    • avoid shared locale map mutation from plugin-owned route definitions
    • keep plugin management request headers writable even when the original request has no headers

Compatibility

All locale fields are optional and preserve existing behavior when omitted. Existing plugin metadata and resource routes continue to work without changes.

Resource route dispatch remains path-based. Resource menu paths may include query parameters for launch URLs, but handler dispatch uses the path portion and forwards query values in the request object.

Testing

  • go test ./internal/pluginhost ./internal/plugini18n ./internal/pluginstore ./internal/api/handlers/management ./sdk/pluginapi
  • go test ./...
  • go build -o /private/tmp/cpa-cli-proxy-api-test-output ./cmd/server

seakee added 3 commits July 2, 2026 11:44
Add optional locale maps for plugin metadata, config field descriptions, and management resource menu labels.

These SDK fields let plugins expose translated display data without changing existing callers when locales are omitted.
Parse, trim, normalize, and deduplicate localized plugin store metadata.

Preserve locales in generated install manifests and expose the SDK alias so embedders can consume localized registry entries.
Resolve preferred locales from query, X-Locale, and Accept-Language, then forward them to plugin management and resource handlers.

Localize plugin store and installed plugin display fields while keeping resource launch URLs navigable with default query parameters.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces comprehensive localization (i18n) support for plugins, updating the plugin store, manifests, registries, and metadata to handle localized display fields. It adds a new plugini18n package to manage locale normalization, preferred locale resolution from request headers/queries, and fallback lookups. The feedback recommends improving the localeCandidates function to progressively strip subtags from right to left, ensuring full support for standard BCP 47 progressive fallback (e.g., falling back from zh-Hant-HK to zh-Hant and then zh).

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread internal/plugini18n/locale.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 409e0531ea

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/plugini18n/locale.go Outdated
Resolve locale matches by progressively stripping subtags from right to left.

This lets requests such as zh-Hant-HK match an available zh-Hant translation before falling back to zh.
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.

1 participant