There are still some things I hate in Ubuntu. But today -- again -- this number was reduced by one. I have found a way to display flags in Gnome's keyboard layout switcher applet. I am not sure if this is an Ubuntu or Gnome issue, but there are only layout codes by default, like 'USA', 'Rus', 'Est' and so on.
To begin with, applet searches for flag icons in `/usr/share/pixmaps` and `~/.icons/flags`. I will use second folder. It needs to be created first:
Then you need pictures called according to ISO 3166-1 Alpha 2 country codes ('us.png', 'ru.png' and 'ee.png' in my case). It is actually your problem where to get them or how to draw them. I recommend this set created by Mark James. Download ZIP-file and unpack its contents (I mean only PNG-images located in `png` folder) into `~/.icons/flags`.
And now the trickiest part begins. Run
gconftool-2 --type bool \
--set /desktop/gnome/peripherals/keyboard/indicator/showFlags true
Or if you are allergic about command line, read this. You will find analogous GUI action there.