Whatever works best for you. In the method on my component, it might not be 
obvious, but if you have an enum like Color.RED, then if you do

“Color.RED” = “Rouge”;

in your localizable.strings file, you should get the desired results.

On Jul 9, 2014, at 12:01 PM, Pascal Robert <[email protected]> wrote:

> It works with your components :-) I have a question about localization (I'm 
> not sure one the D2W presentations talks about localization). My enum is like 
> this:
> 
>  ANNUAL("com.druide.softwaretype.annual"),
>  MONTHLY("com.druide.softwaretype.monthly"),
>  OPEN_SOURCE("com.druide.softwaretype.open_source"),
>  BINARY_FREE("com.druide.softwaretype.binary_free"),
>  FREE_LICENSE("com.druide.softwaretype.free_license"),
>  UPGRADE("com.druide.softwaretype.upgrade"),
>  NON_EXPIRING("com.druide.softwaretype.non_expiring");
> 
>  private String _localizationKey;
> 
>  private SoftwareType(String descriptionEn) {
>    this._localizationKey = descriptionEn;
>  }
> 
>  public String localizationKey() {
>    return _localizationKey;
>  }
> 
>  public static NSArray<Language> allSoftwareTypes() {
>    return new NSArray<Language>(Language.values());
>  }
> 
> So I added the following rule in the model:
> 
>  100 : (task = 'edit' and entity.name = 'Software' and propertyKey = 
> 'licenceType') => destinationDisplayKey = "localizationKey" 
> [com.webobjects.directtoweb.Assignment]
> 
> And I made some changes to R2D2WEditEnum.enumDisplayString() to add:
> 
>  if (displayString != null) {
>    displayString = 
> ERXLocalizer.currentLocalizer().localizedStringForKey(displayString);
>  }
> 
> Is this the way to go?
> 
> ----- Mail original ----- 
> De: "Ramsey Gurley" <[email protected]> 
> À: "Pascal Robert" <[email protected]> 
> Cc: [email protected] 
> Envoyé: Mercredi 9 Juillet 2014 13:09:15 
> Objet: Re: Enums in D2W 
> 
> Use my framework. If you’re not completely satisfied after 30 days, mail it 
> back for a full refund ;-) 
> 
> https://github.com/nullterminated/ponder/tree/master/ERR2d2w/Components/Nonlocalized.lproj/R2D2WEditEnum.wo
>  
> 
> I think you can also use a regular toOneRelationship edit component with the 
> right rules and/or custom assignment class. I did a presentation at a 
> conference about it one time :D 
> 
> http://www.wocommunity.org/podcasts/wowodc/2010/ComponentAssignment.mov 
> 
> On Jul 9, 2014, at 9:53 AM, Pascal Robert < [email protected] > wrote: 
> 
> 
> 
> Hi guys, 
> 
> What is the trick to select a enum (javaEnum prototype in the model) from a 
> Edit component in D2W? 
> _______________________________________________ 
> Do not post admin requests to the list. They will be ignored. 
> Webobjects-dev mailing list ( [email protected] ) 
> Help/Unsubscribe/Update your Subscription: 
> https://lists.apple.com/mailman/options/webobjects-dev/rgurley%40smarthealth.com
>  
> 
> This email sent to [email protected] 
> 
> 
> 
> 


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to