@eschwartz, thanks! Yes, you can show multiple icons (provided that the option 'composed icons' has been chosen).
I'll check the list_item() function (but now I have to get some sleep

).
Here an enhanced version of the template function (so that no flag is shown if no language has been set). (Am I right that you just leave '' if nothing should happen? Seems to work.)
program:
a =field ('#target');
b = field ('languages');
test (a,
switch (a, 'English', 'united_kingdom_flag.png', 'Polish', 'poland.png', 'German', 'germany_flag.png', 'French', 'france_flag.png', 'Swedish', 'sweden.png', 'Dutch', 'netherlands_flag.png', 'Spanish', 'spain.png', 'generic_flag.png'),
test(b,
switch (b, 'eng', 'united_kingdom_flag.png', 'pol', 'poland.png', 'deu', 'germany_flag.png', 'fra', 'france_flag.png', 'swe', 'sweden.png', 'nld', 'netherlands_flag.png', 'spa', 'spain.png', 'generic_flag.png'),
'')
)