Skip to content

feat: implement internationalization support with next-intl#270

Open
shiverse94 wants to merge 2 commits into
volcano-sh:mainfrom
shiverse94:shive-new-chinese-trans
Open

feat: implement internationalization support with next-intl#270
shiverse94 wants to merge 2 commits into
volcano-sh:mainfrom
shiverse94:shive-new-chinese-trans

Conversation

@shiverse94

@shiverse94 shiverse94 commented May 19, 2026

Copy link
Copy Markdown

feat: implement internationalization support with next-intl

  • Added support for English and Simplified Chinese locales.
  • Introduced message files for various components and pages.
  • Implemented locale-prefixed routing and validation script for message key parity.
  • Updated navigation and layout components to utilize internationalization features.
image

I created this branch from Deep’s PR for the new dashboard. Once his PR is merged, this branch can also be merged since it was created from his branch. Looking forward to contributing to and collaborating on the dashboard project.
@JesseStutler @de6p

Changes -> 217b0fc

- Added support for English and Simplified Chinese locales.
- Introduced message files for various components and pages.
- Implemented locale-prefixed routing and validation script for message key parity.
- Updated navigation and layout components to utilize internationalization features.

Signed-off-by: Shive <shiverse94@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 @shiverse94! 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 transitions the Volcano dashboard to a Next.js monorepo using TurboRepo, Shadcn UI, and tRPC, while introducing internationalization support for English and Simplified Chinese. The new architecture covers management pages for Jobs, Queues, Pods, and PodGroups. Review feedback primarily highlighted several instances of hardcoded user-facing strings in pagination components, form labels, tooltips, and chart legends that need to be integrated into the i18n system. Furthermore, the reviewer advised replacing brittle setTimeout patterns with tRPC query invalidation to ensure reliable UI updates following data mutations.

onClick={() => onPageChange(page + 1)}
disabled={disabled || page >= safeTotalPages || total === 0}
>
Next

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The 'Next' button label is hardcoded. It should be localized using the common.actions.next key.

disabled={disabled}
/>
<Label htmlFor="reclaimable" className="text-sm font-normal cursor-pointer">
Reclaimable

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Hardcoded label 'Reclaimable' should be replaced with a translation key.

Comment on lines +312 to +314
<Label htmlFor="queue-name">
Queue Name {!nameReadOnly && <span className="text-destructive">*</span>}
</Label>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Form labels should be localized. Use the useTranslations hook to fetch the label from the message files.

return (
<div className="flex items-center justify-between space-x-2 py-4">
<div className="flex-1 text-sm text-muted-foreground">
Showing {startItem} to {endItem} of {total} results

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

This user-facing string is hardcoded. Since this PR implements internationalization, this should be moved to the message files (e.g., common.json) and accessed via useTranslations.

</div>
<div className="flex items-center space-x-2">
<div className="flex items-center space-x-2">
<span className="text-sm text-muted-foreground">Show:</span>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Hardcoded UI label found. Please use the translation hook to maintain consistency with the rest of the application's i18n implementation.

Comment on lines +84 to +86
setTimeout(async () => {
await handleRefresh()
}, 2000)

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

Avoid using setTimeout for data synchronization. Use tRPC's query invalidation to ensure the UI stays in sync with the server state after a successful deletion.

      await utils.queueRouter.getQueues.invalidate();

Comment on lines +112 to +114
setTimeout(async () => {
await handleRefresh()
}, 2000)

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

Using setTimeout to refresh data after a mutation is brittle and can lead to race conditions or stale UI if the network is slow. Since you are using tRPC, you should leverage the utils object to invalidate the relevant queries immediately upon success.

      await utils.jobsRouter.getJobs.invalidate();


const chartConfig = {
allocated: {
label: "Allocated",

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

Chart legend labels should be localized to support the Simplified Chinese locale added in this PR.

Comment on lines +105 to +107
setTimeout(async () => {
await handleRefresh()
}, 2000)

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

Query invalidation is preferred over setTimeout for refreshing lists after mutations. This ensures the most up-to-date data is fetched as soon as the server processes the request.

      await utils.podRouter.getPods.invalidate();

color: "hsl(var(--chart-1))",
},
capacity: {
label: "Capability",

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

Chart legend labels should be localized to support the Simplified Chinese locale added in this PR.

@volcano-sh-bot

Copy link
Copy Markdown
Contributor

Adding label do-not-merge/contains-merge-commits because PR contains merge commits, which are not allowed in this repository.
Use git rebase to reapply your commits on top of the target branch. Detailed instructions for doing so can be found here.

Details

Instructions 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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants