A simple "if" won't be enough. To get a complete RTL website you are to implement a lot of changes.
That's why there is this module:
https://market.x-cart.com/addons/standard-rtl-skin.html
And if you still want to go with customising it yourself, here is the documentation for module/theme developers:
http://devs.x-cart.com/
X-Cart 5.3 uses Twig as its template engine, so this resource can help too:
http://twig.sensiolabs.org/