I would like to create a localization for PrimeFaces <p:captcha> component. I know how to localize validation error messages by using requiredMessage or validatorMessage attributes as follows:
<p:captcha label="Captcha" theme="clean" requiredMessage="#{msg['primefaces.captcha.INVALID']}" validatorMessage="#{msg['primefaces.tree.REQUIRED']}"/>
The problem is that I don't know how to localize e.g. labels (as depicted below)

So I need to localize points 1) and 2) and tooltips which are showed when user hovers any of buttons. It would be also nice if reCaptcha could use some kind of localized dictionary (3rd point) but I doubt that it's possible and it's really optional. I know that reCaptcha has few supported languages but mine (pl - polish) is unfortunately not supported...
Just add a language attribute to the captcha tag
<p:captcha language="pl" />
If you have a session bean that stores the user language you can use that too, for example:
<p:captcha language="#{userSessionBean.locale}" />
The bean:
@ManagedBean
@SessionScoped
public class UserSessionBean {
private Locale locale;
public Locale getLocale(){ return locale; }
public void setLocale(Locale locale) { this.locale = locale; }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With