private void switchLanguage(Locale locale, boolean showLanguageInStatusBar) {
    // if the selected locale is less specific than the default locale (e.g.
    // has no country or variant set), retain these properties, unless the user
    // specifically did not want to select the default locale
    if (!defaultLocaleSelectable && LanguageUtils.matchesDefaultLocale(locale)) {
      locale = Locale.getDefault();
    }

    if (!locale.equals(GUIMediator.getLocale())) {
      LanguageUtils.setLocale(locale);
      GUIMediator.instance().getStatusLine().updateLanguage();

      String message =
          I18n.trl("LimeWire must be restarted for the new language to take effect.", locale);
      GUIMediator.showMessage(message);
    }

    StatusBarSettings.LANGUAGE_DISPLAY_ENABLED.setValue(showLanguageInStatusBar);
    if (LanguageUtils.isEnglishLocale(locale)) {
      StatusBarSettings.LANGUAGE_DISPLAY_ENGLISH_ENABLED.setValue(showLanguageInStatusBar);
    }
    GUIMediator.instance().getStatusLine().refresh();
    dispose();
  }
  private void initializeContent(Locale[] locales) {
    FormLayout layout = new FormLayout("pref:grow");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);

    // add locales to model and select the best match
    DefaultComboBoxModel localeModel = new DefaultComboBoxModel();
    int selectedScore = -1;
    int selectedIndex = -1;
    Locale systemLocale = Locale.getDefault();
    for (int i = 0; i < locales.length; i++) {
      localeModel.addElement(locales[i]);
      int score = LanguageUtils.getMatchScore(currentLocale, locales[i]);
      if (score > selectedScore) {
        selectedScore = score;
        selectedIndex = i;
      }
      if (locales[i].equals(systemLocale)) {
        defaultLocaleSelectable = true;
      }
    }

    localeComboBox = new JComboBox(localeModel);
    localeComboBox.setRenderer(LanguageFlagFactory.getListRenderer());
    localeComboBox.setMaximumRowCount(15);
    if (selectedIndex != -1) {
      localeComboBox.setSelectedIndex(selectedIndex);
    }
    builder.append(localeComboBox);
    builder.nextLine();

    // reflect the changed language right away so someone who doesn't speak
    // English or whatever language it the default can understand what the
    // buttons say
    localeComboBox.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              Locale selected = (Locale) e.getItem();
              if (selected != null && !currentLocale.equals(selected)) {
                updateLabels(selected);
                // hide the flag by default for english locales to save
                // space in the status bar
                showLanguageCheckbox.setSelected(!LanguageUtils.isEnglishLocale(selected));
                currentLocale = selected;
              }
            }
          }
        });

    helpTranslateLabel = new URLLabel(TRANSLATE_URL, "");
    builder.append(helpTranslateLabel);
    builder.nextLine();

    builder.append(Box.createVerticalStrut(15));
    builder.nextLine();

    showLanguageCheckbox = new JCheckBox();
    showLanguageCheckbox.setSelected(StatusBarSettings.LANGUAGE_DISPLAY_ENABLED.getValue());
    builder.append(showLanguageCheckbox);
    builder.nextLine();

    builder.append(Box.createVerticalStrut(5));
    builder.nextLine();

    mainPanel.add(builder.getPanel(), BorderLayout.CENTER);
  }