How to make menu country specific?

Is there a way to tell which country you are in when viewing the site? I mean like is the domain name example.uk | example.ca | example.com/en … That kinda thing?

Then you could search your domain for the string for that country:

$protocol = stripos($_SERVER['SERVER_PROTOCOL'],'https') === true ? 'https://' : 'http://';
$url = $protocol . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];

if (strpos($url,'/en/') !== false) {
    echo 'English version';
} else if (strpos($url,'/us/') !== false) {
    echo 'US version';
} else {
    echo 'Not UK or US Version';
}

tech