Found in GWT Release (e.g. 2.4.0, 2.5.1, trunk):
2.7.0
Encountered on OS / Browser (e.g. WinXP, IE9, FF10):
All
Detailed description (please be as specific as possible):
I'm trying to generate .properties files from the interface file for "ru" and "en"
locales. While it mostly works fine, I only have the default form, "=0" and "one" in
the .properties files for all locales.
Shortest code snippet which demonstrates issue (please indicate where
actual result differs from expected result):
Module xml file includes the locales list and the fallback locale:
<extend-property name="locale" values="ru, en" />
<set-property-fallback name="locale" value="ru" />
My Messages class is annotated with:
@Generate(format = "com.google.gwt.i18n.server.PropertyCatalogFactory", fileName =
"Messages", locales = { "ru", "en" })
@DefaultLocale("ru")
The problematic field is:
@DefaultMessage("{0} файлов")
@AlternateMessage({ "few", "{0} файла", "many", "{0} файлов", "=0", "Нет файлов", "one",
"Один файл" })
String countFiles(@PluralCount int number);
So I expect to get something like:
countFiles={0} файлов
countFiles[few]={0} файла
countFiles[many]={0} файлов
countFiles[=0]=Нет файлов
countFiles[one]=Один файл
Instead I get this:
countFiles={0} файлов
countFiles[=0]=Нет файлов
countFiles[one]=Один файл
I've tried changing the "locales" parameter in the @Generate and removing it completely
to no avail. I wrote my own MessageCatalogFactory (copied PropertyCatalogFactory, actually)
and added the debug output like this:
@Override
public MessageVisitor visitMessage(Message msg, MessageTranslation trans) throws MessageProcessingException
{
System.out.println("Message: " + msg.getKey() + " Locale: " + msg.getMatchedLocale().toString()
+ " trans forms: " + trans.getAllMessageForms() + " msg forms: " + msg.getAllMessageForms());
<...rest of file...>
I couldn't debug the maven compiling process as it doesn't stop at breakpoints when
using mvnDebug with the Eclipse attached debugger. So this resulted in the following
output while compiling:
[INFO] Compiling module <my module name>
[INFO] Message: countFiles Locale: ru trans forms: [[=0] => Нет файлов, [one] => Один
файл, [other] => {0} файлов] msg forms: [[=0] => Нет файлов, [one] => Один файл, [other]
=> {0} файлов]
It's like getAllMessageForms() only returns plurals for the English locale. I couldn't
find the exact source of this and gave up at this point.
Workaround if you have one:
Links to relevant GWT Developer Forum posts:
Link to patch posted at http://gwt-review.googlesource.com
Originally reported on Google Code with ID 9125
Reported by
radioanonzoi
on 2015-02-11 09:53:17