how to change the input text orientation based on locale language?

i want to change the text orientation based on local language as if the locale language is arabic , want text orientation to be from right to left while if the local language is english , want the text orientation to be from left to right ,