cluster-api: implement i18n for all plugin strings#784
Open
ayush-that wants to merge 1 commit into
Open
Conversation
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>
Contributor
There was a problem hiding this comment.
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.jsoncontaining 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
renderoverride for the column), but it isn’t translated. Uset('Unknown')(and similarly translate other user-visible fallbacks ingetValuepaths) 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/_otherforms 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 on lines
+83
to
+86
| export function renderReference( | ||
| ref: KubeReference | undefined, | ||
| t: (key: string) => string | ||
| ): ReactNode { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
verified locally: tsc, lint, build, and test all pass.
Closes #780