Accent Type to Region Identifier

This tool helps identify regions commonly associated with various English accent types. Please note that **accents are complex and diverse**, and these are broad generalizations. There's significant variation within regions!

Select an accent from the dropdown and click "Identify Region".

This accent is primarily associated with the following region(s):

    `; accent.regions.forEach(region => { resultHtml += `
  • ${region}
  • `; }); resultHtml += `

Notes: ${accent.notes}

`; regionResultDisplay.innerHTML = resultHtml; lastIdentifiedAccent = accent; // Store for PDF downloadPdfBtn.disabled = false; downloadPdfBtn.style.opacity = '1'; } async function downloadPdfResult() { if (lastIdentifiedAccent === null) { alert("Please select an accent and identify its region first before downloading the PDF."); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); // Set background color doc.setFillColor(PDF_COLORS.background); doc.rect(0, 0, doc.internal.pageSize.width, doc.internal.pageSize.height, 'F'); // Title doc.setFont('helvetica', 'bold'); doc.setFontSize(22); doc.setTextColor(PDF_COLORS.primaryAccent); doc.text('Accent Type & Region Report', doc.internal.pageSize.width / 2, 30, { align: 'center' }); // Info Note doc.setFont('helvetica', 'normal'); doc.setFontSize(10); doc.setTextColor(PDF_COLORS.text); doc.setFillColor(PDF_COLORS.infoBg); doc.setDrawColor(PDF_COLORS.infoBorder); doc.rect(15, 40, doc.internal.pageSize.width - 30, 15, 'FD'); doc.text('This report provides information about the selected accent and its common regions.', doc.internal.pageSize.width / 2, 49, { align: 'center' }); // Accent Name doc.setFont('helvetica', 'bold'); doc.setFontSize(18); doc.setTextColor(PDF_COLORS.secondary); let yPos = 70; doc.text(`Accent Type: ${lastIdentifiedAccent.name}`, 20, yPos); yPos += 20; // Associated Regions doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor(PDF_COLORS.text); doc.text('Associated Region(s):', 20, yPos); yPos += 10; doc.setFont('helvetica', 'normal'); doc.setFontSize(12); lastIdentifiedAccent.regions.forEach(region => { doc.text(`- ${region}`, 25, yPos); yPos += 7; }); yPos += 15; // Notes doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor(PDF_COLORS.text); doc.text('Notes:', 20, yPos); yPos += 10; doc.setFont('helvetica', 'normal'); doc.setFontSize(12); // jspdf's text function supports auto-wrapping with maxWidth doc.text(lastIdentifiedAccent.notes, 25, yPos, { maxWidth: doc.internal.pageSize.width - 50, align: 'left' }); yPos += doc.splitTextToSize(lastIdentifiedAccent.notes, doc.internal.pageSize.width - 50).length * 7; // Estimate lines for next yPos // Footer doc.setFontSize(10); doc.setTextColor(PDF_COLORS.text); doc.text(`Generated on: ${new Date().toLocaleDateString()} at ${new Date().toLocaleTimeString()}`, doc.internal.pageSize.width / 2, doc.internal.pageSize.height - 20, { align: 'center' }); doc.save(`${lastIdentifiedAccent.name.toLowerCase().replace(/ /g, '-')}-region-report.pdf`); } // --- Event Listeners --- identifyBtn.addEventListener('click', identifyRegion); accentSelect.addEventListener('change', () => { // Clear error and reset display when selection changes accentError.textContent = ''; regionResultDisplay.innerHTML = 'Select an accent from the dropdown and click "Identify Region".'; downloadPdfBtn.disabled = true; downloadPdfBtn.style.opacity = '0.6'; lastIdentifiedAccent = null; }); downloadPdfBtn.addEventListener('click', downloadPdfResult); // Initial state: PDF button disabled downloadPdfBtn.disabled = true; downloadPdfBtn.style.opacity = '0.6';
Scroll to Top