i18n(zh-CN): translate Volcano dashboard UI section into Chinese#254
i18n(zh-CN): translate Volcano dashboard UI section into Chinese#254aryunewaskar77-art wants to merge 3 commits into
Conversation
Signed-off-by: aryunewaskar77-art <aaryaanewaskar@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @aryunewaskar77-art! It looks like this is your first PR to volcano-sh/dashboard 🎉 |
There was a problem hiding this comment.
Code Review
This pull request implements internationalization (i18n) across the Volcano Dashboard using i18next and react-i18next, introducing support for English and Chinese. Hardcoded strings in components, charts, and dialogs have been replaced with translation keys, and a language toggle has been added to the main layout. Review feedback identifies inconsistent error handling in Pods.jsx, missing translation keys for queue YAML titles and general YAML labels, and a fragile language detection check. Additionally, there are notes regarding a missing placeholder in the pod_details_title translation key and a suggestion to localize resource names in the QueueTableHeader instead of using simple capitalization.
| @@ -185,7 +187,7 @@ const Pods = () => { | |||
| <Typography variant="body1">{error}</Typography> | |||
There was a problem hiding this comment.
Inconsistent error handling: In this component, error is set as a string (lines 56, 156), but the rendering logic in other components (like Jobs.jsx or Queues.jsx) expects an object with key and message properties. If error becomes an object here, this line will render [object Object]. Consider using the ErrorDisplay component for consistency.
{error && (
<Box sx={{ mt: 2, color: theme.palette.error.main }}>
<Typography variant="body1">
{error.key ? `${t(error.key)}${error.message}` : error}
</Typography>
</Box>
)}| "state": "State", | ||
| "guarantee_resources_optional": "Guarantee Resources (Optional)", | ||
| "capability_resources_optional": "Capability Resources (Optional)", | ||
| "deserved_resources_optional": "Deserved Resources (Optional)" |
There was a problem hiding this comment.
The key queue_yaml_title is missing from the English translation file, but it is being used in frontend/src/components/queues/QueueYamlDialog.jsx. This will cause the raw key to be displayed in the UI.
| "deserved_resources_optional": "Deserved Resources (Optional)" | |
| "deserved_resources_optional": "Deserved Resources (Optional)", | |
| "queue_yaml_title": "Queue YAML - {{selectedQueueName}}", | |
| "yaml": "YAML" | |
| } |
| "state": "状态", | ||
| "guarantee_resources_optional": "保证资源(可选)", | ||
| "capability_resources_optional": "能力资源(可选)", | ||
| "deserved_resources_optional": "应得资源(可选)" |
There was a problem hiding this comment.
The keys queue_yaml_title and yaml are missing from the Chinese translation file. Please add them to ensure the UI is fully localized.
| "deserved_resources_optional": "应得资源(可选)" | |
| "deserved_resources_optional": "应得资源(可选)", | |
| "queue_yaml_title": "队列 YAML - {{selectedQueueName}}", | |
| "yaml": "YAML" | |
| } |
| } | ||
| sx={{ color: "white" }} | ||
| > | ||
| {i18n.language === "en" ? "中文" : "EN"} |
There was a problem hiding this comment.
Checking i18n.language === "en" is fragile because the language detector might return regional variants like en-US. It is safer to check if the language starts with en or use i18n.resolvedLanguage.
| {i18n.language === "en" ? "中文" : "EN"} | |
| {i18n.language.startsWith("en") ? "中文" : "EN"} |
| @@ -26,7 +28,7 @@ const PodDetailsDialog = ({ open, podName, podYaml, onClose }) => { | |||
| }, | |||
| }} | |||
| > | |||
| sx={{ letterSpacing: "0.02em" }} | ||
| > | ||
| {`Allocated ${field}`} | ||
| {`${field.toUpperCase()}${t("allocated_suffix")}`} |
There was a problem hiding this comment.
Resource names (like cpu, memory, nvidia.com/gpu) should be localized using t() instead of just calling toUpperCase(). This ensures consistency with other parts of the UI like QueueResourcesBarChart.jsx.
| {`${field.toUpperCase()}${t("allocated_suffix")}`} | |
| {`${t(field.toLowerCase())}${t("allocated_suffix")}`} |
…Dashboard - Initialize react-i18next and configure EN/ZH translation infrastructure - Localize Dashboard, Jobs, Pods, Queues, and PodGroups views - Add persistent language switcher with robust language detection - Implement interpolation-based dynamic resource count translations - Refactor error handling for reactive language updates - Standardize Kubernetes terminology and dynamic labels - Localize resource creation dialogs and dynamic placeholders - Clean up duplicate keys and improve translation consistency Signed-off-by: aryunewaskar77-art <aaryaanewaskar@gmail.com>
|
Adding label DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Summary
This PR adds Chinese (Simplified) localization support for Volcano Dashboard using
react-i18next, enabling seamless switching between English and Chinese across the UI.Changes
Localization framework
react-i18nextintegration with a dedicatedi18n.jsconfiguration.Language support
en) remains the default language.zh) support.Translation improvements
Standardized Kubernetes terminology:
Preserved Kubernetes ecosystem terminology where appropriate for better usability.
Dynamic UI localization
Implemented localization support for:
Examples:
English:
Total Pods: 10Chinese:
Pods 总数:10Error messages now update instantly when switching languages without requiring a page refresh.
Additional improvements
Screenshots
Before
After
Testing
Verified: