If I see the problem well, you want to display messages using MessageFormat as follows:
Object[] arguments = { new Integer(7), new Date(System.currentTimeMillis()), "a disturbance in the Force" }; String result = MessageFormat.format( "At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.", arguments);
(Example from javadoc)
I checked the source of MessageFormat , and I see that getLocale() is common to the whole message. You cannot make a separate parameter for a parameter.
Why don't you make a parameter with the most formatted date string? Like this:
Object[] arguments = { new SimpleDateFormat("yyyyy.MMMMM.dd GGG hh:mm aaa", Locale.UK).format(new Date()) }; String result = MessageFormat.format( "This is the date format which I always want independently of the locale: {1} ", arguments);
The first parameter of the format methods may come from localized property files.
source share