Development#
Developer notes#
DEVELOP.rstcontains developer workflow notes for buildout setups.FORM_DATA_VALIDATION.mdandFORM_DATA_VALIDATION_IMPLEMENTATION.mddocument validation goals and implementation details.data-validation/README.mddocuments the validator CLI and build targets.Demo site setup and localization notes are maintained in this file.
Adding a new demo language (scripts/init_plone.py)#
To add a new language to the demo initializer, update both the init script and
the assets under scripts/forms. The process is mostly copy-and-translate,
but the IDs and links must stay aligned.
1. Update language registry and trees#
configure_site_languages(): add the language code toplone.available_languagesand adjust the log message.language_trees: add"<lang>": {"root": "...", "demos": "..."}.
2. Extend welcome-page dictionaries#
Add the language key to each dictionary (keys must match the language code):
WELCOME_BANNERSWELCOME_YOUTUBEWELCOME_LINKSWELCOME_HEADINGSWELCOME_POWERED_BY_HEADINGSWELCOME_DEMOS(labels + hrefs)WELCOME_TITLES
Important: The demo links in WELCOME_DEMOS must match the IDs created later
in the script (e.g. <lang>/demos/event-registration-<lang>).
3. Add translated form assets#
Create or update these files in scripts/forms:
welcome_<lang>.htmlmental_health_intro_<lang>.htmlfull_demo_intro_<lang>.htmlevent_registration_<lang>.jsonevent_rsvp_<lang>.jsonmental_health_<lang>.jsonfull_demo_<lang>.jsonfood_feedback_<lang>.jsonorder_form_<lang>.json
Notes:
JSON files must be valid JSON (no HTML comments).
Set
\"locale\": \"<lang>\"in each JSON form.Keep element
namevalues unchanged; only translate user-facing strings.
4. Seed the new language demos#
Add a language-specific demo block next to the existing language blocks:
Load each
*_ <lang>.jsonfile viaload_form_definition.Call
set_form_languageandset_form_locale.Load intro HTML for mental health and full demo.
Call
create_demo_surveywith localized titles/descriptions andcontainer=demos_by_language[\"<lang>\"].
5. Run the initializer#
Recreate the demo site to verify:
bin/instance run scripts/init_plone.py
Validate:
Welcome page renders with the new language.
All demo links resolve.
Surveys show localized labels and button text.
Testing#
Python tests are executed with
pytest.The data-validation CLI includes its own pytest suite under
data-validation/tests.