Support » Plugin: Widget Logic » PHP Logic Script with check Browser Language

  • Hi, I’m trying to find a way to show widgets depending on the Users Browser Language. I tried seveal things but nothing worked. Do you have any idea?
    here is an example I tried:

    if (($lang==”en_EN”) OR ($lang==”en-EN”) OR ($lang==”de_CH”) OR ($lang==”de-CH”) OR ($lang==”de_DE”) OR ($lang==”de-DE”)) {
    return true;
    }else {
    return false;
    }

    • This topic was modified 5 months, 3 weeks ago by pb75.
    • This topic was modified 5 months, 3 weeks ago by pb75.
Viewing 1 replies (of 1 total)
  • I got it!! Yeah! Here’s the code:

    $http_lang = substr($_SERVER[“HTTP_ACCEPT_LANGUAGE”],0,5);
    switch ($http_lang) {
    case ‘de-CH’:
    return true;
    break;
    case ‘de-ch’:
    return true;
    break;
    default:
    return false;
    }

    • This reply was modified 5 months, 3 weeks ago by pb75.
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.