Re: Enums in D2W
Re: Enums in D2W
- Subject: Re: Enums in D2W
- From: Ramsey Gurley <email@hidden>
- Date: Mon, 14 Jul 2014 13:06:44 -0700
Oh, there’s a rule for that. Try
100: smartAttribute.prototype.name = 'javaEnum' => localizeDisplayKeys = “true" [BooleanAssignment]
Sorry about that. That’s not intuitive at all. I should have included that rule in my framework.
On Jul 14, 2014, at 12:48 PM, Pascal Robert <email@hidden> wrote:
> I did try that, and I get Enum.TYPE (AssetStatus.DEPLOYED) instead of the localized key. enumDisplayString() don't call any ERXLocalizer method to translate the string (maybe your R2D2W framework is doing something automatically that ERModernLook doesn't do?).
>
> ----- Mail original -----
> De: "Ramsey Gurley" <email@hidden>
> À: "Pascal Robert" <email@hidden>
> Cc: email@hidden
> Envoyé: Mercredi 9 Juillet 2014 16:36:40
> Objet: Re: Enums in D2W
>
> 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@hidden> 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@hidden>
>> À: "Pascal Robert" <email@hidden>
>> Cc: email@hidden
>> 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@hidden > 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@hidden )
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>>
>>
>>
>>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden