final Set<String> languageSettings = currentSite != null ? currentSite.getLanguages() : null;
if (languageSettings != null && languageSettings.size() > 0) {
final TreeSet<String> orderedLangs = new TreeSet<String>();
orderedLangs.addAll(languageSettings);
for (String lang : orderedLangs) {
Item item = createJsRedirectItem(getDisplayName(lang), lang);
// add to itemsgroup
if (item != null) {
String minIconStyle = getLangIconStyle(lang);
item.setIcon(minIconStyle);
if (selectedLang != null) {
if (selectedLang.getLanguage().equals(LanguageCodeConverters.languageCodeToLocale(lang))) {
Selected s = new Selected();
s.setValue(true);
item.setSelected(s);
}
}
// add to group lis
items.add(item);
}