Localized countries. You can either use a map (key ISO 2 code, value name), or a JSON string.
Source
<pe:inputPhone id="txtPhone"
initialCountry="nl"
onlyCountries="nl,be,de"
localizedCountries="{'nl':'Nederland','be':'België','de':'Duitsland'}"
value="#{basicInputPhoneController.phoneNumber}"/>
@Named
@ViewScoped
public class BasicInputPhoneController implements Serializable {
private static final long serialVersionUID = 1L;
private String phoneNumber;
private Map<String, String> localizedCountries;
@PostConstruct
protected void init() {
localizedCountries = new HashMap<>();
localizedCountries.put("nl", "Nederland");
localizedCountries.put("be", "België");
localizedCountries.put("de", "Duitsland");
}
public void onCountrySelect(final SelectEvent<Country> event) {
final Country country = event.getObject();
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_WARN, "Selected " + country.getName(), null));
}
public void submit() {
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_INFO, "Phone Number " + phoneNumber, null));
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(final String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public Map<String, String> getLocalizedCountries() {
return localizedCountries;
}
}