error info handling in MIT krb5 code

Alexandra Ellwood lxs at MIT.EDU
Wed Mar 29 16:08:13 EST 2006

On Mar 29, 2006, at 9:49 AM, Sam Hartman wrote:

>>>>>> "Nicolas" == Nicolas Williams <Nicolas.Williams at> writes:
>>> I'm concerned about having complex formatting in the error
>>> handling interfaces.  I'm concerned that it may make
>>> translation of strings harder particularly for Apple and
>>> Windows.  I don't know what the solution is here.
>     Nicolas> We've run into this problem in Solaris with SASL.
>     Nicolas> Solutions include: per-thread LC_MESSAGES settings and
>     Nicolas> message catalog lookup functions extended to accept a
>     Nicolas> locale name.  None are implemented...
> No, you've run into the problem that dealing with the locale in a
> multi-client server is hard.
> I'm concerned that the native translation mechanism on OS X and
> Windows does not support printf style formatting.

That isn't a problem with Mac OS X.  Here's an example from Tiger's realms editor:

English: "KAppStringAskRemoveServer" = "Are you sure you want to  
delete the server '%@'?";
French:  "KAppStringAskRemoveServer" = "Êtes-vous certain de vouloir  
supprimer le serveur %@ ?";
German:  "KAppStringAskRemoveServer" = "Möchten Sie den Server „%@“  
wirklich löschen?";

Where %@ is an Cocoa-specific printf format character that prints  
Objective-C objects.  The final error string is generated with:

NSString *msg = [NSString stringWithFormat: NSLocalizedString  
(@"KAppStringAskRemoveServer", NULL), serverString];

We could use %s with sprintf and UTF8 strings just as easily.  And  
there's no reason why we couldn't localize the other arguments to  
stringWithFormat: if that was necessary.  Most of my uses were for  
realm names, server names and file paths so I've never needed to do  


Alexandra Ellwood <lxs at>
MIT Kerberos Development Team

More information about the krbdev mailing list