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:
And if you still want to go with customising it yourself, here is the documentation for module/theme developers:
X-Cart 5.3 uses Twig as its template engine, so this resource can help too: