How can I get the English name of a language given its two-letter code (see ISO 639-1 and List of ISO 639-1 codes)?
en --> english
it --> italian
And what about the other way around?
spanish --> es
finnish --> fi
Of course, a possible way to do it is to download a file containing those info from the Internet (for example the file that can be found here) and then read it line by line, extracting the info you need. However, I was wondering whether it is possible to rely only on the OS (Ubuntu, in my case): it contains info about the locales, so I guess there exists a way to do it.