I have built an application with JSF and all messages issued by the server are localized with resource bundles.
My question is: how to get messages issued in the cli
Just let JSF print the desired JS code. E.g.
You only need to take JS special characters such as singlequotes and newlines into account. For that, you could register a custom EL function which delegates to Apache Commons Lang StringEscapeUtils, or use OmniFaces of:escapeJS() function.