import json

translations = {
    "Which pronoun do you use to point to multiple objects that are far away from you?": "¿Qué pronombre usas para señalar múltiples objetos que están lejos de ti?",
    "Which sentence represents a grammatically perfect combination of all A1.1 rules?": "¿Qué oración representa una combinación gramaticalmente perfecta de todas las reglas del A1.1?",
    "Which is the correct way to express that two chairs exist in the classroom?": "¿Cuál es la forma correcta de expresar que hay dos sillas en el salón de clases?",
    "Which verb form completes the sentence: 'My mother ___ blue eyes'?": "¿Qué forma verbal completa la oración: 'Mi madre ___ ojos azules'?",
    "Which possessive adjective do you use to show that something belongs to a female (she)?": "¿Qué adjetivo posesivo usas para indicar que algo pertenece a una mujer (she)?",
    "What is the grammatically correct question to ask someone's country of origin?": "¿Cuál es la pregunta gramaticalmente correcta para preguntar el país de origen de alguien?",
    "How do you translate 'El carro de mi hermano' into English?": "¿Cómo traduces 'El carro de mi hermano' al inglés?",
    "What is the correct plural form of the word 'sandwich'?": "¿Cuál es la forma plural correcta de la palabra 'sandwich'?",
    "What does 'Last Name' mean on a registration form?": "¿Qué significa 'Last Name' en un formulario de registro?",
    "Which preposition is used correctly with a complete date like 'October 15th'?": "¿Qué preposición se usa correctamente con una fecha completa como 'October 15th'?",
    "Which greeting is used specifically to say goodbye or go to sleep?": "¿Qué saludo se usa específicamente para despedirse o ir a dormir?",
    "What is the correct affirmative pronoun + verb match for 'We'?": "¿Cuál es la combinación afirmativa correcta de pronombre + verbo para 'We'?",
    "How do you correctly state your age in English?": "¿Cómo dices correctamente tu edad en inglés?",
    "Which sentence correctly uses the indefinite article for occupations?": "¿Qué oración usa correctamente el artículo indefinido para las ocupaciones?",
    "Which is the correct negative sentence structure?": "¿Cuál es la estructura correcta para oraciones negativas?",
    "Choose the correct verb to complete: 'The children ___ in the park.'": "Elige el verbo correcto para completar: 'The children ___ in the park.'"
}

with open('modules/a1-1/data/lessons.json', 'r') as f:
    data = json.load(f)

for lesson in data.get('lessons', []):
    for ex in lesson.get('exercises', []):
        if ex.get('type') == 'multiple_choice_text':
            q = ex.get('question', '')
            if q in translations:
                ex['question_es'] = translations[q]

with open('modules/a1-1/data/lessons.json', 'w') as f:
    json.dump(data, f, indent=4, ensure_ascii=False)

print("Translations added successfully.")
