gwt-i18n-server icon indicating copy to clipboard operation
gwt-i18n-server copied to clipboard

GWT-specific i18n formats not supported

Open crevete opened this issue 12 years ago • 3 comments

The GWT-specific i18n format is currently not supported yet (See http://www.gwtproject.org/doc/latest/DevGuideI18nMessages.html#GwtFormats)

Here is a simple example :

In the properties file :

hello = Hello, {startBold,<b>}{0}{endBold,</b>}

When rendering this message on the server side, an exception will be thrown :

java.lang.IllegalArgumentException: can't parse argument number: startBold
    at java.text.MessageFormat.makeFormat(MessageFormat.java:1420)
    at java.text.MessageFormat.applyPattern(MessageFormat.java:479)
    at java.text.MessageFormat.<init>(MessageFormat.java:381)
    at net.lightoze.gwt.i18n.server.MessagesProxy.invoke(MessagesProxy.java:107)

crevete avatar Feb 26 '14 15:02 crevete

As I can see GWT does not have Java implementation for these classes, so they have to be re-implemented in MessagesProxy class. ExtendedMessageFormat from commons-lang can help with that.

Please send a pull request if you can do the change by yourself. And remember to add a test case :)

lightoze avatar Feb 26 '14 18:02 lightoze

ExtendedMessageFormat will not help us so much... Since it considers, just like MessageFormat, the first "argument" within the {arg1, arg2, ...} as an INTEGER. So the same IllegalArgumentException will be thrown.

It is not quite easy to fix this "corner-case" :-)

crevete avatar Feb 27 '14 15:02 crevete

Partially fixed this in 0.24 - now you can use {startBold,<b>}{0}{endBold,</b>}. Other GWT-specific formats are still not supported.

lightoze avatar Oct 09 '16 09:10 lightoze