Twentyfive-thousand people celebrated spirits at the Buda Castle

By: trademagazin Date: 2011. 05. 09. 10:44
🎧 Hallgasd a cikket:

VI. Budapest Spirit Festival has closed this year celebrations with a great gig by Karavan this spring. The event attracted more than 25 thousand visitors, open to getting the hang of plum-drinks and plum-based food. Premium spirits of 10 destillers created the Plum Spirit of the Year, selling half a thousand numbered bottles of the product

rateVal.textContent = (Number(rateInp.value)).toFixed(2) + "×"); // Nyelvdetektálás (egyszerű heurisztika HU/EN között) function detectLang(text){ const t = (text || "").toLowerCase(); const huAccents = (t.match(/[áéíóöőúüű]/g) || []).length; const huHits = ((t.match(/\b(és|hogy|nem|egy|van|volt|közleménye| szerint)\b/g)) || []).length; const enHits = ((t.match(/\b(the|and|of|to|in|for|with|on|as|is|are|this|that)\b/g)) || []).length; if (huAccents >= 4 || huHits >= 3) return "hu-HU"; if (enHits >= 4) return "en-US"; // fallback: vagy böngésző nyelve const htmlLang = (document.documentElement.lang || "").substr(0,2); if (/hu/i.test(htmlLang)) return "hu-HU"; if (/en/i.test(htmlLang)) return "en-US"; const nav = (navigator.language || "").substr(0,2); if (/hu/i.test(nav)) return "hu-HU"; return "en-US"; } function getTargetLang(){ const sel = langSel ? langSel.value : "auto"; if (sel && sel !== "auto") return sel; return detectLang(fullText); } function findBestVoice(langTag){ const vs = speechSynthesis.getVoices(); if (!vs || !vs.length) return null; // pontos nyelvkód let v = vs.find(x => x.lang === langTag); if (v) return v; // nyelv szerinti prefix const prefix = langTag.split("-")[0]; v = vs.find(x => x.lang && x.lang.toLowerCase().startsWith(prefix)); if (v) return v; // név alapján (magyar/english a névben) if (prefix === "hu") v = vs.find(x => /hungarian|magyar/i.test(x.name)); if (prefix === "en") v = vs.find(x => /english|us|uk|gb/i.test(x.name)); return v || vs[0] || null; } function splitIntoChunks(text, maxLen=1800) { const out = []; let buf = ""; const parts = text.split(/([.!?]+)\s+/); for (let i=0; i maxLen && buf) { out.push(buf.trim()); buf = sentence; } else { buf += " " + sentence; } } if (buf.trim()) out.push(buf.trim()); return out; } let chunks = splitIntoChunks(fullText); let idx = 0; let current = null; let selectedVoice = null; let targetLang = getTargetLang(); function buildUtterance(txt){ const u = new SpeechSynthesisUtterance(txt); u.lang = targetLang; if (!selectedVoice) selectedVoice = findBestVoice(targetLang); if (selectedVoice) u.voice = selectedVoice; u.rate = Math.max(0.7, Math.min(1.5, Number(rateInp ? rateInp.value : 1.05))); u.pitch = 1.0; u.onstart = () => { statusEl.textContent = "Felolvasás… ("+(idx+1)+"/"+chunks.length+") ["+targetLang+"]"; }; u.onend = () => { idx++; if (idx < chunks.length) { current = buildUtterance(chunks[idx]); speechSynthesis.speak(current); } else { statusEl.textContent = "Kész."; } }; u.onerror = () => { statusEl.textContent = "Hiba a felolvasás közben."; }; return u; } // A voice lista sokszor később érkezik meg speechSynthesis.onvoiceschanged = () => { targetLang = getTargetLang(); selectedVoice = findBestVoice(targetLang); }; btnPlay && btnPlay.addEventListener("click", () => { if (!fullText) { statusEl.textContent = "Nincs felolvasható szöveg."; return; } speechSynthesis.cancel(); idx = 0; targetLang = getTargetLang(); selectedVoice = findBestVoice(targetLang); chunks = splitIntoChunks(fullText); current = buildUtterance(chunks[idx]); speechSynthesis.speak(current); }); btnPause && btnPause.addEventListener("click", () => { if (speechSynthesis.speaking && !speechSynthesis.paused) { speechSynthesis.pause(); statusEl.textContent = "Szünet."; } }); btnResume && btnResume.addEventListener("click", () => { if (speechSynthesis.paused) { speechSynthesis.resume(); statusEl.textContent = "Folytatás…"; } }); btnStop && btnStop.addEventListener("click", () => { speechSynthesis.cancel(); statusEl.textContent = "Leállítva."; }); // Ha a felhasználó menet közben nyelvet vált langSel && langSel.addEventListener("change", () => { if (speechSynthesis.speaking) { speechSynthesis.cancel(); statusEl.textContent = "Nyelv váltva. Készen áll az új lejátszásra."; } }); })();

Related news