πΊπΈUnited States dkmartin
A bit old but I was able to solve this problem using the t function:
foreach ($languages as $id => $language) {
$links[] = [
'text' => t($language->getName(), [], ['langcode' => $langcode]),
];
}