3

Is there any way to change the used language in the above mentioned component dropdown?

adding lang="DE" for german language did not work:

    <div class="p-field p-col-12 p-md-6">
                    <h7>Festnetz</h7>
                    <pe:inputPhone id="festnetz" label="Hallo" lang="DE"
                        initialCountry="#{kontakt.countryIsoFestnetz}"
                        value="#{kontakt.festnetz}" formatOnDisplay="true">
                        <p:ajax event="countrySelect"
                            listener="#{kontakt.onCountrySelectFestnetz}" />
                    </pe:inputPhone>
                </div>
Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102

1 Answers1

2

PrimeFaces Extensions 12.0.2 and up

Since PrimeFaces Extensions 12.0.2 you can use the localizedCountries to do so. You can either supply a Map<String, String> containing the ISO 2 abbreviation (lower case) (key), and the name (value):

private Map<String, String> localizedCountries;

@PostConstruct
protected void init() {
    localizedCountries = new HashMap<>();
    localizedCountries.put("nl", "Nederland");
    localizedCountries.put("be", "België");
    localizedCountries.put("de", "Duitsland");
}

// Add getter
<pe:inputPhone onlyCountries="nl,be,de"
               localizedCountries="#{bean.localizedCountries}"/>

or a JSON string:

<pe:inputPhone onlyCountries="nl,be,de"
               localizedCountries="{'nl':'Nederland','be':'België','de':'Duitsland'}"/>

See also:

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102