WHMCS in MultiLanguage WP site

The website is in English and Arabic. I would like to have the WHMCS page translated to arabic whenever people select the Arabic flag on the website header and by not using the language select bar of WHCMS plugin. How can I do it?

  • Patrick
    • Support Monkey

    Hi @th3ray

    Welcome to the forums!

    WHMCS comes with a number of languages by default: http://docs.whmcs.com/Language_Files

    You can enable language switching In your WHMCS install in the General Settings.

    But I'm afraid I'm not sure how this could be integrated with the way you have your site set up. You would likely need a custom function to trigger the Arabic language file from WHMCS if the requested URL begins with host-falcon.com/ar/

    But there may be an easier way. I'll see if I can get the plugin developer to provide some insight into this. Hang on...

  • Arnold
    • El Macho WP

    You can switch the language by including a query parameter to the url.

    ?language=Arabic

    This is on the Remote host url so you'll need to do a bit of Custom coding to get it to switch the way you want. If you look around line 1022 there's a line

    $result = $this->load_whmcs_url($this->settings['remote_host'] . '?systpl=portal');

    You would need to change it to

    $result = $this->load_whmcs_url($this->settings['remote_host'] . '?systpl=portal&language=arabic');

    When you wanted it to display Arabic. I'll probably put a hook there in a future version.

    Note that this sets a cookie to remember the language setting so it won't change back until you send it a language=english for that user or the cookie expires.

  • Arnold
    • El Macho WP

    To externalize the line oyu need to change Change it to

    $result = $this->load_whmcs_url($this->settings['remote_host'] . apply_filters('whmcs_get_args', '?systpl=portal') );

    Now you can add a filter to your functions file.

    add_filter('whmcs_get_args', 'change_language');
    
    function change_language($content){
    
      //Check your flags and decide which language
      if($Arabic) return '?language=arabic';
    
      return '?language=english';
    }

    This will be added to the next version

  • th3ray
    • New Recruit

    Thanks Patrick and Arnold for the very quick response. :smiley:

    I would like to know which file are you referring to when you mentioned line 1022. Is it with whmcs integration file? If yes, I can't see that exact code in that line.

  • th3ray
    • New Recruit

    I tried using the code below and it worked. However, when I click on inner pages such as announcements and order it gets back to default language, which is english.

    if (get_bloginfo('language') == "ar" ){
    $result = $this->load_whmcs_url($this->settings['remote_host'] . '?language=arabic');
    }
    else{
    $result = $this->load_whmcs_url($this->settings['remote_host']);// . '?systpl=portal');
    }

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.