Asha

I'm CCing dev list just in case anyone else have other ideas...

GNUstep allows the preffered language to be set using the defaults system.
In order to get the user's preferred languages you'd have to query that.
Currently, -preferredLanguages just queries [NSUserDefaults +userLanguages],
which is a GNUstep addition as far as I can tell.  In my opinion, this is
the right thing to do, but the strings are NOT in the correct format and a
lookup table in needed.

GNUstep-base already has a .plist with languages and locales in
Resources/Languages/Locale.aliases, but it goes in the wrong direction.
NSLocale would need exactly that same list, but backwards... you'd be
searching for AmericanEnglish, for example, and would expect en_US back.
Take a look in Source/GSLocale.m (GSLanguageFromLocale function) to see how
base currently uses Locale.aliases.  The same exact thing would have to be
done with the other plist.  Pretty much you'd want something like
GSLocaleFromLanguage().

Clear as mud?  One of the more experienced (and by that I mean way more
experienced than me) devs might be able to come up with something better.

Stef
On Tue, Jul 27, 2010 at 5:00 PM, asha murthy <[email protected]> wrote:

>   Hi Stef,
>
> I am trying to implement the preferredLanguages  method for NSLocale class.
> I have an idea of how this should be done but am not sure how in objective
> C.
>
> 1)Create a property list for languages
> 2)Create the .plist file
> 3) Use NSUserDefaults in the method to return the sorted array with
> most preferred language that user choses at run time.
>
> Could you please give me some input on how this can be done in Objective C?
>
> Thanks,
> Asha
>
>
_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to