In my last project I was using JavaScript heavily which was using messages extensively.

Repetition of same kind of messages from multiple places was becoming unmanageable to handle that I have written a JavaScript class which provides Text message with respect to the message code provided.

This function works in two ways:1. With code only (Messages.getText("error.text"))2. With code and args (Messages.getText("error.invalid",args)) Here args is replacement for place holders like: error.invalid = "Invalid input [1] for [0]" So Invalid error message can be reused for multiple places where [1] will replace by value and [0] wil be replaced for Field name