Re: Predicate syntax and localisation
Re: Predicate syntax and localisation
- Subject: Re: Predicate syntax and localisation
- From: Keary Suska <email@hidden>
- Date: Mon, 07 Oct 2013 08:30:54 -0600
On Oct 6, 2013, at 3:45 PM, Laurent Cerveau wrote:
> I am using NSPredicateEditor to display some predicates and after a few fights all is now fine. A feature I find particularly convenient is the use of a formatting dictionary to display user friendly sentences to a user.
> In another part of my application, I show some data computed based on the edited predicate and I would like to show the predicate that originates this result but in a "human friendly way". So I thought I would reuse this dictionary/strings file.
> So basically I would like to have code like
> NSLocalizedString(predicate.predicateFormat, nil);
>
> However predicateFormat does not seem to return "proper localizable predicate". That is for example
> loc name BEGINSWITH "MM"
> and not
> loc name begins with "MM"
>
> Or
> volumeType == 27
>
> while I have
>
> volumeType is 27
>
> in the strings file.
>
> Is there a way to convert between the 2 (or do I miss a point?)
It is not the canonical way to use localization, but you theoretically should be able to use it in this way, as long as all of your predicate strings are static and have an exact character for character match in your Localizable.strings or equivalent file.
IMHO it would be better to simply have a translation routine that converts predicates to a desired plain-language that itself could be properly localized to produce, for instance, "volumeType est de 27" as well.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden