feat(translations): spreadsheet workflow for translating theme labels

translations/labels.csv holds every translatable label (164 strings extracted
from config.xml: option titles, category names, optionlabels, dropdown
optgroup/option labels) with one column per language (default nl).
translations/sync_labels.php re-extracts labels from config.xml and merges:
new strings appended empty, existing translations preserved, removed strings
dropped; --check exits 1 when stale (run after config.xml changes).
translations/csv_to_sql.php turns a filled-in CSV column into idempotent SQL
for lime_source_message/lime_message. README i18n section documents the
workflow.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-30 15:11:23 +01:00
commit 7a758d807a

View file

@ -92,6 +92,11 @@ Arguments for choosing Respondage Vanilla:
`.gitignore`): `variants/*.json` (client definitions with house-style
values), `variants/leak-patterns.txt` and `variants/tests/` — those live in
the private variants repo, not here.
- `translations/` — the translation spreadsheet workflow: `labels.csv` (all
theme labels, one row per source string, one column per language) plus
`sync_labels.php` (re-extracts labels from `config.xml`, keeps existing
translations) and `csv_to_sql.php` (CSV → SQL for the `lime_source_message`/
`lime_message` tables). See "Multiple languages in the theme options (i18n)".
## Multiple languages in the theme options (i18n)
@ -128,11 +133,30 @@ language — the message tables are the right mechanism for that (a feature
request to expose the current language to twig has been prepared for the
LimeSurvey developers).
**Still to be done: translations.** The theme ships only the English source
strings — no translations of its own labels (option titles, category names,
dropdown labels) are bundled or pre-filled yet. Filling in translations (per
language, e.g. Dutch for the options page) via the message tables above is
open work; contributions of translations to this repository are welcome.
**Translating via a spreadsheet (recommended workflow).** All theme labels
live in `translations/labels.csv` — one row per source string
(`context,key,source,<language columns...>`, by default one `nl` column), ready
to open in Excel/LibreOffice. Keep it up to date during development with:
php translations/sync_labels.php # re-extract labels from config.xml:
# new strings are appended with empty
# translation cells, existing translations
# are preserved, removed strings are dropped
php translations/sync_labels.php --check # exit 1 when labels.csv is stale
# (run this after changing config.xml)
After editing translations in the spreadsheet, generate the SQL for the message
tables and run it in the installation's database:
php translations/csv_to_sql.php translations/labels.csv nl > nl.sql
mysql -h localhost -u <user> -p <database> < nl.sql
(`csv_to_sql.php` emits idempotent INSERTs — safe to re-run after each edit. Add
a language by adding a column to the CSV header, e.g. `de`.) To ship
translations with the theme itself, commit the filled-in `labels.csv` —
**still to be done:** no translations are filled in yet; the theme ships only
the English source strings. Contributions of translations to this repository
are welcome.
## Header logos (left / center / right)