Spellchecks an array of words.

@param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
@param Array $words Array of words to check.
@return Array of misspelled words.
502189
function &checkWords($lang, $words) {
		$r = enchant_broker_init();
		
		if (enchant_broker_dict_exists($r,$lang)) {
			$d = enchant_broker_request_dict($r, $lang);
			
			$returnData = array();
			foreach($words as $key => $value) {
				$correct = enchant_dict_check($d, $value);
				if(!$correct) {
					$returnData[] = trim($value);
				}
			}
	
			return $returnData;
			enchant_broker_free_dict($d);
		} else {

		}
		enchant_broker_free($r);
	}
1023735
public static function setLanguage($lang)
    {
        static::$_appLanguage = Yii::$app->language;

        Yii::$app->language = $lang;
    }
378753
protected function checkLanguage($language)
    {
        $full_language = mb_strtolower($language);
        $lang = substr($full_language, 0, 2);
        if ($lang == 'jp') {
            $lang = 'ja';
        } elseif ($lang == 'pt') {
            $lang = 'pt_BR';
        } elseif ($lang == 'ug') {
            $lang = 'ug_CN';
        } elseif ($lang == 'zh') {
            $lang = ($full_language == 'zh-tw' || $full_language == 'zh_tw') ? 'zh_TW' : 'zh_CN';
        } elseif ($lang == 'be') {
            // for belarusian use russian instead english
            $lang = 'ru';
        }
        return $lang;
    }
258295
private static function getTranslations(array $words)
    {
        $result = array();
        foreach ($words as $i) {
            $result = array_merge($result, array(ucfirst($i), strtoupper($i), strtolower($i)));
        }

        return $result;
    }
1283981
public function suggest($word) 
    {
        if (!pspell_check($this->pSpell, $word)) {
            return pspell_suggest($this->pSpell, $word);
        }
        else {
            return [$word];
        }
    }
438178
protected function split_lang($lang)
	{
		if ( ! isset($this->_fallback_paths[$lang]))
		{
			$splits = array();
			$lang_parts = explode('-', $lang);
			while ($lang_parts)
			{
				$splits[] = implode('-', $lang_parts);
				array_pop($lang_parts);
			}
			$this->_fallback_paths[$lang] = $splits;
		}
		return $this->_fallback_paths[$lang];
	}
594539
public static function pluralize($word)
        {
            if (isset(static::$_pluralized[$word])) {
                return static::$_pluralized[$word];
            }

            extract(static::$_plural);

            if (!isset($regexUninflected) || !isset($regexIrregular)) {
                $regexUninflected = static::_enclose(join('|', $uninflected + static::$_uninflected));
                $regexIrregular = static::_enclose(join('|', array_keys($irregular)));

                static::$_plural += compact('regexUninflected', 'regexIrregular');
            }

            if (preg_match('/(' . $regexUninflected . ')$/i', $word, $regs)) {
                return static::$_pluralized[$word] = $word;
            }

            if (preg_match('/(.*)\\b(' . $regexIrregular . ')$/i', $word, $regs)) {
                $plural = substr($word, 0, 1) . substr($irregular[static::lower($regs[2])], 1);

                return static::$_pluralized[$word] = $regs[1] . $plural;
            }

            foreach ($rules as $rule => $replacement) {
                if (preg_match($rule, $word)) {
                    return static::$_pluralized[$word] = preg_replace($rule, $replacement, $word);
                }
            }

            return static::$_pluralized[$word] = $word;
        }
49602
protected function addWildcards(array $words)
    {
        $token = $this->wildcard;

        return array_map(function ($word) use ($token) {
            return preg_replace('/\*+/', '*', "{$token}{$word}{$token}");
        }, $words);
    }
436294
public function blacklist(array $words) {
        $this->_blacklist = array_map('trim', array_filter($words)) + $this->_blacklist;
        $this->_blacklist = array_unique($this->_blacklist);

        return $this;
    }
369694
public function spellCheckBulk(array $texts, string $languageFrom = ''): SpellCheckResponse
    {
        return $this->getSpellCheckApi()->checkTexts($texts, new Language($languageFrom));
    }
462098
public function highlightJsLangData(string $lang): array
    {
        if ($lang === 'wp') {
            return [
                'ver'  => $this->cv,
                'deps' => ['highlight-js'],
                'url'  => $this->c::appWsCoreUrl('/client-s/js/hljs/langs/wp.min.js'),
            ];
        }
        return [
            'version' => '9.12.0',
            'deps'    => ['highlight-js'],
            'url'     => '//cdnjs.cloudflare.com/ajax/libs/highlight.js/%1$s/languages/'.urlencode($lang).'.min.js',
        ];
    }
315041
public function suggest($word) 
    {
        if(!enchant_dict_check($this->enchantBroker, $word)) {
            return enchant_dict_suggest($this->enchantBroker, $word);
        } else {
            return [$word];
        }        
    }
540077
private function hasValidEnEnding($word)
    {
        $lastLetter = Utf8::substr($word, -1, 1);
        if (in_array($lastLetter, self::$vowels)) {
            return false;
        }

        $threeLastLetters = Utf8::substr($word, -3, 3);
        if ($threeLastLetters == 'gem') {
            return false;
        }
        return true;
    }
479685
public function setLangDefault($lang, $text)
    {
        $this->setLangForm($lang, $text);
        $this->setLangColumn($lang, $text);
        $this->setLangFilter($lang, $text);

        return $this;
    }
127828
public static function fromWords(array $words)
    {
        $result = null;
        if (count($words) === 8) {
            $chunks = array();
            for ($i = 0; $i < 8; ++$i) {
                $word = $words[$i];
                if (is_int($word) && $word >= 0 && $word <= 0xffff) {
                    $chunks[] = sprintf('%04x', $word);
                } else {
                    $chunks = null;
                    break;
                }
            }
            if ($chunks !== null) {
                $result = new static(implode(':', $chunks));
            }
        }

        return $result;
    }
978277
public static function lang($lang = null)
    {
        if ($lang)
        {
            self::$lang = strtolower(str_replace(self::$_langNormalizeSearch, self::$_langNormalizeReplace, $lang));
        }
        return self::$lang;
    }
150391
public function setTranslatableLang($lang)
    {
        if (is_string($lang)) {
            $lang = new Lang($lang);
        }

        $this->translatableLang = $lang;

        return $this;
    }