[PR #5809] [CLOSED] Add translation support for report options default range values with UI implementation #6135

Closed
opened 2026-02-28 21:24:26 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/5809
Author: @Copilot
Created: 9/28/2025
Status: Closed

Base: masterHead: copilot/fix-0d33cd1c-fb0e-4c87-a18a-f20909822d08


📝 Commits (4)

  • bcc40a8 Initial plan
  • fce10aa Add report options translations for defaultRange values
  • 68fd5e6 Keep defaultRange as database keys, add defaultRangeLabel for translation
  • 381df81 Use defaultRangeLabel in tooltip to show current default range

📊 Changes

2 files changed (+42 additions, -21 deletions)

View changed files

📝 packages/desktop-client/src/components/reports/ReportSidebar.tsx (+35 -21)
📝 packages/desktop-client/src/components/reports/disabledList.ts (+7 -0)

📄 Description

Some report option strings were hardcoded in English and not marked for translation. Specifically, the defaultRange values in the interval options were using literal English strings that needed translation support while preserving database compatibility.

This affected the automatic date range selection when users change report intervals. For example, when switching from "Monthly" to "Daily" intervals, the range would automatically update to "This month", but this string was hardcoded in English and not available for translation.

Changes Made

Updated packages/desktop-client/src/components/reports/disabledList.ts to add translation support while preserving database enum compatibility:

// Before
const intervalOptions = [
  {
    description: t('Daily'),
    key: 'Daily',
    defaultRange: 'This month',  // Hardcoded English, used as database key
  },
  // ...
];

// After
const intervalOptions = [
  {
    description: t('Daily'),
    key: 'Daily',
    defaultRange: 'This month',         // Kept unchanged as database enum key
    defaultRangeLabel: t('This month'), // Added translatable display label
  },
  // ...
];

Added intervalRangeLabel map to defaultsList export for easy access to translated labels and implemented UI usage in packages/desktop-client/src/components/reports/ReportSidebar.tsx:

  • Added tooltip to interval selector that displays the current default range using translated labels
  • Shows users helpful context about automatic range selection behavior in their preferred language
  • Uses defaultsList.intervalRangeLabel.get() method to display localized range names

Key Design Decision: The defaultRange values are preserved as English strings because they serve as database enum keys that are stored in the date_range field and must match the keys in ReportOptions.dateRange. The new defaultRangeLabel properties and intervalRangeLabel map provide translatable display text for UI purposes while maintaining backward compatibility with existing saved reports.

Testing

Verified that:

  • TypeScript compilation passes without errors
  • Linting checks pass
  • Database compatibility is maintained with existing reports
  • The interval/range switching functionality works correctly in the custom reports interface
  • Translation labels are properly displayed in the interval selector tooltip
  • UI provides better user experience with localized explanatory text

This solution enables proper localization for international users while preserving data integrity and backward compatibility with existing reports stored in the database. The implementation now includes actual UI usage of the translated labels, improving user understanding of the interface behavior.

Fixes actualbudget/actual#5287

Original prompt

This section details on the original issue you should resolve

<issue_title>Add report options translations</issue_title>
<issue_description>Some of the options for reports are currently hardcoded english strings, it would be good to be able to mark these for translation.

You can find these in 80bb4ab299/packages/desktop-client/src/components/reports/ReportOptions.ts</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes actualbudget/actual#5287

Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/5809 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 9/28/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `copilot/fix-0d33cd1c-fb0e-4c87-a18a-f20909822d08` --- ### 📝 Commits (4) - [`bcc40a8`](https://github.com/actualbudget/actual/commit/bcc40a83413d7877c6840ab0e258b3f9bb5613ac) Initial plan - [`fce10aa`](https://github.com/actualbudget/actual/commit/fce10aa6711e724a04d428f3d6cd12fc22b850f7) Add report options translations for defaultRange values - [`68fd5e6`](https://github.com/actualbudget/actual/commit/68fd5e6e1f7573d00bf54614b94d4db5aa067dc4) Keep defaultRange as database keys, add defaultRangeLabel for translation - [`381df81`](https://github.com/actualbudget/actual/commit/381df81d3bf14af90f81714e10acf15a0ae3804d) Use defaultRangeLabel in tooltip to show current default range ### 📊 Changes **2 files changed** (+42 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/reports/ReportSidebar.tsx` (+35 -21) 📝 `packages/desktop-client/src/components/reports/disabledList.ts` (+7 -0) </details> ### 📄 Description Some report option strings were hardcoded in English and not marked for translation. Specifically, the `defaultRange` values in the interval options were using literal English strings that needed translation support while preserving database compatibility. This affected the automatic date range selection when users change report intervals. For example, when switching from "Monthly" to "Daily" intervals, the range would automatically update to "This month", but this string was hardcoded in English and not available for translation. ## Changes Made Updated `packages/desktop-client/src/components/reports/disabledList.ts` to add translation support while preserving database enum compatibility: ```typescript // Before const intervalOptions = [ { description: t('Daily'), key: 'Daily', defaultRange: 'This month', // Hardcoded English, used as database key }, // ... ]; // After const intervalOptions = [ { description: t('Daily'), key: 'Daily', defaultRange: 'This month', // Kept unchanged as database enum key defaultRangeLabel: t('This month'), // Added translatable display label }, // ... ]; ``` Added `intervalRangeLabel` map to `defaultsList` export for easy access to translated labels and implemented UI usage in `packages/desktop-client/src/components/reports/ReportSidebar.tsx`: - **Added tooltip to interval selector** that displays the current default range using translated labels - **Shows users helpful context** about automatic range selection behavior in their preferred language - **Uses `defaultsList.intervalRangeLabel.get()`** method to display localized range names **Key Design Decision**: The `defaultRange` values are preserved as English strings because they serve as database enum keys that are stored in the `date_range` field and must match the keys in `ReportOptions.dateRange`. The new `defaultRangeLabel` properties and `intervalRangeLabel` map provide translatable display text for UI purposes while maintaining backward compatibility with existing saved reports. ## Testing Verified that: - TypeScript compilation passes without errors - Linting checks pass - Database compatibility is maintained with existing reports - The interval/range switching functionality works correctly in the custom reports interface - Translation labels are properly displayed in the interval selector tooltip - UI provides better user experience with localized explanatory text This solution enables proper localization for international users while preserving data integrity and backward compatibility with existing reports stored in the database. The implementation now includes actual UI usage of the translated labels, improving user understanding of the interface behavior. Fixes actualbudget/actual#5287 <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Add report options translations</issue_title> > <issue_description>Some of the options for reports are currently hardcoded english strings, it would be good to be able to mark these for translation. > > You can find these in https://github.com/actualbudget/actual/blob/80bb4ab299ea7cb80f486773564416cb3c2d4c33/packages/desktop-client/src/components/reports/ReportOptions.ts</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> Fixes actualbudget/actual#5287 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/actualbudget/actual/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 21:24:26 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#6135