How to detect text language with jQuery and XRegExp to display mixed RTL and LTR text correctly
问题 I'm trying to display a Twitter feed in a WordPress site. My client tweets in English and in Arabic and sometimes in a combination of the two languages. I need to detect the language and add the class 'rtl' to Arabic tweets and also those tweets where the content is predominately in Arabic. I'm using a plugin which strips the Twitter iso_language_code metadata. When attempting this on a previous development site a few years ago, I remember successfully using a variation of Tristan's solution