seo: the translations option is merged but never read, so the panel is hardcoded English
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
Start with packages/payload-plugin-seo/src/translations/en.ts and src/utils/config/mergeTranslations.ts, then trace string rendering in the components and engine areas named in the issue. Run the package tests with bun run test; extend the merge and component tests to cover nested overrides, legacy keys, language fallback, and rendered strings. Done means all listed strings use Payload translations, English remains unchanged, and the acceptance criteria pass.
索引モデルが issue の本文から書いたものです。
説明
What happens
The README documents translations as the way to "Override the English UI strings (merged with defaults)" (README.md#L226-L227), and the plugin merges it into Payload's i18n (plugin.ts#L43-L51). No component reads it back: there is no useTranslation or t() call under src, and 217 user-facing strings in 39 files are literals. Passing translations changes nothing on screen, and an admin switched to another language still shows the SEO button, drawer and field components in English.
It also blocks a common setup. A host that labels the mapped fields in its own words, say "Search title" and "Search description" for meta.title and meta.description, still gets check rows named "SEO title width" and "Meta description length" (labels.ts#L52-L59), so an editor looks for fields that do not exist under those names, and there is no config to rename them.
Expected
Every string the plugin renders comes from Payload's i18n under a seo namespace, the translations option overrides any of them per language, and a language with no overrides shows the English defaults rather than raw keys.
Reproduction
apps/cms installs the plugin on page and posts with meta.title and meta.description mapped (plugins/index.ts#L236-L264) and enables en and es in the admin (payload.config.ts#L87-L89).
- In
apps/cms, fill.envfrom.env.example(DATABASE_URL,PAYLOAD_SECRET) and runbun run dev(port 3333) - Open an existing post and click the gauge button next to the document controls. The drawer reads "SEO Analytics", with tabs "Keyphrase", "On-page SEO" and so on
- Switch your account's admin language to Español. The rest of the admin turns Spanish, the drawer stays English
- Add
translations: { en: { "seo:title": "SEO" } }to theseoAnalysisPluginoptions and restart. The heading still reads "SEO Analytics"
apps/dev also installs the plugin, but its collection entry has no extractContentPath (payload.config.ts#L158-L175), so the plugin skips registration there (plugin.ts#L23-L38). The steps above are read from the config and the source, not clicked through.
Root cause
- Components render literals: the drawer heading and close button (Header.tsx#L21-L27), the button's aria-label and tooltip (SeoButtonInner.tsx#L82-L91), the tab names (TabsNav/constants.ts#L4-L11), every check name and tooltip in
LABELS(labels.ts#L3-L101), whichCheckRowrenders as is (CheckRow/index.tsx#L17-L42), and the status pills (statuses.ts#L3-L7) - The analysis engine builds English sentences outside React and hands them over as strings, for example the recommendation line under each check (recommendations.ts#L10-L64)
- The shipped defaults are flat keys,
"seo:title"as one property (en.ts#L3-L15). Payload'st()splits a key on:and walks nested objects (init.ts#L33) and returns the key itself when nothing matches (init.ts#L68-L72), so event("seo:title")would printseo:title. The comments plugin in this repo uses the nested shape Payload expects (comments en.ts#L3-L4, read witht("comments:label")in Header.tsx#L18) mergeTranslationsmerges one level per language (mergeTranslations.ts#L3-L11), so a nested override would replace the whole namespace, and the defaults are registered underenonly. Payload merges custom translations for the active language only (init.ts#L146-L154), so anesadmin would print raw keys once the components callt()
Fix
src/translations/en.ts: nest the defaults underseo, keep the existing keys (seo:title,seo:tab:keyphraseand the rest) and add one key per string. Data-driven strings key on the id the code already has:seo:check:<checkId>:nameand:tip,seo:status:<good|warn|bad>,seo:recommendation:<checkId>:<status>. Everything else goes under one area per component folder (seo:keyphrase:*,seo:headings:*,seo:field:*and so on). The close button reuses Payload'sgeneral:close. Counts use Payload's_oneand_othersuffixes with{{count}}. Export the shape asSeoTranslationssrc/utils/config/mergeTranslations.ts: for every language ini18n.supportedLanguages(Payload's default isen) plus every language in the option, deep-merge the host's translations with{ seo: en.seo + option[language] }, usingdeepMergeSimplefrompayload/shared. Normalise legacy flat keys such as"seo:title"into the nested shape, so configs written against the README keep working- Option type:
translations?: Record<string, DeepPartial<SeoTranslations>>, keyed by language, values without theseowrapper, the same contract as the comments plugin, plus the legacy flat form - Components:
const { t } = useTranslation()from@payloadcms/ui, every literal replaced.CheckRowkeeps today's fallback for a check id with no key: render the id - Engine: return
{ key, vars }instead of sentences for recommendations, inclusive category names, drill-down nouns, units and captions, and translate where they render. The engine types are not exported from the package (index.ts#L1-L11), so no public type changes
Existing users see no change: every English default is today's literal, word for word. Minor version bump.
Acceptance criteria
- Every string in the brief's inventory (217, linked below) renders through
t(), and the English panel is unchanged word for word -
translations: { en: { check: { titleWidth: { name: "Search title width" } } } }renames that one row, and every other check name keeps its default - The legacy
translations: { en: { "seo:title": "SEO" } }changes the drawer heading to "SEO" - With the admin in
esand no Spanish strings passed, the panel shows the English defaults and no rawseo:key anywhere - With
translations: { es: { title: "Analítica SEO" } }, the heading reads "Analítica SEO" in the Spanish admin and "SEO Analytics" in the English one - Recommendation lines, inclusive category names and drill-down labels follow the admin language the same way
- A host's own translations in other namespaces (the
ssostrings inapps/cms) still resolve
Test plan
- Unit tests in
packages/payload-plugin-seo/tests(vitest,bun run test). Extendtests/utils/mergeTranslations.test.ts: an override of one check name keeps the others, flat keys are normalised, English is seeded into every supported language, a host's other namespace survives. Add a test that runs Payload's owntfrom@payloadcms/translationsagainst the merged object for one key per area, so a wrong shape fails in CI rather than in the browser - Component tests mock
@payloadcms/ui(for exampletests/components/Header.test.tsx). AdduseTranslationto those mocks through one shared helper that resolves keys fromen, so the existing English assertions keep passing unchanged, plus oneHeadertest with an override - Manual in
apps/cms: reproduction steps 2 to 4, then the Spanish admin with and without anesoverride
Seen on 1.10.1, unchanged on main at b645ef0c.
The long-form brief lists every hardcoded string by file and line with its proposed key, and carries the merge sketch and the edge cases.
- 主要言語
- TypeScript
- スター
- 34
- フォーク
- 5
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 41
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
focusreactive/payload-plugins のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
focusreactive/payload-plugins#279 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
focusreactive/payload-plugins#263 ·
メンテナーはふだん 1 日以内に返信
-
comments, seo, analytics, and presets publish ESM that fails to load in Node.js (follow-up to #149)オープン
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
focusreactive/payload-plugins#240 ·
メンテナーはふだん 1 日以内に返信
-
released released on @next
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
focusreactive/payload-plugins#210 · コメント 10 件 ·
メンテナーはふだん 1 日以内に返信
-
[translator] Re-extract the traversal engine into its own package再び着手できるかも @SearheiParkhamchuk が 41 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンchore low priority translator
focusreactive/payload-plugins#203 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
focusreactive/payload-plugins の issue をすべて見る
似ている issue
-
bug Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
scottbenton/Iron-Link#541 ·
メンテナーはふだん 1 日以内に返信
-
hosts settings: the SSH address field and the separate User field are two ways to name one SSH userオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
prime-radiant-inc/evener#8161 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
nicobailon/pi-subagents#3420 ·
メンテナーはふだん 1 日以内に返信
-
Edit content TabList: selected tab's icon/label are hidden by its own selection indicator - a11yオープン01 type: bug 99 tag: UX Accessibility
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 2 日以内に返信