I\'m interested in setting some text into a UILabel
, and depending on the directionality of the language (e.g., Hebrew - right-to-left [RTL], English - left-to-righ
In HTML5 this can be done by applying dir="auto" to the element. It's implemented in WebKit, though I'm not completely sure that it's available in iOS.
dir="auto" is very simple, and you can probably implement it yourself - just search for the first character that has strong directionality, and apply its directionality to the whole thing.
If you can't find anything in iOS, you can try to take some smarter ideas from the way StatusNet implemented it: http://status.net/sites/default/files/issues/1346_jquery.directionDetector.js