When it comes to developing for internationalisation, there are two very important ISO codes: ISO 639 (languages) and ISO 3166 (countries). Within these codes there are two- and three-letter code variations for both language and countries. The simplest (and one of the most popular) are the two-letter code variations: ISO 639-1 for languages and ISO 3166-1 for countries.
Unsurprisingly, many countries and languages share the same two letter code. Spain and Spanish (es), France and French (fr), Thailand and Thai (th).
But there are some rather important languages codes that do not correlate directly with a country code. For instance, the Arabic language for uses ar which is Argentina’s ISO 3166-1 code. English’s en has no matching country code at all — it’s official 3166-1 code is gb for Great Britain. The Chinese language is zh in ISO-639 whereas China’s ISO-3166-1 code is cn.
Music streaming service Deezer uses flags to represent languages. One example in particular shows the pitfalls in assuming direct connections between languages and flags: the language code for Malaysian (ms) is different from the largest Malay-speaking nation, Malaysia (my in ISO-3166-1 — also, Malaysian is also spoken in Singapore).
Instead the flag next to the Malay link (Melayu) is actually that of the tiny Caribbean island of Monserrat, whose country code is (of course) ms.
The largest and simplest lesson from the Deezer example is to simply check that any flags you use (for any purpose) are actually the right ones.
But this issue wouldn’t have arisen at all had Deezer not decided to compliment languages with flags from the outset.
Update, January 6th 2013: Deezer have fixed their Malaysian flag, but are still using flags for their language options