However, this is another reason why flags aren't a good choice for languages. It works for some of the main languages - German, French, etc. where there's a clear one to one link between originating country's flag and language.
It's less clear for English - the UK flag, the US flag, the Irish flag and apparently even the Canadian flag gets used.
It's basically impossible to choose a flag for minority languages, and many countries have multiple official and widely spoken unofficial languages. What flag should represent Balinese, for example?
I don't have a better solution, and if your site is translated to just a couple of languages it's fine. But I guess as machine translation gets closer to perfect and very cheap, it'll become more common to have lots of translations.