public static function isValidLanguageRegex(string $language)
    {
        $match = false;

        if (preg_match(self::$validISOLanguageRegex, $language)) {
            $match = true;
        }

        if (preg_match(self::$validBCP47LanguageRegex, $language)) {
            $match = true;
        }

        return $match;
    }
public static function isValidLanguageRegex(string $language)
    {
        $match = false;

        if (preg_match(self::$validISOLanguageRegex, $language)) {
            $match = true;
        }

        if (preg_match(self::$validBCP47LanguageRegex, $language)) {
            $match = true;
        }

        return $match;
    }
public static function isValidLanguageRegex ( string $ language ) { $ match = false ; if ( preg_match ( self :: $ validISOLanguageRegex , $ language ) ) { $ match = true ; } if ( preg_match ( self :: $ validBCP47LanguageRegex , $ language ) ) { $ match = true ; } return $ match ; }
Check if a string is a possible language string.

Not the best but better than nothing. Can be expanded
upon.

Accepts ISO (en, es, de) and BCP-47 (en-ZA, en-GB)

@param string $language The language to check

@return boolean
Check if a string is a possible language string .