Accessing translation and language URL from hook_preprocess_menu() I have setup language and translation in Drupal8 that affects my URL for example

myurl.com/ru
myurl.com/us
myurl.com/fr


What I need to do if find out which country is being accessed so I can add a variable to the twig theme layer

This is the hook that is working fine

/**
 * Implements hook_preprocess_HOOK() for menu.html.twig.
 */
function pnc_preprocess_menu(&amp;$variables) {
    $code_to_access_language_url = 'this is a test';
    kint($variables);
    $variables['access_translation'] = $code_to_access_language_url;
    //print $code_to_access_language_url;exit;
}


I have found that under kint() there a lot of public methods for  translation but I am not sure how I access them or which one to access. I know I could regex the url, but there has to be a cleaner way to do it?
I found the answer myself.

if($variables['menu_name'] == 'navigation') {     
  $langcode = \Drupal::languageManager()-&gt;getCurrentLanguage()-&gt;getName();
  // Add the logic here.
}