discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Correct Current NSLocale on Android


From: Frederik Seiffert
Subject: Re: Correct Current NSLocale on Android
Date: Thu, 17 Sep 2020 10:41:53 +0200

Hi Stefan,

Can you try using -[NSLocale autoupdatingCurrentLocale] as suggested by Wolfgang?

I think currentLocale gets initialized once doesn’t change when updating the user default value.

Frederik


Am 16.09.2020 um 17:37 schrieb Stefan Pauwels <stefan@pauwels.ch>:

But how? Even if I do this:
[[NSUserDefaults standardUserDefaults] setObject:@"de_CH" forKey:@"Locale"];
I will always get „en_US_POSIX“ for
NSLog(@"Current Locale: %@", [NSLocale currentLocale]);


Am 16.09.2020 um 14:59 schrieb Wolfgang Lux <wolfgang.lux@gmail.com>:

Hi Stefan

Am 16.09.2020 um 12:23 schrieb Stefan Pauwels <stefan@pauwels.ch>:

Hi

I am initializing GNUstep on Android as advised in the tools-android README, i.e. I am calling
[NSUserDefaults setUserLanguages:]
which seems to work for just setting the language, but when I try to rely on the currentLocale (for other information like region, metric system usage, etc.) I always get „en_US_POSIX“ as the locale.

Is there a way to manually init the locale correctly?

The user’s current locale is initialized from the user defaults. This should normally be modified by the defaults tool from the command line or by the SystemPreferences application.
To override that programmatically in your own application set the "Locale" default in the standard user defaults. You may also need to use autoupdatingCurrentLocale to see the effect of the change.

Wolfgang



reply via email to

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