Is there a way to stylize text on an HTML page such that it automatically uses a different font for different languages? My website uses both English and Arabic. I\'d like t
below function will wrap the different languages with in a span create .en and .ar css classes with respective font
function formatString(string) {
var output = "";
var ar_start = parseInt("0x00600", 16);
var ar_end = parseInt("0x006FF", 16);
var currentLang = "en";
for (var i=0; i ar_start && code < ar_end){
if (currentLang != "ar"){
currentLang = "ar";
output += " "
}
}else{
if (currentLang != "en"){
currentLang = "en";
output += ""
}
}
}
output += string.charAt(i);
}
}
return (output);
}