如何从谷歌应用程序脚本中的谷歌翻译语言代码中获取语言名称?

I have a script I'm using with the google translate api. I am translating like this:

LanguageApp.translate(content, 'en', 'es')

I now need to translate content to many more languages, and as languages are added or dropped I don't want to update much, so how can I get the name of a language from its language 'code'?

I'm expecting something like this

LanguageApp.getNameFromCode('es')

and it would return "spanish" in this case.

How can I achieve this?

If it's not possible, I can use JS to on my frontend, or PHP in my backend, but using GAS is the most preferable way for me.

This should be the method you are looking for:

List<Language> languages = translate.listSupportedLanguages(target);

I shared the Java code, but you can have a look at the documentation and choose the one that fits your application better.