RTL and LTR Layout

Hi there, i have an application with layout direction right to left for arabic and left to right for english and i solve the text content using this :

but i need to switch between layout direction rtl and ltr depending on language how can i do it ?

Can you show some code what you’ve tried so far? We need something to look at to provide any sensible solution.