Are there default country flag images somewhere, or is it my resposibilitiy to supply these images if I want a flag-ased language selector? I could not find any, but there is a flags.phtml for the switch block. Am I missing something?

  • you have to do manually via code
    – Keyul Shah
    Feb 10, 2014 at 13:01
  • 1
  • 1
    It would seem this template file is some kind of error or legacy file - I don't see these images as part of any CE release back through CE0.7
    – benmarks
    Feb 10, 2014 at 14:32
  • 4
    I would discourage the use of flags for language selection. You will end up having some of your users feeling excluded. Most common languages are being spoken in more than one major country/region. Large corporate websites moved away from the flags because of this reason. This would not apply, of course, if you are serving a particular country.
    – eakkas
    Feb 11, 2014 at 5:40

1 Answer 1


This JS-Snippet will extend Textlinks to the standard select (additional CSS needed to hide standard select). Works for 1.9. You might want to use images instead text:

// Helper
Element.addMethods("SELECT", (function() {
    function getSelectedOptionHTML(element) {
        if (!(element = $(element))) return;
        var index = element.selectedIndex;
        return index >= 0 ? element.options[index].innerHTML : undefined;

    return {
        getSelectedOptionHTML: getSelectedOptionHTML

// Language Chooser: Extend Text Links
var languageselected = $('select-language').getSelectedOptionHTML();
var activeLangClass = "active";
if ($(".your-flag-container")){
$$('#select-language option').each(function(item) {
    var t = item.text;
    var v = item.value;

    var tpl = "<span class='your-flag-container'><a class='your-single-flag your-single-flag-" + t + "' href='" + v + "' title='" + t + "' >" + t + "</a></span>";

$$(".your-single-flag-" + languageselected)[0].addClassName(activeLangClass);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.