When formatting messages with Messages.format code becomes quite noisy. So I thought why not use a special char for the method name? I used "_" which seems to be unintrusive.
Messages.format( "FILES_WRITTEN", files);
then becomes
Messages._( "FILES_WRITTEN", files );
combining this with the new static import feature from Java 1.5 (great timing 🙂 this becomes
import static api.cintoo.messages.Messages.*;
_( "FILES_WRITTEN", files);
which looks shorter and less noisy than the first and as the default Sun solution for i18n.
I think about using "$" for the method name,
$( "FILES_WRITTEN", files);
looks perhaps more familiar with Prototype.js using $ and this also looks like templating engines as Velocity/ JSP.
Stephan Schmidt
Administrator
Stephan is a CTO coach. He has been a coder since the early 80s, has founded several startups and worked in small and large companies as CTO. After he sold his latest startup he took up CTO coaching. He can be found on LinkedIn or follow him in Twitter.
email