Skip to content

cluster-api: implement i18n for all plugin strings#784

Open
ayush-that wants to merge 1 commit into
headlamp-k8s:mainfrom
ayush-that:cluster-api-i18n
Open

cluster-api: implement i18n for all plugin strings#784
ayush-that wants to merge 1 commit into
headlamp-k8s:mainfrom
ayush-that:cluster-api-i18n

Conversation

@ayush-that

@ayush-that ayush-that commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

adds internationalization to the cluster-api plugin, following the same react-i18next pattern already merged for the keda (#768) and karpenter (#769) plugins.

what changed:

  • registered the headlamp i18n config in package.json and generated the english translation catalog (locales/en/translation.json)
  • wrapped user-facing strings in t() across all list, detail, and glance views, the overview dashboard and per-cluster error overview, shared resource/replica/health sections, and the resource actions (scale, pause/resume, get kubeconfig)
  • used named interpolation for dynamic strings and counts

verified locally: tsc, lint, build, and test all pass.

Closes #780

wraps user-facing strings across the cluster-api plugin in the
react-i18next t() helper and registers the headlamp i18n config,
following the same pattern as the merged keda and karpenter plugins.
this lets the plugin be localized by the community.

scope: list/detail/glance views, the overview dashboard and error
overview, shared resource sections, resource actions (scale, pause,
kubeconfig), and status/health labels.

Signed-off-by: ayush-that <ayush1337@hotmail.com>
Copilot AI review requested due to automatic review settings June 2, 2026 19:00

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR introduces i18n support to the Cluster API Headlamp plugin by replacing hard-coded UI strings with useTranslation() calls and adding an English translation catalog.

Changes:

  • Wrapped user-facing labels/messages across lists, detail pages, glances, loaders, and actions with t(...).
  • Added locales/en/translation.json containing the English translation keys used by the plugin.
  • Enabled Headlamp i18n configuration in package.json.

Reviewed changes

Copilot reviewed 46 out of 46 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cluster-api/src/index.tsx Localizes Cluster API detection loader text.
cluster-api/src/components/overview/Overview.tsx Localizes overview tables, charts, filters, and events UI strings.
cluster-api/src/components/overview/ClusterDetailsErrorOverview.tsx Localizes cluster health/issue UI, tooltips, and remediation panel strings.
cluster-api/src/components/machinesets/List.tsx Localizes MachineSets list title/columns and loader text.
cluster-api/src/components/machinesets/Glance.tsx Localizes MachineSet glance badges.
cluster-api/src/components/machinesets/Detail.tsx Localizes MachineSet detail headers, loaders, and error messages.
cluster-api/src/components/machines/List.tsx Localizes Machines list title/columns and loader text.
cluster-api/src/components/machines/Glance.tsx Localizes Machine glance badges/status text.
cluster-api/src/components/machines/Detail.tsx Localizes Machine detail labels, tables, loaders, and error messages.
cluster-api/src/components/machines/Actions.tsx Localizes machine action button descriptions and snackbar messages.
cluster-api/src/components/machinepools/List.tsx Localizes MachinePools list UI and loader text.
cluster-api/src/components/machinepools/Glance.tsx Localizes MachinePool glance badges/status text.
cluster-api/src/components/machinepools/Detail.tsx Localizes MachinePool detail labels, loaders, and error messages.
cluster-api/src/components/machinehealthchecks/List.tsx Localizes MachineHealthChecks list UI and loader text.
cluster-api/src/components/machinehealthchecks/Glance.tsx Localizes MachineHealthCheck glance badges/status text.
cluster-api/src/components/machinehealthchecks/Detail.tsx Localizes MachineHealthCheck detail labels and section titles.
cluster-api/src/components/machinedrainrules/List.tsx Localizes MachineDrainRules list UI and loader text.
cluster-api/src/components/machinedrainrules/Glance.tsx Localizes MachineDrainRule glance badges.
cluster-api/src/components/machinedrainrules/Detail.tsx Localizes MachineDrainRule detail loader text.
cluster-api/src/components/machinedeployments/List.tsx Localizes MachineDeployments list UI and loader text.
cluster-api/src/components/machinedeployments/Glance.tsx Localizes MachineDeployment glance badges/status text.
cluster-api/src/components/machinedeployments/Detail.tsx Localizes MachineDeployment detail labels, loaders, and error messages.
cluster-api/src/components/kubeadmcontrolplanetemplates/List.tsx Localizes KCP template list title and loader text.
cluster-api/src/components/kubeadmcontrolplanetemplates/Detail.tsx Localizes KCP template detail labels, loaders, and error messages.
cluster-api/src/components/kubeadmcontrolplanes/List.tsx Localizes KCP list UI and loader text.
cluster-api/src/components/kubeadmcontrolplanes/Glance.tsx Localizes KCP glance badges/status text.
cluster-api/src/components/kubeadmcontrolplanes/Detail.tsx Localizes KCP detail labels, loaders, and error messages.
cluster-api/src/components/kubeadmconfigtemplates/List.tsx Localizes KubeadmConfigTemplate list UI and loader text.
cluster-api/src/components/kubeadmconfigtemplates/Glance.tsx Localizes KubeadmConfigTemplate glance condition labels.
cluster-api/src/components/kubeadmconfigtemplates/Detail.tsx Localizes KubeadmConfigTemplate detail labels, loaders, and error messages.
cluster-api/src/components/kubeadmconfigs/List.tsx Localizes KubeadmConfig list UI and loader text.
cluster-api/src/components/kubeadmconfigs/Glance.tsx Localizes KubeadmConfig glance condition labels.
cluster-api/src/components/kubeadmconfigs/Detail.tsx Localizes KubeadmConfig detail labels, section titles, loaders, and errors.
cluster-api/src/components/common/util.tsx Localizes topology tooltip UI; updates renderReference to accept t.
cluster-api/src/components/common/Resource.tsx Localizes shared resource sections and template/kubeadm config rendering.
cluster-api/src/components/common/ReplicaHelpers.tsx Updates replica display helper to accept t and localize labels.
cluster-api/src/components/clusters/List.tsx Localizes Clusters list UI and loader text.
cluster-api/src/components/clusters/Glance.tsx Localizes Cluster glance badges/status text.
cluster-api/src/components/clusters/Detail.tsx Localizes Cluster detail labels, loaders, and error messages.
cluster-api/src/components/clusterclasses/List.tsx Localizes ClusterClasses list UI and loader text.
cluster-api/src/components/clusterclasses/Glance.tsx Localizes ClusterClass glance badges.
cluster-api/src/components/clusterclasses/Detail.tsx Localizes ClusterClass detail labels, loaders, and section headers.
cluster-api/src/components/actions/index.tsx Localizes cluster connect/scale and reconciliation action UI/snackbars.
cluster-api/src/components/Dashboard.tsx Localizes dashboard “CAPI not detected” content and CTA button.
cluster-api/package.json Adds Headlamp i18n configuration (en).
cluster-api/locales/en/translation.json Adds English translation catalog for all introduced keys.
Comments suppressed due to low confidence (2)

cluster-api/src/components/machinesets/List.tsx:1

  • "Unknown" is user-visible here (no render override for the column), but it isn’t translated. Use t('Unknown') (and similarly translate other user-visible fallbacks in getValue paths) to keep the i18n coverage consistent.
    cluster-api/src/components/overview/ClusterDetailsErrorOverview.tsx:1
  • This uses manual singular/plural branching and forces multiple translation keys. Prefer i18next pluralization by using a single base key with count (e.g., t('{{count}} deployment', { count })) and defining _one/_other forms in the locale file; this reduces duplication and makes adding other locales simpler.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cluster-api/src/components/Dashboard.tsx
Comment on lines +83 to +86
export function renderReference(
ref: KubeReference | undefined,
t: (key: string) => string
): ReactNode {
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.

cluster-api: do i18n

2 participants