if(!LanguageDetector.languageLevelSupported) {
throw new Exception(LanguageDetector.upgradeMessage);
}
Detector detector = DetectorFactory.create();
detector.append(input);
String detectedLanguage = detector.detect();
// this is to deal with zh-cn and zh-tw in languageprofiles. All other files have a 639-1 2-char filename.
if(detectedLanguage.length() > 2) {
detectedLanguage = detectedLanguage.substring(0, 2);
}
String iso639_2 = srvContext.getBean(IsoLanguagesMapper.class).iso639_1_to_iso639_2(detectedLanguage);