On Wed, Sep 16, 2020, 05:23 Stefan Pauwels <[email protected]> wrote:

> 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?
>
> Best Regards
> Stefan
>

Hi Stefan,
The locale is set at the operating system or user level, either by using
the $LANG shell variable (returned by +systemLocale) or Locale default
(returned by +currentLocale).

It's been a long time since I wrote this code, but if I still remember
correctly NSLocale falls back to whatever is specified in $LANG if the
Locale default is unset. If $LANG is also unset, then it falls back to
en_US_POSIX.

You could also also create your own NSLocale using
+localeWithLocaleIdentifier:. This will not interfere with the system or
current locales.

Stefan

>

Reply via email to