Skip to content

feat: add course translation feature#583

Merged
ahmed-arb merged 11 commits intodevelop-teakfrom
ahmed-arb/meta-translation
Jan 20, 2026
Merged

feat: add course translation feature#583
ahmed-arb merged 11 commits intodevelop-teakfrom
ahmed-arb/meta-translation

Conversation

@ahmed-arb
Copy link
Copy Markdown
Collaborator

@ahmed-arb ahmed-arb commented Dec 26, 2025

Meta Translation Support for edX Platform

This PR adds backend support for the meta-translation feature, enabling course authors to create and manage translated versions of courses. The changes include API enhancements, serializer updates, and proper handling of translation context across various Studio operations.

📁 File Changes

Core Module Store

  • xmodule/modulestore/mixed.py
    • Added logic to properly handle deletion of translated courses in the modulestore

REST API Serializers

  • cms/djangoapps/contentstore/rest_api/serializers/common.py

    • Added translation context field to common serializer base
  • cms/djangoapps/contentstore/rest_api/v1/serializers/settings.py

    • Added is_destination_course field to course settings serializer
  • cms/djangoapps/contentstore/rest_api/v1/serializers/vertical_block.py

    • Implemented is_destination_block field in vertical block children serializer to identify translated blocks
    • Enhanced serializer with translation context for course outline page
  • cms/djangoapps/contentstore/rest_api/v1/serializers/course_index.py

    • Added translation metadata to course index serializer for outline page API
  • cms/djangoapps/contentstore/rest_api/v1/serializers/home.py

    • Fixed missing translation information (base/translated course status) in Studio home API response
  • cms/djangoapps/contentstore/rest_api/v1/serializers/course_rerun.py

    • Enhanced course rerun serializer with translation metadata to support creating translated course reruns
  • cms/djangoapps/contentstore/rest_api/v2/serializers/home.py

    • Updated v2 home serializer with translation support for course listing

REST API Views

  • cms/djangoapps/contentstore/rest_api/v1/views/settings.py

    • Updated settings view to include destination course flag in API response
  • cms/djangoapps/contentstore/rest_api/v1/views/course_details.py

    • Migrated translation-aware logic to course details API view
  • cms/djangoapps/contentstore/rest_api/v2/views/home.py

    • Modified v2 home view to properly handle and send translation context

Core Views

  • cms/djangoapps/contentstore/views/course.py

    • Refactored course view to send translation context in appropriate API endpoints
    • Enhanced course operations with comprehensive translation context handling
    • Updated course rerun functionality to preserve translation relationships
  • cms/djangoapps/contentstore/views/preview.py

    • Added translation context to XBlock preview rendering for proper content display in translated courses

Utilities & Handlers

  • cms/djangoapps/contentstore/utils.py

    • Added utility functions for translation context management and validation
    • Resolved error when saving course details by fixing translation context handling
    • Enhanced with helper methods for checking and managing translation relationships
  • cms/djangoapps/contentstore/tasks.py

    • Updated async tasks to handle translation context properly during background operations
  • cms/djangoapps/contentstore/xblock_storage_handlers/view_handlers.py

    • Updated XBlock storage handlers to preserve translation relationships during content operations
    • Ensures translated blocks maintain proper linkage to base course blocks

🎯 Key Features

  • Translation-aware course operations: All course CRUD operations now respect translation context
  • API enhancements: Added is_destination_course and is_destination_block flags throughout REST APIs
  • Course rerun support: Create translated course reruns with proper metadata
  • Preview support: XBlock previews now render with correct translation context
  • Deletion handling: Safe deletion of translated courses with proper cleanup

🧪 Testing Recommendations

This PR should be tested with:

  1. Creating translated course reruns
  2. Viewing course outline with translated/base course flags
  3. Editing content in translated courses
  4. Deleting translated courses
  5. Previewing XBlocks in translated courses
  6. Studio home displaying translation metadata correctly

Related issue: #555

@ahmed-arb ahmed-arb force-pushed the ahmed-arb/meta-translation branch from 0680826 to cee5d92 Compare December 26, 2025 15:12
@ahmed-arb ahmed-arb marked this pull request as ready for review January 19, 2026 12:42
@ahmed-arb ahmed-arb requested a review from eemaanamir January 19, 2026 12:43
@ahmed-arb ahmed-arb merged commit c08d9b4 into develop-teak Jan 20, 2026
10 of 11 checks passed
@ahmed-arb ahmed-arb deleted the ahmed-arb/meta-translation branch January 20, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants