The px_preferred_locale Session Attribute

Before checking the browser's preferences, ZK will check if a session attribute called px_preferred_locale is defined. If defined, ZK uses it as the default locale for the session instead of the browser's preferences. Thus, you can control the locale of a session by storing the preferred locale in this attribute.

For example, you can do this when a user logins.

void login(String username, String password) {
    //check password    
    ...    
    Locale preferredLocale = ...; //decide the locale (from, say, database)    
    session.setAttribute("px_preferred_locale", preferredLocale);    
    ...    
}

Tip: To avoid typo, you can use the constant called PREFERRED_LOCALE defined in the org.zkoss.web.Attributes class.