Jonathas Pacífico
Jonathas Pacífico

Reputation: 668

Override Primefaces Messages in custom properties file

I want to override some PrimeFaces defaults.

According to this link PrimeFaces default messages.properties I wrote a custom message properties:

primefaces.captcha.INVALID = {0}: Erro de Valida\u00e7\u00e3o: Valor inv\u00e1lido.
primefaces.captcha.INVALID_detail = {0}: ''{1}'' n\u00e3o confere com o texto exibido.
primefaces.password.INVALID_MATCH = {0}: Erro de Valida\u00e7\u00e3o: Valor inv\u00e1lido.
primefaces.password.INVALID_MATCH_detail = {0} deve ser igual a {1}.

How can I override some features like weekLabel, goodLabel, strongLabel in the password for example?

I'd like to know what properties keys I should use.

Upvotes: 1

Views: 8610

Answers (1)

BalusC
BalusC

Reputation: 1108742

Those labels are not part of conversion/validation messages. Those labels are part of pure text presentation. You need to supply them yourself via standard JSF resource bundle mechanism.

E.g. com.example.i18n.text.properties:

primefaces.password.weakLabel = Zayıf
primefaces.password.goodLabel = Orta seviye
primefaces.password.strongLabel = Güçlü

which is configured in faces-config.xml as follows:

<resource-bundle>
    <base-name>com.example.i18n.text</base-name>
    <var>text</var>
</resource-bundle>

and used in the view as follows:

weakLabel="#{text['primefaces.password.weakLabel']}"
goodLabel="#{text['primefaces.password.goodLabel']}"
strongLabel="#{text['primefaces.password.strongLabel']}"

Upvotes: 3

Related Questions