feat(i18n): expand Chinese localization and fix env substitution
Summary
- Expand the Chinese i18n bundle (en/zh) to cover Groups, Networks, Network Routes, Posture Checks, DNS, Reverse Proxy, Audit, and Settings pages, plus their modals.
- Fix
docker/server.jsto substitute both$VARand$$VARplaceholders at startup, applyno-storeto.jsassets, and renderOidcTrustedDomains.jsfrom the template. - Add a
safePathguard in the static server so request paths cannot escape the served web root. - Localize remaining reverse proxy modal labels, descriptions, tooltips, and the "Learn more about" doc links; move table column definitions for
Networks,MinimalPeers,ServiceUsers, andActivitytables intouseMemohooks so they can consumeuseTranslations(column headers, code, role, status, address, last seen, etc.). - Add missing translation keys:
dns.selectType/selectTTL,activity.code,policies.all/protocols,postureChecks.descriptionOptional,serviceUsers.{role,status,learnMoreAbout},networks.policies, and the fullreverseProxymodal set (NetBird-Only Access, SSO, Password, PIN Code, HTTP Headers, Preserve Client Source IP, Session/Connection Timeout, Pass Host Header, Rewrite Redirects, Direct Upstream, and the per-tab "Learn more" links). - Address CodeRabbit review: localize confirmation dialogs (
noProtectionTitle/Description), service mode labels (httpsService,tlsPassthrough,tcpService,udpService), modal descriptions, tooltip text (GROUP_TOOLTIP_TEXT→ translation keys), timestamp[at]token,RestrictedAccessheading/description,MultipleGroupsbadge,PeerNameCellaria-label interpolation,PeerVersionCelllatestUrl null-check,DataTableMultiSelectPopupdouble-count fix,AccessControlTablebidirectional||→??, andzh.tsICU plural format foractivePoliciesCount.
Verification
npx tsc --noEmitnpm run buildgit diff --check- Translation key validator (en + zh) for all touched
.tsxfiles - Production smoke test on https://ne.rainycy.top/ confirms Chinese rendering and that no unexpanded placeholders leak into the served bundle.
Out of scope
- Upgrading audited high-severity dependencies (
next,js-cookie, etc.) — should be handled in a separate PR. npm run lint— the project still calls the removednext lintscript; this is a repo-wide config issue, not a regression introduced here.- Translation key gaps in pre-existing dev-authored commits on the same branch (e.g.
policies.learnMore,peers.operatingSystem.linux); these are inherited from earlier work and tracked separately.
Summary by CodeRabbit
Release Notes
-
New Features
- Added multi-language support (English and Chinese) with localized dashboard content, navigation, dialogs, and table controls.
- Introduced a locale switcher and cookie/browser-based locale detection with safe fallbacks.
-
Refactor
- Updated dashboard pages and shared components to use translation-driven text, placeholders, tooltips, and status labels across tables and empty states.
-
Deployment
- Updated the container to serve the built dashboard via a Node-based static server on port 80.
[!NOTE]
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.Use the checkboxes below for quick actions:
- [ ] ▶️ Resume reviews
- [ ] 🔍 Trigger review
📝 Walkthrough
Walkthrough
This PR adds next-intl localization across dashboard pages, shared components, and feature tables/modals, introduces English and Chinese message bundles, and replaces the dashboard container with a Node static server for exported assets.
Changes
Dashboard i18n and runtime migration
| Layer / File(s) | Summary |
|---|---|
Runtime and locale bootstrap docker/*, next.config.js, package.json, src/i18n/*, src/layouts/AppLayout.tsx, src/layouts/Header.tsx, src/modules/settings/LanguageTab.tsx, src/i18n/messages/* |
The container runtime now serves exported assets with docker/server.js, and the app is wired for next-intl routing, locale request/config loading, locale persistence, locale switching, and message catalogs. |
Dashboard pages and navigation localization src/app/(dashboard)/*page.tsx, src/layouts/Navigation.tsx, src/modules/settings/*Tab.tsx |
Dashboard route pages, sidebar labels, and settings tabs switch their visible text to translation keys while preserving existing data loading, permission checks, and navigation structure. |
Shared UI and table primitives src/components/table/*, src/components/ui/*, src/components/PeerSelector.tsx, src/components/NoPeersGettingStarted.tsx, src/modules/common-table-rows/GroupsRow.tsx, src/modules/groups/*Selector.tsx, src/modules/control-center/nodes/SelectGroupNode.tsx, src/modules/peer/MinimalPeersTable.tsx, src/components/ui/RestrictedAccess.tsx |
Reusable tables, selectors, empty states, group helpers, and restricted-access text now use translated labels, placeholders, modal copy, and fallback text. |
Feature tables and modals src/modules/access-control/*, src/modules/activity/ActivityTable.tsx, src/modules/groups/table/*, src/modules/users/UsersTable.tsx, src/modules/users/ServiceUsersTable.tsx, src/modules/peers/*, src/modules/networks/*, src/modules/reverse-proxy/ReverseProxyModal.tsx, src/modules/dns/*, src/modules/posture-checks/modal/PostureCheckModal.tsx |
Access-control, activity, groups, service-users, users, peers, network, reverse-proxy, DNS, and posture-check tables, action cells, and modals are localized, with several table column definitions moved into component-local memoized builders. |
Estimated code review effort
🎯 5 (Critical) | ⏱️ ~90+ minutes
Possibly related PRs
- netbirdio/dashboard#485: Both PRs modify
src/app/(dashboard)/peer/page.tsx, so they overlap on the peer detail page component. - netbirdio/dashboard#528: Both PRs touch
src/app/(dashboard)/dns/zones/page.tsx, which is one of the localized DNS route pages here. - netbirdio/dashboard#552: Both PRs overlap on reverse-proxy page components that this PR localizes.
Poem
🐇 I hopped through pages, strings, and signs,
and stitched two tongues through rabbit lines.
The static shell now hums at night,
while en and zh both shine bright.
A tidy burrow, softly sprung—
the dashboard sings in every tongue.
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 13.27% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
| Description check | ❓ Inconclusive | The description provides detailed summary, verification steps, and explicitly marks out-of-scope items, but does not follow the required template structure with Issue ticket, Documentation checkboxes, and Docs PR URL. | Follow the repository's PR description template: add Issue ticket number/link section, select Documentation checkbox with explanation, and include Docs PR URL if applicable. |
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title clearly and concisely summarizes the main changes: i18n expansion and Docker environment variable substitution fixes. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
@sakuradairong we are about to merge a huge change where we sync a private fork into this repo. This will cause lots of changes for your PR.
I advise you to wait for a bit as this may break things for you.
Thank you for the heads up! I will pause further changes and wait for the private fork merge to land first. After that I will rebase this PR and resolve any conflicts.
For context, this PR adds:
- Cookie-based locale detection (enabled by default, switchable to zh via cookie)
- Language switcher in the header and Settings page
- Comprehensive Chinese localization (~900 translation keys)
Please let me know when the fork merge is complete and I will update the PR accordingly.
Good catch on the LOCALE_LABELS duplication. I will address this after rebasing on the upcoming fork merge.
Update: the Chinese translation work is now mostly complete.
I have pushed the latest localization updates covering the shared UI and the main dashboard modules, including Peers, Users, Activity, Setup Keys, Routes, DNS, Networks, and Access Control. At this point the remaining work should mainly be review, final polish, and addressing any feedback or conflicts from upstream changes.
Thanks!
Hi team, I''ve synced the latest origin/main into this branch and fixed the blockers that were preventing a green build. Here is a summary:
Fixes applied
- Merged
origin/main(non-fast-forward merge) to resolve the API drift. - Replaced removed export
isNetBirdHosted→isNetBirdCloudin:src/modules/settings/GroupsSettings.tsxsrc/modules/settings/NetworkSettingsTab.tsx
- Restored missing imports
IdentityProviderCardandAccountMfaCardinsrc/app/(dashboard)/team/users/page.tsx. - Fixed
PeerMultiSelectscope bug where the inner component usedtwithout callinguseTranslations("peers"). - Added
dataCyprop support toPeerGroupSelectorso callers that passdataCytype-check correctly. - Fixed translator type mismatch in
AccessControlTablecolumn factory. - Fixed next-intl value type errors in:
ActivityDescription.tsx(nestedt.richreturningReactNodeused as interpolation value)UserResendInviteButton.tsx(user.emailpossiblyundefined)
- Addressed CodeRabbit feedback:
- Extracted shared
LOCALE_LABELSintosrc/i18n/config.tsand updated bothLocaleSwitcherandLanguageTabto import it. - Removed the unsafe
zh: zh as unknown as typeof encast fromsrc/i18n/config.ts.
- Extracted shared
Verification
npx tsc --noEmit✅ 0 errorsnpm run build✅ static export completed successfully- i18n key parity check:
en.tsandzh.tsboth have2483keys,missingInZh = 0,extraInZh = 0 - Changed-file translation usage check:
missingCount = 0
Notes
- The
npm run lint/ ESLint 9 setup issue is unrelated to this localization work and is still tracked separately. - Branch
localize-zh-v2.39.0has been pushed to bothforkandrainycyremotes.
Please re-run the checks when convenient. Let me know if anything else is needed!
Hi @mlsmaycon, the private-fork changes have now landed and I have updated this PR against the latest origin/main (through v2.90.7).
I also performed a full regression review after the sync and fixed the issues introduced during conflict resolution:
- restored the Reverse Proxy Events pagination/peer providers and default date/sort filters;
- preserved the current Cloud/Billing, Metrics, MSP, and Agent Network settings behavior;
- restored the upstream nginx/supervisor/certbot runtime, TLS/443 support, CSP/security headers, and runtime environment substitution (including both
$VARand$$VARplaceholders); - fixed the peer-count label, restricted-access fallback, and stale translated filter memo dependencies;
- added a Node 20-compatible
test:i18ncommand and completed another shared UI / Reverse Proxy Events localization pass.
Verification completed successfully:
npm run buildnpx tsc --noEmit --pretty falsenpm run test:i18ngit diff --check- English/Chinese catalog parity: 2,594 keys on each side, with no missing or extra keys
- Docker image build and live nginx/CSP/runtime-environment smoke test
The latest commit is b3b9ab6. CodeRabbit and CLA checks are green. The branch is currently fully synced with origin/main (58 commits ahead, 0 behind).
This should now be ready for another maintainer review. Please let me know if you would prefer the history to be squashed or if any additional changes are needed. Thank you!