curaflow/backend/i18n.js

60 lines
5.0 KiB
JavaScript

/**
* i18n: Translation manager for Curio WhatsApp Bot.
* Supports English (en), Hindi (hi), and Telugu (te).
*/
const translations = {
en: {
welcome: "Welcome to Dr. Sharma's Clinic! 🏥 I can help you book a token or check your status.\n\nWould you like to:",
book: "Book for Today",
book_future: "For future bookings, please call our reception at +91-1234567890 📞",
check: "Check Queue Status",
tips: "Daily Health Tips",
select_slot: "Great! Please select your preferred time slot:",
triage_ask: "✅ Confirmed! Your token is *{{token}}*.\n\nTo help Dr. Sharma prepare, could you briefly describe your symptoms?",
triage_done: "Got it. I've shared these details with Dr. Sharma. See you soon! 🏥",
status_update: "Current Status: \n📍 Doctor is seeing: #{{current}}\n⏳ Your position: #{{pos}}\n🚀 Estimated wait: {{wait}} mins."
},
hi: {
welcome: "डॉ. शर्मा के क्लिनिक में आपका स्वागत है! 🏥 मैं टोकन बुक करने या आपकी स्थिति की जांच करने में आपकी मदद कर सकता हूँ।\n\nक्या आप चाहेंगे:",
book: "आज के लिए बुक करें",
book_future: "भविष्य की बुकिंग के लिए, कृपया हमारे रिसेप्शन पर +91-1234567890 पर कॉल करें 📞",
check: "कतार की स्थिति जांचें",
tips: "स्वास्थ्य युक्तियाँ",
select_slot: "बहुत बढ़िया! कृपया अपना पसंदीदा समय स्लॉट चुनें:",
triage_ask: "✅ पुष्टि हो गई! आपका टोकन *{{token}}* है।\n\nडॉ. शर्मा को तैयारी में मदद करने के लिए, क्या आप अपने लक्षणों का संक्षेप में वर्णन कर सकते हैं?",
triage_done: "समझ गया। मैंने ये विवरण डॉ. शर्मा के साथ साझा कर दिए हैं। जल्द मिलते हैं! 🏥",
status_update: "वर्तमान स्थिति: \n📍 डॉक्टर देख रहे हैं: #{{current}}\n⏳ आपकी स्थिति: #{{pos}}\n🚀 अनुमानित प्रतीक्षा: {{wait}} मिनट।"
},
te: {
welcome: "డాక్టర్ శర్మ క్లినిక్‌కి స్వాగతం! 🏥 టోకెన్ బుక్ చేసుకోవడంలో లేదా మీ స్థితిని తనిఖీ చేయడంలో నేను మీకు సహాయపడగలను.\n\nమీరు వీటిని చేయాలనుకుంటున్నారా:",
book: "ఈరోజు కోసం బుక్ చేయండి",
book_future: "భవిష్యత్తు బుకింగ్‌ల కోసం, దయచేసి మా రిసెప్షన్‌కు +91-1234567890 నంబర్‌కు కాల్ చేయండి 📞",
check: "క్యూ స్థితిని తనిఖీ చేయండి",
tips: "ఆరోగ్య చిట్కాలు",
select_slot: "అద్భుతం! దయచేసి మీకు నచ్చిన సమయాన్ని ఎంచుకోండి:",
triage_ask: "✅ ధృవీకరించబడింది! మీ టోకెన్ *{{token}}*.\n\nడాక్టర్ శర్మ సిద్ధం కావడానికి సహాయపడటానికి, మీరు మీ లక్షణాలను క్లుప్తంగా వివరించగలరా?",
triage_done: "అర్థమైంది. నేను ఈ వివరాలను డాక్టర్ శర్మతో పంచుకున్నాను. త్వరలో కలుద్దాం! 🏥",
status_update: "ప్రస్తుత స్థితి: \n📍 డాక్టర్ చూస్తున్నారు: #{{current}}\n⏳ మీ స్థానం: #{{pos}}\n🚀 అంచనా వేచి ఉండే సమయం: {{wait}} నిమిషాలు."
}
};
class I18nManager {
t(lang, key, params = {}) {
let text = translations[lang] ? translations[lang][key] : translations['en'][key];
for (const [pKey, pVal] of Object.entries(params)) {
text = text.replace(`{{${pKey}}}`, pVal);
}
return text;
}
getButtons(lang) {
const t = translations[lang] || translations['en'];
return [t.book, t.book_future, t.check, t.tips];
}
}
module.exports = new I18nManager();