Jump to content

A reliable way to load code if a RTL language is selected?


zomex

Recommended Posts

Hello everyone,

 

After trying myself and contacting WHMCS support I'm unable to find a reliable way to load specific code if a RTL (right to left) language is selected such as Arabic & Hebrew (in all circumstances).

 

Using Arabic as as example he's my attempt and WHMCS's:

 

My attempt:

 

{if $language eq 'arabic'}<link rel="stylesheet" type="text/css" href="templates/{$template}/css/rtl.css" />{/if}

 

WHMCS' attempt:

 

{if $language eq 'english'}
{else}
<link rel="stylesheet" type="text/css" href="templates/{$template}/css/rtl.css" />
{/if}

 

As you can see this code is being used to load a CSS file that aligns the text to the right and mirrors images. The code works perfectly in the following situations:

 

- when English is the default language

- when Arabic is selected using the language dropdown

 

However it doesn't work when Arabic is set to the default language. Does anyone know a way around this? It'll be much appreciated.

 

Thanks,

Jack

Link to comment
Share on other sites

Thanks for your reply.

 

WHMCS have replied to my ticket with code which worked. Basically the key is to add the variable to the language files and load it that way instead of using the main language variable:

 

{if $LANG.textdirection eq "rtl"}<link rel="stylesheet" type="text/css" href="templates/{$template}/css/rtl.css" />{/if}

 

I did originally try this before but I must have had a typo in the variable name.

 

Thanks,

Jack

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated