Skip to content

[Task]: Reorganize machine translation modules out of core.utils #4532

Description

@hannaseithe

⚙️ 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

  • Create integreat_cms/core/machine_translations/ package and move machine_translation_api_client.py, machine_translation_provider.py
  • Create integreat_cms/tasks/machine_translation/ package and move machine_translation_celery_task.py
  • Update all imports across the codebase
  • Verify tests pass

Acceptance Criteria

  • No MT-related files remain in integreat_cms/core/utils/
  • All imports updated and tests pass
  • integreat_cms/core/utils/ contains only genuinely generic utilities

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort: mediumShould be doable in <12hprio: lowNot urgent, can be resolved in the distant future.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions