Direction is stored, not guessed
A table keyed on "ar, he, fa, ur" is a list that is wrong for somebody: Kurdish is written left to right in Turkey and right to left in Iraq, and Azerbaijani has been written both ways within living memory. So each language row carries its own direction, and the interface mirrors from that.