Hi,
In most samples on the internet people uses the selectonemenu to select a local. But we want to select a locale using an arraylist of strings.
Action:
public ArrayList<String> getLanguages(){
ArrayList<String> items = new ArrayList<String>();
for(SelectItem s : LocaleSelector.instance().getSupportedLocales())
items.add((String) s.getValue());
return items;
}
public void setLanguage(ActionEvent ae){
UIComponent tmpComponent = ae.getComponent();
LocaleSelector.instance().selectLanguage(tmpComponent.getId());
}
<ui:repeat value="#{languagesAction.languages}" var="language">
<s:link value="#{language}" actionListener="#{languagesAction.setLanguage}" />
</ui:repeat>