[TASK] Get flag image only when required

This patch saves some database queries when using text only links in language menus as described in #247.