jquery - Display dynamically generated text LTR or RTL depending on language? -


i have tricky scenario i'm dealing while working on site client. website building has english version , arabic version. arabic version of site, of course, displayed right-to-left, since arabic read right-to-left.

i have built jquery twitter app index page of both english , arabic versions. requirement client wants able use 1 twitter account , tweet in both english , arabic. creates problem because in twitter ul, need simultaneously display english , arabic text, without knowing language expect. therefore need way detect language of tweets (retrieved jsonp) , adjust text direction of each li.

can think of way this? suggestions.

the twitter api (https://dev.twitter.com/docs/api/1.1/get/search/tweets) shows metadata contains "iso_language_code":

  "metadata": {     "iso_language_code": "en",     "result_type": "recent"   }, 

with this, can check "iso_language_code" "en" or "ar" , format content accordingly.

e.g.

<li lang="en">english text</li> <li lang="ar" dir="rtl">arabic text</li> 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -