⚙️ Task
Task Description
What
Move machine translation code out of integreat_cms.core.utils into purpose-specific packages. utils modules tend to become kitchen sinks; the name implies small, widely-applicable helpers, not domain logic.
Proposed structure (suggested by @andrew8er in review of #4504):
integreat_cms.core.machine_translations — base types and API client logic:
machine_translation_api_client.py
machine_translation_provider.py
integreat_cms.tasks — all code that runs in a task queue (Celery):
integreat_cms.tasks.machine_translation — async translation tasks:
machine_translation_celery_task.py
For future consideration:
integreat_cms.tasks.chat_bot should contain chat_bot.py (originally from integreat_cms.api.v3.chat.utils)
Why
Improve codebase navigability and enforce structural conventions. core.utils should be the last resort for code that genuinely has no better home — not the default location for new domain logic.
Steps / Implementation Plan
Acceptance Criteria
Technical Details
Affected Systems / Services
integreat_cms Django application
Files / Modules
integreat_cms/core/utils/machine_translation_api_client.py
integreat_cms/core/utils/machine_translation_celery_task.py
integreat_cms/core/utils/machine_translation_provider.py (if exists)
- All files importing from the above
Parent / Related issue and Work
⚙️ Task
Task Description
What
Move machine translation code out of
integreat_cms.core.utilsinto purpose-specific packages.utilsmodules tend to become kitchen sinks; the name implies small, widely-applicable helpers, not domain logic.Proposed structure (suggested by @andrew8er in review of #4504):
integreat_cms.core.machine_translations— base types and API client logic:machine_translation_api_client.pymachine_translation_provider.pyintegreat_cms.tasks— all code that runs in a task queue (Celery):integreat_cms.tasks.machine_translation— async translation tasks:machine_translation_celery_task.pyFor future consideration:
integreat_cms.tasks.chat_botshould containchat_bot.py(originally fromintegreat_cms.api.v3.chat.utils)Why
Improve codebase navigability and enforce structural conventions.
core.utilsshould be the last resort for code that genuinely has no better home — not the default location for new domain logic.Steps / Implementation Plan
integreat_cms/core/machine_translations/package and movemachine_translation_api_client.py,machine_translation_provider.pyintegreat_cms/tasks/machine_translation/package and movemachine_translation_celery_task.pyAcceptance Criteria
integreat_cms/core/utils/integreat_cms/core/utils/contains only genuinely generic utilitiesTechnical Details
Affected Systems / Services
integreat_cmsDjango applicationFiles / Modules
integreat_cms/core/utils/machine_translation_api_client.pyintegreat_cms/core/utils/machine_translation_celery_task.pyintegreat_cms/core/utils/machine_translation_provider.py(if exists)Parent / Related issue and Work