i18n#27
Merged
Merged
Conversation
Coverage Summary
Overall status: unavailable |
There was a problem hiding this comment.
Pull request overview
This PR introduces dashboard/settings internationalization (English + Chinese) by centralizing UI copy in a new lib/i18n/dashboard.ts message bundle, wiring dashboard-related pages/components to useAppearanceLanguage(), and adding tests that assert Chinese UI chrome. It also adds an HTML lang synchronization mechanism and extends ConfirmDialog to accept localized button labels.
Changes:
- Add a
DashboardMessagesbundle (EN/ZH) and update dashboard/monitor/reports/settings UI to render from it. - Sync
document.documentElement.langwith the saved appearance language (viaProvidersand settings UI). - Expand/adjust Vitest coverage to validate Chinese translations across key pages/components.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/pages/scan-page.test.tsx | Adds Chinese UI assertions; clears localStorage between tests. |
| tests/pages/reports-pages.test.tsx | Adds Chinese UI assertions; introduces schedules mock and localStorage reset. |
| tests/pages/core-pages.test.tsx | Adds language mock to test dashboard/settings Chinese rendering. |
| tests/lib/providers.test.tsx | Adds coverage for syncing <html lang> with stored appearance language. |
| tests/components/settings-components.test.tsx | Updates assertions to include <html lang> and Chinese “Dark” label. |
| tests/components/report/report-list-table.test.tsx | Adds Chinese table/action assertions; clears localStorage in beforeEach. |
| tests/components/report/report-generate-dialog.test.tsx | Adds Chinese dialog chrome assertions; clears localStorage. |
| tests/components/monitor/monitor-list-content.test.tsx | Adds Chinese pagination/control assertions; clears localStorage. |
| lib/providers.tsx | Adds HtmlLanguageSync to keep <html lang> aligned with appearance language. |
| lib/i18n/dashboard.ts | New centralized EN/ZH message bundle for dashboard/settings/scan/monitor/reports. |
| components/settings/settings-nav.tsx | Localizes nav labels using message keys; marks component as client. |
| components/settings/placeholder-section.tsx | Localizes “Coming Soon”; marks component as client. |
| components/settings/appearance-settings.tsx | Localizes section labels; applies <html lang> when language changes. |
| components/settings/api-keys-settings.tsx | Localizes labels/buttons/toasts using dashboard messages. |
| components/report/report-status-badge.tsx | Localizes status labels via i18n bundle. |
| components/report/report-schedule-list.tsx | Localizes table headers, actions, statuses, and toast strings. |
| components/report/report-schedule-dialog.tsx | Localizes dialog copy/labels and weekday/day formatting. |
| components/report/report-list-table.tsx | Localizes table headers, button labels, confirm dialog strings, and toasts. |
| components/report/report-generate-dialog.tsx | Localizes dialog copy/labels and default title placeholder generation. |
| components/monitor/monitor-list-table.tsx | Localizes table headers/ARIA labels and “Never” label. |
| components/monitor/monitor-list-content.tsx | Localizes pagination and empty/error states. |
| components/monitor/monitor-filter-bar.tsx | Localizes placeholders, ARIA labels, filter/sort labels, and advanced filters UI. |
| components/dashboard/ssl-watchlist.tsx | Localizes titles/errors/status labels and expiry formatting. |
| components/dashboard/scan-input.tsx | Localizes validation/error strings and UI copy for port scanning and submit button. |
| components/dashboard/recent-scans.tsx | Localizes titles, empty/error states, status badges, and ARIA labels. |
| components/dashboard/quick-scan.tsx | Localizes quick-scan copy and ARIA label. |
| components/dashboard/monitor-health.tsx | Localizes titles/errors/empty state/link text and formatting helpers. |
| components/dashboard/dashboard-stats.tsx | Localizes stat labels and error message + retry button. |
| components/common/confirm-dialog.tsx | Adds optional cancelLabel and loadingLabel props for i18n. |
| app/dashboard/settings/page.tsx | Localizes settings page title/subtitle and placeholder section copy. |
| app/dashboard/scan/page.tsx | Localizes scan page copy, filters, statuses, and error/success strings. |
| app/dashboard/reports/page.tsx | Localizes reports page chrome, tabs, and loading/empty states. |
| app/dashboard/page.tsx | Marks dashboard home as client; localizes title/subtitle. |
| app/dashboard/monitor/page.tsx | Marks monitor list page as client; localizes title/subtitle/loading fallback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
274
to
276
| setStartError((prev) => | ||
| prev ? `${prev}\nFailed ${url}: ${reason}` : `Failed to start scan for ${url}: ${reason}` | ||
| prev ? `${prev}\nFailed ${url}: ${reason}` : messages.startFailed(url, reason) | ||
| ); |
Comment on lines
40
to
44
| const { theme, setTheme } = useTheme(); | ||
| const appearanceLanguage = useAppearanceLanguage(); | ||
| const messages = getDashboardMessages(appearanceLanguage).settings; | ||
| const [fontSize, setFontSize] = useState<FontSizeOption>("default"); | ||
| const [language, setLanguage] = useState<LanguageOption>("en"); |
Comment on lines
+364
to
+371
| viewAllMonitors: (count) => `View all ${count} monitors ->`, | ||
| neverChecked: "Never checked", | ||
| uptimeValue: (value) => `${value}% uptime`, | ||
| uptimeUnavailable: "Uptime unavailable", | ||
| latencyUnavailable: "No latency yet", | ||
| sslWatchlist: "SSL Expiry Watchlist", | ||
| failedToLoadSslWatchlist: "Failed to load SSL watchlist", | ||
| viewAllMonitorsShort: "View all monitors ->", |
Comment on lines
+694
to
+701
| viewAllMonitors: (count) => `查看全部 ${count} 個監控 ->`, | ||
| neverChecked: "尚未檢查", | ||
| uptimeValue: (value) => `${value}% 可用率`, | ||
| uptimeUnavailable: "無法取得可用率", | ||
| latencyUnavailable: "尚無延遲資料", | ||
| sslWatchlist: "SSL 到期觀察清單", | ||
| failedToLoadSslWatchlist: "無法載入 SSL 觀察清單", | ||
| viewAllMonitorsShort: "查看全部監控 ->", |
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.
No description provided.