<?php 
 
if(!isset($_SESSION["logaty_detected_language"])) 
{ 
    $detect = new \PHPtricks\Logaty\Detect(); 
 
    if(config("options/detect_country_lang")) 
    { 
        $language = $detect->country(); 
        if($language != currentLang()) 
        { 
            // do what you want 
            // you can redirect him to his language version 
            // or any thing you want 
            // for example here I want to show him a message 
 
            // check if his language is supported and enabled 
            if(in_array($language, enabledLanguagesList())) 
            { 
                // show him  a message or redirect 
            } 
        } 
    } 
    elseif (config("options/detect_browser_lang")) 
    { 
        $language = $detect->browser(); 
        if($language != currentLang()) 
        { 
            // do what you want 
            // you can redirect him to his language version 
            // or any thing you want 
            // for example here I want to show him a message 
 
            // check if his language is supported and enabled 
            if(in_array($language, enabledLanguagesList())) 
            { 
                // show him  a message or redirect 
            } 
 
        } 
    } 
 
    $_SESSION["logaty_detected_language"] = true; 
}
 
 |