Appframework: users@appframework.java.net: Archive — Project Kenai
I've read the thread https://appframework.dev.java.net/servlets/ReadMsg?listName=users&msgNo=1851, but I think the most important thing has not been said in this thread. MessageFormat must absolutely replace String.format(), IMHO, because- the order of the arguments in the message might be different from locale to locale.
- the order of the arguments in the message might evolve over time, and you don't want to change the Java code for this
- the same argument could be used several times in the message, and you don't want to repeat it in the array of arguments in the Java code
Take a look at the example in the Javadoc of MessageFormat. I don't think these two translations could be done using String.format():
In English: At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.
In French: Sur la planète {0,number,integer}, le {1,date} à {1, time}, il y avait {2}.
MessageFormat has been designed to handle internationalization, and is used in all the web presentation frameworks I know. It should be used in the SAF.
The only downside it has, though, is that it needs apostrophes to be escaped by doubling them.
Read full article from Appframework: users@appframework.java.net: Archive — Project Kenai
No comments:
Post a Comment