fix(i18n): localize project insight labels - #9589
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe project insights component now localizes known analytics insight names before rendering them in the radar chart and summary list. A repository-level test verifies API key mappings, English translations, and localized data usage. ChangesProject Insight Localization
Estimated code review effort: 3 (Moderate) | ~15–30 minutes Sequence Diagram(s)sequenceDiagram
participant ProjectInsights
participant AnalyticsAPI
participant EnglishLocale
participant RadarChart
participant SummaryList
ProjectInsights->>AnalyticsAPI: Request project insight data
AnalyticsAPI-->>ProjectInsights: Return insight names and values
ProjectInsights->>EnglishLocale: Resolve mapped translation keys
EnglishLocale-->>ProjectInsights: Return localized insight names
ProjectInsights->>RadarChart: Render localized insight data
ProjectInsights->>SummaryList: Render localized insight data
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/web/core/components/analytics/overview/project-insights.tsx (1)
36-44: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse camelCase for the label map.
Rename
PROJECT_INSIGHT_LABEL_KEYStoprojectInsightLabelKeys. As per coding guidelines, use camelCase for variables and functions.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/core/components/analytics/overview/project-insights.tsx` around lines 36 - 44, Rename the PROJECT_INSIGHT_LABEL_KEYS variable to projectInsightLabelKeys and update every reference to it, preserving the existing label mappings.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/i18n/scripts/__tests__/project-insights-localization.test.ts`:
- Around line 41-43: Update the project-insights component assertions in the
localization test to positively require localizedProjectInsightsData?.map usage,
while rejecting both projectInsightsData?.map and projectInsightsData.map forms.
Preserve the existing localized data prop assertion and negative checks.
---
Nitpick comments:
In `@apps/web/core/components/analytics/overview/project-insights.tsx`:
- Around line 36-44: Rename the PROJECT_INSIGHT_LABEL_KEYS variable to
projectInsightLabelKeys and update every reference to it, preserving the
existing label mappings.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: ef4d4d70-6792-4597-9a41-3fc46505e251
📒 Files selected for processing (2)
apps/web/core/components/analytics/overview/project-insights.tsxpackages/i18n/scripts/__tests__/project-insights-localization.test.ts
Description
The advanced analytics API returns both a stable machine key and an English display name for each project-insight dimension. The Web client currently passes that English
namedirectly to the radar chart and summary list, so labels such as Work Items, Cycles, Modules, Intake, Members, Pages, and Views remain English after a user selects another language.This PR keeps the API contract unchanged and localizes the presentation layer by:
The mapping intentionally does not translate user-created project, state, label, member, cycle, or module names. No new locale keys or placeholder translations are added.
Type of Change
Screenshots and Media (if applicable)
Before: project-insight radar axes and the summary list always render the English names returned by the API.
After: those seven system dimensions follow the active Plane locale, while unknown and user-defined names remain unchanged.
Test Scenarios
node --test --experimental-strip-types packages/i18n/scripts/__tests__/project-insights-localization.test.tspnpm --filter web check:typespnpm turbo run build --filter=web --output-logs=errors-only--deny-warningspnpm --filter @plane/i18n check:syncgit diff --checkReferences
Summary by CodeRabbit
Enhancements
Tests