Skip to content

feat(i18n): Translate Dashboard UI into Simplified Chinese#249

Open
pggdev wants to merge 7 commits into
volcano-sh:mainfrom
pggdev:add-dashboard-translations
Open

feat(i18n): Translate Dashboard UI into Simplified Chinese#249
pggdev wants to merge 7 commits into
volcano-sh:mainfrom
pggdev:add-dashboard-translations

Conversation

@pggdev

@pggdev pggdev commented May 15, 2026

Copy link
Copy Markdown

Part of #243

Summary

Add i18next-based internationalization support for the Dashboard section and include English and Simplified Chinese translation resources.

Changes

  • Added i18next setup with React integration
  • Added browser language detection with localStorage persistence
  • Added English and Simplified Chinese Dashboard translation keys
  • Replaced Dashboard hardcoded text with i18n keys
  • Translated Dashboard stats and errors
  • Translated Job Status pie chart title, labels, and empty state
  • Translated Queue Resources bar chart title, dropdown labels, axis labels, legend labels, and empty state

Scope

This PR only covers the Dashboard translations.

Manual verification can be done by setting i18nextLng in localStorage to en or zh-CN. A language switcher will be added in a follow-up PR to make this easier from the UI.

ScreenShots

image image

Verification

  • npm run lint -w frontend
  • npm run test -w frontend -- --run
  • npm run build -w frontend

pggdev added 7 commits May 13, 2026 00:50
Signed-off-by: pggdev <princegupta.ns153@gmail.com>
Signed-off-by: pggdev <princegupta.ns153@gmail.com>
Signed-off-by: pggdev <princegupta.ns153@gmail.com>
Signed-off-by: pggdev <princegupta.ns153@gmail.com>
Signed-off-by: pggdev <princegupta.ns153@gmail.com>
Signed-off-by: pggdev <princegupta.ns153@gmail.com>
Signed-off-by: pggdev <princegupta.ns153@gmail.com>
@volcano-sh-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign william-wang for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@volcano-sh-bot

Copy link
Copy Markdown
Contributor

Welcome @pggdev! It looks like this is your first PR to volcano-sh/dashboard 🎉

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

Code Review

This pull request implements internationalization (i18n) for the Volcano Dashboard using react-i18next, introducing support for English and Chinese. Multiple components, including JobStatusPieChart, QueueResourcesBarChart, and the main Dashboard, were refactored to replace hardcoded strings with translation keys, and Dashboard.jsx was updated to wrap data fetching in useCallback. Feedback identifies an improvement opportunity in QueueResourcesBarChart.jsx to simplify the getResourceLabel function by utilizing the existing resourceTranslationKeys mapping instead of a redundant switch statement.

Comment on lines +108 to +121
const getResourceLabel = (resource) => {
switch (resource) {
case "memory":
return t("dashboard.charts.queueResources.resourceNames.memory");
case "cpu":
return t("dashboard.charts.queueResources.resourceNames.cpu");
case "pods":
return t("dashboard.charts.queueResources.resourceNames.pods");
case "nvidia.com/gpu":
return t("dashboard.charts.queueResources.resourceNames.gpu");
default:
return resource.toUpperCase();
}
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The getResourceLabel function uses a switch statement that duplicates logic already present in the resourceTranslationKeys mapping. To improve maintainability and ensure consistency, you should use the mapping object instead of a switch statement.

    const getResourceLabel = (resource) => {
        const key = resourceTranslationKeys[resource];
        return key 
            ? t(`dashboard.charts.queueResources.resourceNames.${key}`) 
            : resource.toUpperCase();
    };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants