Repository navigation
Description
Needs your OK: this changes the downloaded responses file for organizers whose language writes decimals with a comma (Swedish, today): its columns would be split by semicolons, and its file name would be in their language. Swap pipeline:proposed for pipeline:ready to have it built.
What happens
responsesCsvinsrc/lib/responses-csv.tsalways joins cells with a comma.- Excel doesn't read the separator from the file. It takes it from the computer's regional settings, and where the decimal mark is a comma (Sweden, and most of Europe) the list separator is
;. - So on such a computer, double-clicking the file shows each row squeezed into column A, and the organizer has to use Data → Text to Columns to get a table.
- The localization stack (Epic: OpenSignup in Swedish, and other languages after it #619) gives the file Swedish column names (Responses and the CSV's column names are English-only #945). The organizers who download it in Swedish are exactly the ones whose Excel won't split it.
- The file name is English for everyone:
<slug>-responses.csv, set insrc/app/api/signups/[id]/export.csv/route.ts.
Not opened in a real Excel. This is how Excel treats a CSV, worked out from its rules, not from a run.
Fix, in outline
- The separator follows the organizer's language. The route already reads it (
getOrganizerAppLocale). Use;when that language writes decimals with a comma, and,otherwise. Work it out withIntl.NumberFormat(locale).formatToParts(1.5)(thedecimalpart). That is the same rule Excel follows, so a new language needs no table. responsesCsvtakes the separator as an option, andcsvEscapequotes any cell that holds the separator in use. Today it only quotes cells with,,"or a line break.- The file name comes from the catalog:
organizer.responses.csv.fileNamewith a{slug}placeholder. English stays{slug}-responses.csv.
Watch for
- No
sep=;first line. Excel honours it, but then ignores the UTF-8 BOM and garbles å, ä and ö. Google Sheets and Numbers show it as a data row. - The BOM stays, for the same reason it's there now.
- English output stays byte for byte the same.
src/lib/responses-csv.test.tsandexport.csv/route.db.test.tspin it. - A file name with å, ä or ö needs
filename*=UTF-8''…inContent-Disposition, next to a plain ASCIIfilename=for old clients. - Numbers are written as stored (
1.5), which a comma-decimal Excel reads as text. The docblock explains why values stay raw. Keep it that way, and add a line saying the separator is the only thing that follows the language. - Help pages that call the file "comma-separated", if any.
Choices this makes
- The organizer's language, not their browser's region. An English-speaking organizer in Sweden would still get commas. The alternative, the region in the download request's
Accept-Language, is right more often, but it makes one link give different files on different computers. Default: the organizer's language. - The Swedish file name. Default:
{slug}-anmälningar.csv.
Order
After #945, because the route only learns the organizer's language there.
Done when
- For an organizer whose language is Swedish, the file uses
;, quotes cells that contain;, keeps the BOM, and is named<slug>-anmälningar.csv. - For English, the file is byte for byte what it is today.
- A unit test with a Swedish translator pins both separators and the quoting.
pnpm lint && pnpm typecheck && pnpm knip && pnpm testandpnpm test:dbpass.
Found by the UX walkthrough, scenario L4 (a Swedish organizer gets the list into a spreadsheet). Run on the localization stack merged locally (#982 + #980 + #931, at 33c8c0d) with Swedish switched on locally, and checked against responses-csv.ts and the export route there. main at 2f58ce82 also joins with commas.
Generated by Claude Code
Activity