private function getMetaLanguage(): string {
        $lang = '';

        $el = $this->article()->getDoc()->find('html[lang]');

        if ($el->count()) {
            $lang = $el->first()->attr('lang');
        }

        if (empty($lang)) {
            $selectors = [
                'html > head > meta[http-equiv=content-language]',
                'html > head > meta[name=lang]',
            ];

            foreach ($selectors as $selector) {
                $el = $this->article()->getDoc()->find($selector);

                if ($el->count()) {
                    $lang = $el->first()->attr('content');
                    break;
                }
            }
        }

        if (preg_match('@^[A-Za-z]{2}$@', $lang)) {
            return strtolower($lang);
        }

        return '';
    }
private function getMetaLanguage(): string {
        $lang = '';

        $el = $this->article()->getDoc()->find('html[lang]');

        if ($el->count()) {
            $lang = $el->first()->attr('lang');
        }

        if (empty($lang)) {
            $selectors = [
                'html > head > meta[http-equiv=content-language]',
                'html > head > meta[name=lang]',
            ];

            foreach ($selectors as $selector) {
                $el = $this->article()->getDoc()->find($selector);

                if ($el->count()) {
                    $lang = $el->first()->attr('content');
                    break;
                }
            }
        }

        if (preg_match('@^[A-Za-z]{2}$@', $lang)) {
            return strtolower($lang);
        }

        return '';
    }
private function getMetaLanguage ( ) : string { $ lang = '' ; $ el = $ this -> article ( ) -> getDoc ( ) -> find ( 'html[lang]' ) ; if ( $ el -> count ( ) ) { $ lang = $ el -> first ( ) -> attr ( 'lang' ) ; } if ( empty ( $ lang ) ) { $ selectors = [ 'html > head > meta[http-equiv=content-language]' , 'html > head > meta[name=lang]' , ] ; foreach ( $ selectors as $ selector ) { $ el = $ this -> article ( ) -> getDoc ( ) -> find ( $ selector ) ; if ( $ el -> count ( ) ) { $ lang = $ el -> first ( ) -> attr ( 'content' ) ; break ; } } } if ( preg_match ( '@^[A-Za-z]{2}$@' , $ lang ) ) { return strtolower ( $ lang ) ; } return '' ; }
If the article has meta language set in the source, use that

@return string
If the article has meta language set in the source use that