Skip to content

Green, i18n-ready scaffolding and a language subtemplate#8

Merged
MrTango merged 2 commits into
mainfrom
feature/green-i18n-scaffolding
May 27, 2026
Merged

Green, i18n-ready scaffolding and a language subtemplate#8
MrTango merged 2 commits into
mainfrom
feature/green-i18n-scaffolding

Conversation

@MrTango
Copy link
Copy Markdown
Contributor

@MrTango MrTango commented May 27, 2026

Summary

The largest slice of the original combined commit, focused on making the generated tree green and i18n-ready out of the box.

  • ruff-clean generation: isort config (single-line imports, lines-after-imports), import reorders across templates, drop unused imports, and a per-file-ignore for locales/update.py.
  • secure locales/update.py: drop shell=True in favour of list-arg subprocess.call + glob.
  • content type tests honour global_allow=false: not-globally-addable types create a parent container that allows the type and add inside it; drop the unused factory/fti lookup.
  • i18n: MessageFactory lives in i18n.py (not __init__), zope_i18n_compile_mo_files set in the dev zope.conf and the test layer, vocab template uses _(), and a new language subtemplate scaffolds locales/<code>/LC_MESSAGES/<domain>.po.
  • behavior gets a stable short name: the <plone:behavior> registration now pins an explicit name="<package>.<module>" instead of relying on the full interface dotted path, and the generated test looks the behavior up by that short name. The short name survives moving/renaming the behavior module.
  • new github_organization option drives the generated [project.urls].
  • .gitignore: track .pot, ignore only .mo.

Test plan

  • tests/test_language.py
  • tests/test_generated_ruff_clean.py (e2e: scaffolded addon is ruff-clean)
  • tests/test_combinations.py::TestSubtemplateIdempotency
  • tests/test_content_type.py (global_allow paths)
  • tests/test_behavior.py (short-name registration + lookup)

MrTango added 2 commits May 27, 2026 11:47
- generated tree is ruff-clean out of the box (isort config + import fixes,
  drop unused imports, no shell=True in locales/update.py)
- ct tests honour global_allow=false (create a parent container that allows
  the type), and drop the unused factory/fti lookup
- i18n: MessageFactory in i18n.py (not __init__), zope_i18n_compile_mo_files
  in dev zope.conf + test layer, new language subtemplate for locale .po
  catalogs
- fix behavior test to look up the real registered IBehavior name
- github_organization option drives the generated project URLs
- track .pot, ignore only .mo
- tests: e2e ruff-clean generation, subtemplate idempotency, global_allow
Register the <plone:behavior> with an explicit name="<package>.<module>"
instead of relying on the full interface dotted path. The short name is a
stable identifier that survives moving or renaming the behavior module, and
the generated test looks the behavior up by that name.
@MrTango MrTango merged commit f2fb870 into main May 27, 2026
5 checks passed
@MrTango MrTango deleted the feature/green-i18n-scaffolding branch May 27, 2026 14:07
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