Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Aug 26, 2025

Overview

This PR implements a comprehensive automated translation system to address the long-standing need for maintaining translations in this repository. The system automatically translates English questions from src/questions/ into multiple target languages whenever changes are made.

Problem Solved

Previously, maintaining translations was a manual process that often led to:

  • Outdated translations when English questions were updated
  • Inconsistent formatting across language versions
  • Significant maintenance overhead for contributors
  • Delayed availability of new questions in non-English languages

Solution

🤖 AI-Powered Translation Engine

  • OpenAI GPT-4 Integration: Provides professional, technically accurate translations
  • Graceful Fallback: Works without API key using mock translations for testing
  • Context-Aware: Specialized prompts maintain technical terminology and interview tone

📁 Smart Question Processing

  • Multi-Format Support: Handles both bullet-point questions (* What is...) and coding questions (Question: What is...)
  • Code Preservation: Maintains code snippets, technical terms, and markdown formatting exactly
  • Nested Structure: Properly processes sub-questions and complex formatting

🛠 Developer Experience

# Translate all configured languages
npm run translate:all

# Translate specific language  
npm run translate spanish

# View available languages
npm run translate

🔄 CI/CD Automation

  • Auto-Trigger: GitHub workflow runs when src/questions/**/*.md files change
  • Manual Control: Workflow dispatch for translating specific languages
  • Smart Commits: Only commits when translations actually change

Architecture

The system follows a clean separation pattern:

English Questions (src/questions/*.md) 
    ↓
Translation Script (scripts/translate.js)
    ↓  
Combined Language Files (src/translations/{lang}/README.md)

Individual English question files are processed and combined into comprehensive language-specific README files that match the existing translation format.

Configuration

Languages are configured in scripts/translation-config.json with:

  • Translated titles and section headers
  • Language codes and RTL support
  • AI translation settings

Currently configured languages: Spanish, French, Chinese, German, Italian (easily extensible).

Backwards Compatibility

  • ✅ Existing translations remain unchanged
  • ✅ Build system continues to work identically
  • ✅ Site structure and URLs preserved
  • ✅ No breaking changes to current workflow

Testing

The system has been thoroughly tested with:

  • Mock translations to verify structure and formatting
  • Build system integration to ensure compatibility
  • Multiple question formats (general, coding, nested)
  • Error handling and fallback scenarios

Documentation

Comprehensive documentation added in scripts/README.md covering:

  • Setup and usage instructions
  • Adding new languages
  • Technical architecture
  • CI/CD integration examples

This automated translation system will significantly reduce maintenance overhead while ensuring all international users have access to the latest interview questions in their preferred language.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] there's been a long-standing desire to automate translations in this repo. The english language questions are separated out in the ./src/questions folder and whenever there is a change to the english language question I want to build a newly translated... Add automated translation system for multilingual question maintenance Aug 26, 2025
Copilot finished work on behalf of roblarsen August 26, 2025 02:58
@Copilot Copilot AI requested a review from roblarsen August 26, 2025 02:58
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.

2 participants