More on that in a minute.
In related news:
Throwable.getLocalizedMessage() is practically useless, to the point it might as well be deprecated. I may be the only developer in the history of the Java language to actually implement that method.*
* Gross exaggeration
Now back to
MessageFormat. By default it will only handle the formates built in to the JRE. Extending it is done per instance, by argument.
Unfortunately, not only would be a hassle to manually set a custom format every time, it wouldn't even work half the time.
MessageFormat is nested deep within the bowels of the JRE/JDK and many 3rd party libraries. It's permanently infected, so there's no way to override many cases.
While you can't get rid of
MessageFormat entirely, there are a few better alternatives available.
If you are serious about localizing your app, it's just a matter of time before you start using the ICU library. It's pretty much an industry standard. The best part is it fixes the notorious apostrophe (
') issue. You can also add arguments by name, as well as number. Unfortunately it doesn't solve my problem.
Let's you register format factories, but only at the instance level.
When using "choice" subformats, support for nested formatting instructions is limited to that provided by the base class.
Here is an example where there's no way around the notorious MessageFormat.
By jove this might be as good as it gets. This appears to actually let you register formatters at a global level so all uses of this class will automatically benefit.