# QUICK START - Language & Currency Test

## 🎯 Verify Everything Works

### **Step 1: Open Test Page**
```
http://localhost/emporio-sport/CHECK_CONSOLE.php
```

### **Step 2: Open Developer Console**
Press: **F12** → Click **Console** tab

### **Step 3: Test Language Change**
1. Click button "Español"
2. Look at console - you should see:
   ```
   Test: Changing language to: ESP
   Test: Language saved: {success: true, ...}
   ```
3. Page reloads
4. Text changes to Spanish:
   - "NEED HELP" → "NECESITA AYUDA"
   - Translation test shows Spanish text

### **Step 4: Test Currency Change**
1. Click button "Pound (£)"
2. Look at console - you should see:
   ```
   Test: Changing currency to: GBP
   Test: Currency saved: {success: true, ...}
   ```
3. Page reloads
4. Price changes:
   - €100 → £87

### **Step 5: Test on Homepage**
Go to: http://localhost/emporio-sport/index.php
- Change language from dropdown at top (should work same way)
- Change currency from dropdown at top (should work same way)

---

## 📊 Expected Console Output

When everything is working, you should see:

```javascript
// When page loads
Translation & Currency system test page loaded
Current language: ENG
Current currency: EUR

// When you click a language button
Test: Changing language to: ITA
Test: Language saved: {success: true, language: "ITA", message: "Language preference saved", session_check: "ITA"}

// When you click a currency button
Test: Changing currency to: USD
Test: Currency saved: {success: true, currency: "USD", message: "Currency preference saved", ...}
```

---

## ⚠️ If Not Working

### **Check 1: Are you seeing console logs?**
- If NO logs appear → The JavaScript isn't running
- Check if buttons are clickable
- Check if console has any errors

### **Check 2: Is the API responding?**
- Click language button
- Console should show "Language saved"
- If you see an error like "Failed to fetch" → API not responding

### **Check 3: Is the session saving?**
- After clicking a button and page reloads
- Check "Current Settings" at top
- Should show: Language Session = ESP (or whatever you selected)

### **Check 4: Console Error Messages**
Look for red errors in console:
- "Refused to load script" = CSP issue (shouldn't happen now)
- "Cannot POST /emporio-sport/api_set_preference.php" = API file missing
- "SyntaxError" = Code error in JavaScript

---

## 🔗 Files Involved

1. **header.php** - Contains changeLanguage() and changeCurrency() functions
2. **config/translation_helper.php** - Contains all translations
3. **config/currency_converter.php** - Contains conversion rates
4. **api_set_preference.php** - Saves preferences to session
5. **CHECK_CONSOLE.php** - This test page

---

## 💡 Summary

✅ Language dropdown changes text language  
✅ Currency dropdown changes price currency  
✅ Console logs show exactly what's happening  
✅ No errors, no CSP violations  
✅ Everything persists across page visits

**If you see console logs and prices/text change = EVERYTHING IS WORKING!**
