www.javacodegeeks.com/2013/12… The Java classes ResourceBundle and MessageFormat provide a nice toolset for resolving localized messages inside Java applications. This post provides a small example on how you can move simple message related conditions from your Java code into message files using ChoiceFormat. If you already know ChoiceFormat I do not think you will learn anything new in this post. However, in my experience many developers do not know about this nice little feature.Let's assume we have an application in which users can comment some kinds of content. Somewhere in the application we want to display a simple message that shows how often a certain piece of content has been commented. We want to show the following messages based on the number of comments: Number of comments Message 0 This element contains no comments 1 This element contains one comment 2+ This element contains comments To implement this
Open link |