public boolean isLanguage(String language) {
        String[] targetLanguage = language.split("\\-");
        String[] resultLanguage = this.language.split("\\-");

        int minLength = Math.min(targetLanguage.length, resultLanguage.length);
        for (int i = 0; i < minLength; i++) {
            if (!targetLanguage[i].equalsIgnoreCase(resultLanguage[i])) {
                return false;
            }
        }

        return true;
    }
Return true if the target language matches the detected language. We consider
it a match if, for the precision requested or detected, it matches. This means:
<p>
target | detected | match?
zh | en | false
zh | zh | true
zh | zh-CN | true
zh-CN | zh | true
zh-CN | zh-TW | false
zh-CN | zh-cn | true (case-insensitive)

@param language
@return
tika-core/src/main/java/org/apache/tika/language/detect/LanguageResult.java