There is the DevGuide 
https://developers.google.com/web-toolkit/doc/latest/DevGuideI18nMessages which 
defines *GWT-Specific formats* which even extend the standard java 
MessageFormat.
This works fine when the Java message class is written by hand and 
appropriate Java parameter types are specified as arguments to the message, 
but not when the* I18NSync* tool is used.

Example:

Message properties file:
  format.dateType={0,date,dd.MM.yyyy HH:mm}

Running I18NSync with parameter createMessages on it results in

  @DefaultMessage("{0,date,dd.MM.yyyy HH:mm}")
  @Key("format.dateType")
  String format_dateType(String arg0);

First question is: How could a string match to a date when this should be 
filtered via a message format?
Answer is shown by the GWT compiler:
  [java]  [ERROR] Only java.util.Date acceptable for date format

Only when the argument to format_dateType is manually corrected to 
java.util.Date, the compilation works which makes sense.

Still, why does the GWT compiler support message format but the tools do 
not? Am I overlooking something here?
>From my point of view this is a bug. It would be sufficient to adopt the 
code in 

MessagesInterfaceCreator -> protected void genMethodArgs(String 
defaultValue)

so that it checks for message formats and writes the appropriate Java type 
instead of java.lang.String.

Is there any other quick workaround for this issue? In my case I cannot 
manually edit the Java message file as it contains hundreds of entries 
which are created, adopted and changed by others.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to