Maps remote languages to local languages.
Returns a list of local languages that can be mapped to any of the remote languages.
string[] $remote_languages: Remote language codes.
string[] Local language codes.
Overrides TranslatorInterface::mapToLocalLanguages
public function mapToLocalLanguages(array $remote_languages) {
$local_languages = array();
$remote_mappings = $this
->getPlugin()
->getDefaultRemoteLanguagesMappings();
foreach ($remote_languages as $language => $info) {
if (in_array($language, $remote_mappings)) {
$local_language = array_search($language, $remote_mappings);
$local_languages[$local_language] = $local_language;
}
else {
$local_languages[$language] = $this
->mapToRemoteLanguage($language);
}
}
foreach (\Drupal::languageManager()
->getLanguages() as $language => $info) {
$remote_language = $this
->mapToRemoteLanguage($language);
if (isset($remote_languages[$remote_language])) {
$local_languages[$language] = $language;
}
}
return $local_languages;
}