-
Notifications
You must be signed in to change notification settings - Fork 0
Translation
John R. D'Orazio edited this page Feb 27, 2026
·
1 revision
How to produce translated versions of the bylaws in any language.
-
Node.js with
npm installcompleted in the repo root - Pandoc installed as a system dependency (installation docs)
- An OpenAI API key with access to the
gpt-4omodel
Set the OPENAI_API_KEY environment variable. You can either export it
directly:
export OPENAI_API_KEY="sk-..."Or create a .env.local file in the repo root (git-ignored):
OPENAI_API_KEY=sk-...
The translation script loads .env.local automatically if present.
Translate to one or more languages using BCP 47 language codes:
# Single language
npm run translate -- --lang es
# Multiple languages
npm run translate -- --lang es --lang fr --lang laFor each requested language, scripts/translate.js performs three steps:
-
Translate — Sends
BYLAWS.mdto the OpenAI API (gpt-4o, temperature 0.2) with a legal translation prompt. The prompt preserves:- All Markdown formatting
- The metadata block (
Version:,Original Adoption Date:,Last Amended:) verbatim - The organization name "Catholic Digital Commons Foundation" verbatim
- Legal citations (e.g. "Section 501(c)(3)") verbatim
- Ecclesiastical terms are translated naturally (e.g. "Holy See" becomes "Santa Sede" in Spanish)
-
Convert to HTML — Runs Pandoc to produce a standalone HTML file with the print stylesheet embedded.
-
Generate PDF — Runs
pagedjs-clito produce a print-ready PDF.
For each language code (e.g. es):
| File | Description |
|---|---|
dist/bylaws-es.md |
Translated Markdown |
dist/bylaws-es-standalone.html |
Self-contained HTML with embedded CSS |
dist/bylaws-es.pdf |
Print-ready PDF (US Letter) |
# Spanish
npm run translate -- --lang es
# Latin and Italian
npm run translate -- --lang la --lang it
# French
npm run translate -- --lang fr- Translations are generated on demand and are not committed to the
repository. The
dist/directory is git-ignored. - The translation uses the same print stylesheet (
scripts/bylaws-print.css) and fonts as the English PDF. - For official translated documents, review the output for legal accuracy before distribution.