java - Internationalizing a duration via gwt Messages -
i want include timeout duration, "25 seconds" or "1 minute", in user-facing message. there way in gwt?
from this resource, know can dates this:
@defaultmessage("last update: {0,date,medium} {0,time,medium}") string lastupdate(date timestamp);
but there doesn't seem like:
// hypothetical @defaultmessage("requests time out after {0,duration}") string timeout(interval duration); // interval jodatime concept...
is there?
jodatime still isn't available gwt (there are/were several projects, unfortunately none ever established itself). hope someday we'll see javase 8's new date api in gwt!
until then, use following approach:
- storing duration number of seconds (or milliseconds if required).
- creating 1 internationalized message 0-59 seconds, 1 1-59 minutes, , 1 1-... hours.
- each of these messages can use plural forms.
- selecting best message (seconds/minutes/hours) programmatically.
Comments
Post a Comment