On Oct 28, 2008, at 3:33 PM, Markus Spoettl wrote:

Hi Peter,

Let me know if you have any questions,

I do! I tried to localize the All/Any/None sentence for the German localization. When I do this I get an exception and the following console log:

10/28/08 3:20:54 PM myApp[43721] Error parsing localization!
     Key: %d %@
     Value: %1$d %2$@
     Error is: The maximum given order was 2, but nothing has order 1.

My guess is that you're using the same strings file for this and other uses. The %[...]@ syntax is unique to NSRuleEditor/NSPredicateEditor and so it needs its own strings file. %d should never appear in one of these strings.

Here's something that may help - there's a method on NSRuleEditor: - (NSData *)_generateFormattingDictionaryStringsFile. It gives you a strings file (as UTF16 data) appropriate for that control - write the data to a .strings file and then you can start translating it.

That method should never be called in production code but it can be useful for generating the strings file.

The localization part looks like this:

"%[Any]@ of the following are true" = "%[Eine]@ der folgenden Bedingungen treffen zu"; "%[All]@ of the following are true" = "%[Alle]@ der folgenden Bedingungen treffen zu"; "%[None]@ of the following are true" = "%[Keine]@ der folgenden Bedingungen treffen zu";

I've set the predicate editor's formattingStringsFilename in - awakeFromNib and implemented

- (NSDictionary *)ruleEditor:(NSPredicateEditor *)editor predicatePartsForCriterion:(id)criterion withDisplayValue:(id)value inRow:(NSInteger)row
{
   NSMutableDictionary *result = [NSMutableDictionary dictionary];
   if ([value isKindOfClass:[NSString class]]) {
if ([value isEqual:@"Any"]) [result setObject:[NSNumber numberWithInt:NSOrPredicateType] forKey:NSRuleEditorPredicateCompoundType]; else if ([value isEqual:@"All"]) [result setObject:[NSNumber numberWithInt:NSAndPredicateType] forKey:NSRuleEditorPredicateCompoundType]; else if ([value isEqual:@"None"]) [result setObject:[NSNumber numberWithInt:NSNotPredicateType] forKey:NSRuleEditorPredicateCompoundType];
   }
   return result;
}

which never gets called (probably because it's a NSPredicateEditor and as such does not use delegate methods?).

Right, those delegate methods are not used for NSPredicateEditor. All that's necessary for localization is to set the strings file.

-Peter
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to