Skip to content

translations to-spreadsheet: --program-id filter and short locale references#106

Open
tokland wants to merge 2 commits into
developmentfrom
feature/translations-generation
Open

translations to-spreadsheet: --program-id filter and short locale references#106
tokland wants to merge 2 commits into
developmentfrom
feature/translations-generation

Conversation

@tokland

@tokland tokland commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Closes https://app.clickup.com/t/4528615/869dc4guz?comment=90120236273934

Follow-up to #101, adding two capabilities to translations to-spreadsheet.

Changes

  • --program-id filter. When set, objects are taken from that program's metadata dependency export (/api/programs/{id}/metadata) instead of the whole instance, so each generated spreadsheet is scoped to a single program.
  • Short locale references. --locales now matches by exact base name first, then by substring, so Sotho resolves to Southern Sotho (Lesotho). A reference matching more than one locale is ambiguous and errors; no match warns and is skipped (as before).
  • Suffix-stripped column headers. The resolved locale's (...) qualifier is dropped from the column header (formName: Southern Sotho instead of formName: Southern Sotho (Lesotho)). This also fixes the round-trip: from-spreadsheet matches headers against suffix-stripped DB names, so previously any locale with a (country) suffix would not re-import.

Test plan

  • Unit tests added/updated in ExportTranslationsUseCase.spec.ts (short/substring match, ambiguity error, stripped header, program-scoped fetch). yarn vitest run green; tsc --noEmit clean.
  • Verified end-to-end against a live instance: program-scoped export produces one program's objects; SothoSouthern Sotho header; and a from-spreadsheet --post round-trip added a st_LS translation while preserving existing ones.

tokland and others added 2 commits July 6, 2026 12:37
Add a --program-id option to `translations to-spreadsheet`. When set, objects
are taken from that program's metadata dependency export
(/api/programs/{id}/metadata) instead of the whole instance, so each generated
spreadsheet is scoped to a single program.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…aders

Locale references passed to `translations to-spreadsheet --locales` now match by
exact base name first, then by substring, so "Sotho" resolves to
"Southern Sotho (Lesotho)". A reference matching more than one locale is
ambiguous and errors; no match warns and is skipped (as before).

The resolved locale's " (...)" suffix is stripped from the column header, so
headers are shorter and round-trip with `from-spreadsheet`, which matches
headers against suffix-stripped DB names.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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