For the GWT side, I've been having a lot more trouble creating a
template file. For testing, I created a sample Messages interface as
follows:
===
package org.duh.gwt.client.locale;
import com.google.gwt.i18n.client.*;
import com.google.gwt.i18n.client.LocalizableResource.*;
@Generate(format =
"com.google.gwt.i18n.rebind.format.PropertiesFormat", locales =
{"default"})
public interface LocaleMessages extends Messages {
@DefaultMessage("Server error \"{0}\"; please try again later.")
String serverError(String msg);
@DefaultMessage("There's nothing to see here; move along.")
String nothingToSeeHere();
}
===
The other GWT code references these methods in order to include the
class in the compile, and I see the following in the Eclipse console
when doing the GWT compile phase (there's 12 permutations because I
explicitly included "en" in the DuhGWT.gwt.xml config, thus default +
en):
===
Compiling module org.duh.gwt.DuhGWT
Scanning for additional dependencies: file:/C:/Documents%20and
%20Settings/tv/eclipse-workspace/DuhGWT/src/org/duh/gwt/client/
DuhGWTSample.java
Computing all possible rebind results for
'org.duh.gwt.client.locale.LocaleMessages'
Rebinding org.duh.gwt.client.locale.LocaleMessages
Invoking
com.google.gwt.dev.javac.StandardGeneratorContext@1c925db
Generating
org.duh.gwt.client.locale.LocaleMessages.properties from
LocaleMessages_ for locale default
Compiling 12 permutations
Compiling permutation 0...
Compiling permutation 1...
Compiling permutation 2...
Compiling permutation 3...
Compiling permutation 4...
Compiling permutation 5...
Compiling permutation 6...
Compiling permutation 7...
Compiling permutation 8...
Compiling permutation 9...
Compiling permutation 10...
Compiling permutation 11...
Compile of permutations succeeded
Linking into C:\Documents and Settings\tv\eclipse-workspace\DuhGWT\war
\duhgwt.
Link succeeded
Compilation succeeded -- 34.485s
===
I was expecting to find a LocaleMessages.properties or
LocaleMessages_default.properties file somewhere in my workspace, but
it's nowhere to be found. (A cygwin "find . -name '*.properties' in
the workspace only shows my logging.properties file.) I also attempted
setting the annotation's fileName attribute, which did change one line
in the compile output but still didn't appear to create a template
file:
Generating foobar.properties from LocaleMessages_ for
locale default
Is there some way I should attempt to invoke the GWT compiler by hand
to try this a different way? What I'm hoping to get out of this is
similar to what xgettext does: provide a template file where the
constants are initially equal to the @Default* values -- and if
possible, comments generated from @Meaning or @Description annotations
as an aid to the translators. They could then return translated
versions to me, which I would simply check in to source control
alongside the default-locale versions, and never have to deal with the
Java code in-between.
Maybe I'm missing the point of @Generate here, but I'm not exactly
sure what it's supposed to do otherwise. :(
> Is there some way I should attempt to invoke the GWT compiler by hand
> to try this a different way? What I'm hoping to get out of this is
> similar to what xgettext does: provide a template file where the
> constants are initially equal to the @Default* values -- and if
> possible, comments generated from @Meaning or @Description annotations
> as an aid to the translators. They could then return translated
> versions to me, which I would simply check in to source control
> alongside the default-locale versions, and never have to deal with the
> Java code in-between.
>
> Maybe I'm missing the point of @Generate here, but I'm not exactly
> sure what it's supposed to do otherwise. :(
Any insight on this? The GWT compile phase says it's generating a
properties file, but there's none to be found....