public localizedLanguages ( array $options = [] ) : array | ||
$options | array | [optional] { Configuration Options. @type string $target The language to discover supported languages for. Must be a valid ISO 639-1 language code. **Defaults to** the value assigned to the client (`"en"` by default). } |
return | array | A set of language results. Each result includes a `code` key containing the ISO 639-1 code for the supported language and a `name` key containing the name of the language written in the target language. |
public function localizedLanguages(array $options = [])
{
$response = $this->connection->listLanguages($options + ['key' => $this->key, 'target' => $this->targetLanguage]);
return array_map(function ($language) {
return array_filter(['code' => $language['language'], 'name' => isset($language['name']) ? $language['name'] : null]);
}, $response['data']['languages']);
}