Hi Ramesh, this issue seems to be related with removal of @DefaultMessage annotations, moving the default (English) strings into corresponding .properties files.
As we generally want default strings to reside in .properties files, I see following options to explore, based on our earlier conversation: 1, try annotating UIMessages interface with: @Generate(format = "com.google.gwt.i18n.server.PropertyCatalogFactory") - ref: https://github.com/gwtproject/gwt/issues/7032#issuecomment-110858030 - this is likely non-feasible, however, since @Generate requests generation of translation sources (.properties) from Java code 2, try removing @AlternateMessage annotation and modify .properties file: recurrenceType=Incorrect enum recurrenceType[UNKNOWN]=None recurrenceType[INTERVAL]=Minute recurrenceType[HOURLY]=Hourly recurrenceType[DAILY]=Daily recurrenceType[WEEKLY]=Weekly recurrenceType[MONTHLY]=Monthly - ref: http://www.gwtproject.org/doc/latest/DevGuideI18nPluralForms.html - this might not work as it might be @PluralCount-only (not for @Select) 3, remove @AlternateMessage & handle enum-to-string formatting on our own String sizeUnitString(String size, @Messages.Select SizeConverter.SizeUnit sizeUnit); becomes String sizeUnitString(String size, String sizeUnitValue); String recurrenceType(@Select GlusterVolumeSnapshotScheduleRecurrence recurrence); gets removed, because there is no point in having "{0}" message getMessages().sizeUnitString(size, sizeUnit); becomes getMessages().sizeUnitString(size, <someUtility>(sizeUnit)); getMessages().recurrenceType(recurrence); becomes <someUtility>(recurrence); Personally, I think 3, is the most correct solution. As Alex wrote below, we're planning to switch away from GWT i18n mechanism in the long-term; relying on @AlternateMessage etc. is therefore an obstacle to that effort. Also, we already have infra for localizing enum members: LocalizedEnums So as part of solution 3, we should add into LocalizedEnums: String GlusterVolumeSnapshotScheduleRecurrence___INTERVAL(); String GlusterVolumeSnapshotScheduleRecurrence___HOURLY(); String GlusterVolumeSnapshotScheduleRecurrence___DAILY(); String GlusterVolumeSnapshotScheduleRecurrence___WEEKLY(); String GlusterVolumeSnapshotScheduleRecurrence___MONTHLY(); String GlusterVolumeSnapshotScheduleRecurrence___UNKNOWN(); plus add corresponding strings in LocalizedEnums.properties file. This way, we can leverage existing EnumTranslator#translate method. By doing so, <someUtility> mentioned above === EnumTranslator#translate Regards, Vojtech ----- Original Message ----- > From: "Alexander Wels" <[email protected]> > To: "Ramesh Nachimuthu" <[email protected]> > Cc: "devel" <[email protected]>, "Vojtech Szocs" <[email protected]>, "Scott > Dickerson" <[email protected]> > Sent: Thursday, July 28, 2016 2:21:23 PM > Subject: Re: Strange issues with > com.google.gwt.i18n.client.Messages.AlternateMessage [bz#1358837] > > On Thursday, July 28, 2016 05:49:57 AM Ramesh Nachimuthu wrote: > > Hi, > > > > We have a strange issue with the > > com.google.gwt.i18n.client.Messages.AlternateMessage in UIMessages.java. We > > have defined some alternate messages using @Messages.Select with Enums. But > > its doesn't work any more. > > > > We have following messages in the UIMessages.java. > > > > @Messages.AlternateMessage(value = { "UNKNOWN" , "None" , "INTERVAL" , > > "Minute" , "HOURLY" , "Hourly" , "DAILY" , "Daily" , "WEEKLY" , "Weekly" , > > "MONTHLY" , "Monthly" }) String recurrenceType(@Messages.Select > > GlusterVolumeSnapshotScheduleRecurrence recurrence); > > > > @Messages.AlternateMessage(value = { "BYTES" , "{0} B" , "KiB" , "{0} > > KiB" , "MiB" , "{0} MiB" , "GiB" , "{0} GiB" , "TiB" , "{0} TiB" }) String > > sizeUnitString(String size, @Messages.Select > > SizeConverter.SizeUnit sizeUnit); > > > > But the generated UIMessages_.java doesn't use any of the enum conditions. > > > > public java.lang.String > > recurrenceType(org.ovirt.engine.core.common.businessentities.gluster.Gluste > > rVolumeSnapshotScheduleRecurrence arg0) { java.lang.String returnVal = > > null; > > int arg0_ordinal = -1; > > if (arg0 != null) { > > arg0_ordinal = arg0.ordinal(); > > } > > if (returnVal != null) { > > return returnVal; > > } > > return "Incorrect enum"; > > } > > > > public java.lang.String sizeUnitString(java.lang.String > > arg0,org.ovirt.engine.core.common.utils.SizeConverter.SizeUnit arg1) { > > java.lang.String returnVal = null; > > int arg1_ordinal = -1; > > if (arg1 != null) { > > arg1_ordinal = arg1.ordinal(); > > } > > if (returnVal != null) { > > return returnVal; > > } > > return arg0 + " TiB"; > > } > > > > It used to work earlier. Is there any known issue in the current GWT > > Version? or Am I missing something?. > > > > Regards, > > Ramesh > > We have an active project to remove all the annotations from the Messages > interfaces in the project. I am guessing that is probably the cause of your > problems. I am fairly certain there is an alternative to the annotations now, > but I don't know of the top of my head. Scott can you give them the details? > > Alexander > > _______________________________________________ Devel mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/devel
