Apparent bug in DeepLTranslator

thumbnail
Fernando Fernandez, modified 1 Year ago. Expert Posts: 401 Join Date: 8/22/07 Recent Posts

Hi all,

I was toying around with translators and was trying DeepL but got an error:

Target language code en is not among the supported langauge codes: BG, CS, DA, DE, EL, EN, ES, ET, FI, FR, HU, ID, IT, JA, KO, LT, LV, NB, NL, PL, PT, RO, RU, SK, SL, SV, TR, UK, ZH

This seems to come from liferay-portal/modules/apps/translation/translation-translator-deepl/src/main/java/com/liferay/translation/translator/deepl/internal/translator/DeepLTranslator.java 

This piece of code is comparing lowercase string with uppercase strings and fails.Possibly the JSON data has changed format after the code was written?

		if (!supportedLanguageCodes.contains(targetLanguageCode)) {
			throw new TranslatorException(
				StringBundler.concat(
					"Target language code ", targetLanguageCode,
					" is not among the supported langauge codes: ",
					StringUtil.merge(
						supportedLanguageCodes, StringPool.COMMA_AND_SPACE)));

HTH

Fernando