Google\Cloud\Translate\TranslateClient::detectLanguage PHP Method

detectLanguage() public method

Example: $result = $translate->detectLanguage('Hello world!'); echo $result['languageCode'];
See also: https://cloud.google.com/translate/v2/detecting-language-with-rest Detecting Langauge
public detectLanguage ( string $string, array $options = [] ) : array
$string string The string to detect the language of.
$options array [optional] { Configuration Options. @type string $format Indicates whether the string is either plain-text or HTML. Acceptable values are `html` or `text`. **Defaults to** `"html"`. }
return array A result including a `languageCode` key containing the detected ISO 639-1 language code, an `input` key containing the original string, and in most cases a `confidence` key containing a value between 0 - 1 signifying the confidence of the result.
    public function detectLanguage($string, array $options = [])
    {
        return $this->detectLanguageBatch([$string], $options)[0];
    }