You don't need to program... If I well understood, you just need a custom flag which can be the picture you want.
In your language switcher option, choose to display flags and not names. Then create a directory 'wp-content/polylang' and upload your pictures (png or jpg) that you should name with WordPress locale (for example en_US.png or de_DE.jpg).
↧
Chouby on "[Plugin: Polylang] I want to use custom images instead of language name in language switcher"
↧