Use hook_node_access()
to deny access to the not translated nodes and this will automatically hide the corresponding menu items:
mymodule.module:
use Drupal\Core\Access\AccessResult;
use Drupal\node\NodeInterface;
use Drupal\Core\Session\AccountInterface;
/**
* Implements hook_node_access().
*/
function mymodule_node_access(NodeInterface $node, $op, AccountInterface $account) {
$langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
if (!$node->hasTranslation($langcode)) {
$access = AccessResult::forbidden();
}
else {
$access = AccessResult::neutral();
}
$access->addCacheableDependency($node);
return $access;
}
You can be more specific, hide not translated nodes of specific content types. Or for specific user roles, which you probably need to do if other users than the admin wants to edit the nodes. Or you have to be specific about the operation $op. And test this with different user roles, as admin you won't see a difference, because this account passes all access checks.