I am currently facing the problem of a disgusting problem on a large website with several languages. Upon arrival to the website, it determines which country you are in and invites you to confirm this. Upon confirmation, it reduces the languages โโof the pages from the database and displays the corresponding language. This is done using jQuery. Now the problem is that Arabic reads rtl, so I need to either:
- replace the stylesheets for the rtl version
or
- change the HTML tag and include the attribute "dir = 'rtl" arritribute
Now I tried both of them, with errors on both. When I look at the source of the page, it still shows the old Css file or HTML tag without the "dir" attribute. Correct me if I am mistaken, but I believe that this is due to the fact that the DOM does not register new changes, as they occurred asynchronously through jQuery after creating the DOM.
After all this blah blah and TL; DR;
Is there an easier way to dynamically change the direction of the text? If this is a DOM problem, how can I reload the DOM after an asynchronous callback?
I was in this issue for hours, and I was very lucky at interwebz.
Any help is appreciated and greatly appreciated.
Yours faithfully,
William francis
EDIT:
After much research, I found that the only way to truly work in Arabic is from the other side. Once the language has been selected, you do the postback, and then the process of changing the HREF style attribute from the code behind is simply simple. It seems that there is no form of JavaScript or jQuery that can change it without writing back and still reflect the new stylesheet. NOTE. You need to set the HREF style sheet for each post back, that is, through the main page. Stylsheet changes are not saved on different pages.
Here is a website that has helped a lot and explained a lot about styles using JavaScript. Unfortunately, this did not work for me.
http://www.alistapart.com/articles/alternate/