Skip to content

fix(i18n): localize project insight labels - #9589

Open
bulunote wants to merge 2 commits into
makeplane:previewfrom
bulunote:agent/i18n-project-insights
Open

fix(i18n): localize project insight labels#9589
bulunote wants to merge 2 commits into
makeplane:previewfrom
bulunote:agent/i18n-project-insights

Conversation

@bulunote

@bulunote bulunote commented Aug 12, 2026

Copy link
Copy Markdown

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 name directly 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:

  • defining a small map from the seven stable API keys to existing Plane translation keys;
  • replacing only the system-provided display names before data reaches the radar chart;
  • using the same localized data in the adjacent summary list; and
  • retaining the backend name as a forward-compatible fallback for any future unknown dimension.

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

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

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

  • Regression test verifies that every project dimension returned by the API has a frontend translation mapping, that each mapping resolves to an existing leaf string, and that both chart and summary use the localized data.
  • node --test --experimental-strip-types packages/i18n/scripts/__tests__/project-insights-localization.test.ts
  • pnpm --filter web check:types
  • pnpm turbo run build --filter=web --output-logs=errors-only
    • 11/11 tasks completed successfully.
  • Changed-file OxLint with --deny-warnings
  • Changed-file oxfmt check
  • pnpm --filter @plane/i18n check:sync
    • all 19 locales contain the same 3,837 keys.
  • git diff --check

References

Summary by CodeRabbit

  • Enhancements

    • Project insights in analytics charts and summary lists now display localized names.
    • Known insight labels are translated using the selected language.
  • Tests

    • Added coverage to verify insight dimensions resolve to the correct English translations and appear localized in charts.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b44d1a6-838b-4003-8451-567c41acbcdf

📥 Commits

Reviewing files that changed from the base of the PR and between 9c886aa and 4418421.

📒 Files selected for processing (1)
  • packages/i18n/scripts/__tests__/project-insights-localization.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/i18n/scripts/tests/project-insights-localization.test.ts

📝 Walkthrough

Walkthrough

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

Changes

Project Insight Localization

Layer / File(s) Summary
Localize and render project insights
apps/web/core/components/analytics/overview/project-insights.tsx
The component defines the insight datum and translation-key mappings. It localizes known insight names, preserves unknown names, and passes the localized data to the chart and summary list.
Validate localization coverage
packages/i18n/scripts/__tests__/project-insights-localization.test.ts
The test verifies that API insight keys map to resolvable English translations and that the component renders localized data.

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
Loading

Suggested reviewers: sriramveeraghanta

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: localizing project insight labels.
Description check ✅ Passed The description covers the change, type, impact, test scenarios, and reference, with clear scope and fallback behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bulunote
bulunote marked this pull request as ready for review August 12, 2026 00:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/web/core/components/analytics/overview/project-insights.tsx (1)

36-44: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use camelCase for the label map.

Rename PROJECT_INSIGHT_LABEL_KEYS to projectInsightLabelKeys. 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

📥 Commits

Reviewing files that changed from the base of the PR and between 1c8a60f and 9c886aa.

📒 Files selected for processing (2)
  • apps/web/core/components/analytics/overview/project-insights.tsx
  • packages/i18n/scripts/__tests__/project-insights-localization.test.ts

Comment thread packages/i18n/scripts/__tests__/project-insights-localization.test.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant