|
|
| ---<!DOCTYPE html> |
| <html lang="ha"> |
| <head> |
| <meta charset="UTF-8"> |
| <title>Mai Karanta Rubutun Hausa</title> |
| <style> |
| body { |
| font-family: Arial, sans-serif; |
| background-color: #f5f5f5; |
| text-align: center; |
| padding: 20px; |
| } |
| textarea { |
| width: 90%; |
| height: 200px; |
| font-size: 18px; |
| padding: 10px; |
| } |
| button { |
| font-size: 18px; |
| margin: 10px; |
| padding: 10px 20px; |
| cursor: pointer; |
| border-radius: 10px; |
| } |
| #playBtn { |
| background-color: green; |
| color: white; |
| } |
| </style> |
| </head> |
| <body> |
| <h1>Mai Karanta Rubutun Hausa</h1> |
| <textarea id="rubutu" placeholder="Shigar da rubutun Hausa anan..."></textarea><br> |
| <button id="playBtn" onclick="karantaRubutu()">Karanta da Murya</button> |
| |
| <script> |
| function karantaRubutu() { |
| const rubutu = document.getElementById("rubutu").value; |
| if (!rubutu.trim()) { |
| alert("Da farko shigar da rubutun Hausa."); |
| return; |
| } |
| |
| const msg = new SpeechSynthesisUtterance(rubutu); |
| msg.lang = 'ha'; // Hausa language code |
| msg.rate = 1; |
| msg.pitch = 1; |
| |
| // Fall-back: idan browser baya goyan bayan Hausa sosai |
| const supportedVoices = speechSynthesis.getVoices(); |
| const hausaVoice = supportedVoices.find(v => v.lang.startsWith('ha')); |
| if (hausaVoice) { |
| msg.voice = hausaVoice; |
| } |
| |
| speechSynthesis.speak(msg); |
| } |
| </script> |
| </body> |
| </html> |
| |
|
|