I am looking to create a website that can support both left-to-right (LTR) and right-to-left (RTL) languages seamlessly.
My goal is to have the text direction switch automatically to RTL if the content is in an RTL language. Additionally, I want the input fields to detect RTL input from the user and adjust the text direction accordingly.
This functionality is similar to what Facebook does, where typing Arabic text in the search bar switches the direction to RTL automatically.
I have tried searching for tutorials or scripts on how to achieve this online but haven't come across anything practical yet.
I did find the attribute dir="auto"
, which should trigger the correct direction automatically, but it seems like older browsers may not support it.
If anyone has any advice, tutorials, or scripts on how to implement this feature, I would greatly appreciate it.