discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting a specific Locale


From: Richard Frith-Macdonald
Subject: Re: Getting a specific Locale
Date: Thu, 16 Jan 2014 12:59:49 +0000

On 16 Jan 2014, at 11:50, Riccardo Mottola <riccardo.mottola@libero.it> wrote:

> Hi,
> 
> in GNUMail I have the following code:
> 
> #ifndef MACOSX
>  aLocale = [NSDictionary dictionaryWithContentsOfFile: [[NSBundle 
> bundleForLibrary: @"gnustep-base"]
>                              pathForResource: @"English"
>                              ofType: nil
>                              inDirectory: @"Languages"]];
> #else
>  aLocale = [NSDictionary dictionaryWithContentsOfFile: [[NSBundle 
> bundleForClass:[NSObject class]]
>                              pathForResource: @"English"
>                              ofType: nil
>                              inDirectory: @"Languages"] ];
> #endif

The two bits of code above have identical effect as long as NSObject comes from 
GNUstep base(which it practically has to), so ther's no need to have two code 
paths as far as I can see.

> how are you supposed to get a specific locale, before the existence of 
> NSLocale? A first test shows that right now  the Mac code seems to work on 
> GNUstep too, so perhaps this is old cruft, but I wanted to understand better 
> and know the alternatives.

The above code is returning a locale dictionary.
Prior to the existence of NSLocale, methods which needed a locale would expect 
an NSDictionary to be passed to them.
Now I think that such methods can accept either a locale dictionary or an 
NSLocale instance, since NSLocale responds to -objectForKey:


reply via email to

[Prev in Thread] Current Thread [Next in Thread]