Skip to content

feat(api): enhance audience export with i18n, theme colors and richer breakdowns#10

Merged
BatLeDev merged 4 commits into
masterfrom
enhance-audience-export
May 12, 2026
Merged

feat(api): enhance audience export with i18n, theme colors and richer breakdowns#10
BatLeDev merged 4 commits into
masterfrom
enhance-audience-export

Conversation

@BatLeDev
Copy link
Copy Markdown
Member

Summary

  • Add i18n (FR/EN) to the audience PDF export
  • Style the export with the site's theme colors
  • Split API requests vs file downloads per user class in the origin breakdown
  • Improve fonts consistency and fix overflow issues in the rendered PDF

Changes

  • i18n: new api/i18n/messages/{fr,en}.json and a small t() helper in api/i18n/utils.ts (lang fallback + {{var}} interpolation). The export now uses the session language.
  • Theme colors: router fetches /simple-directory/api/sites/_public to read theme.colors and passes them to generate(). Failure is non-fatal and falls back to defaults.
  • Origin breakdown: getOrigin aggregation now groups on operationTrack too, exposing nbRequests* (readDataAPI) and nbFiles* (readDataFiles) per user class (anonymous, owner, user, external, ownerAPIKey, externalAPIKey).
  • Export rendering: refactor of export.ts for consistent typography, alignment and overflow handling; clearer wording for external user / API key labels.

BatLeDev added 4 commits May 12, 2026 09:13
… breakdowns

- Add fr/en i18n messages and a minimal t() helper for export labels
- Use the user's session lang to localize sheet/column/row labels
- Fetch site theme from simple-directory and apply its palette to headers
  and variation cells; fall back to default colors on failure
- Track file downloads by user class in the origins aggregation and add
  the corresponding columns/sheets
- Add a user-class definitions block adapted to user vs organization accounts
- Set explicit font name/size on styled cells so Excel does not fall
  back to a different default font, which produced mixed fonts between
  styled and unstyled cells
- Drop the C:E merge on the user-class-definitions title row so the
  title can overflow visually like the breakdown title above it
- Use the theme's secondary/on-secondary palette for column B row
  labels and keep the primary palette for header rows
- Thin out the bottom border of the column-header row on non-global
  sheets so it no longer reads as a heavy separator
- Remove the redundant parenthetical from the owner-API-key definition
@BatLeDev BatLeDev merged commit 0cd28bf into master May 12, 2026
4 checks passed
@BatLeDev BatLeDev deleted the enhance-audience-export branch May 12, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant