Opened 12 months ago

Closed 5 months ago

#18734 closed bug (fixed)

LC_* envars not updated after changing "Preferred language" in Locale preflet.

Reported by: bipolar Owned by: axeld
Priority: normal Milestone: R1/beta5
Component: Servers/launch_daemon Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description (last modified by bipolar)

After changing "Preferred language" in Locale preflet, say, from "English" to "Español (Latinoamérica)", the LC_* environmental variables under a shell session are still set to en.UTF-8, and only updated after performing a reboot.

Seems that /system/boot/SetupEnvironment is where we set:

# Locale
export LC_MESSAGES=`locale --message`
export LC_NUMERIC=`locale --format`
export LC_TIME=`locale --time`
export LC_COLLATE=$LC_MESSAGES
export LC_CTYPE=$LC_MESSAGES
export LC_MONETARY=$LC_NUMERIC

Not sure if it is the best place, but... moving those to /system/settings/etc/profile makes the reboot unnecessary, as they get updated (for new shell sessions) right after changing languages.


Sidenote:

While testing these things... I've noticed that no matter what language I choose, LC_TYPE always has the same value: LC_TYPE=en_US.UTF-8.

That seems to be defined by launch_daemon, originally introduced in bd1c9bf338fdae8456577c557faf36aba7b87cd5.

I couldn't find much info on LC_TYPE, and considering that it doesn't seems to be part of LC categories, and not mentioned in POSIX...

I wonder if that's a typo, meant to be LC_CTYPE, as SetupEnvironment also exports at its start.

Change History (5)

comment:1 by bipolar, 12 months ago

Description: modified (diff)

comment:2 by waddlesplash, 12 months ago

Component: - GeneralServers/launch_daemon
Owner: changed from nobody to axeld

comment:3 by bipolar, 5 months ago

I can still reproduce this issue, on beta4, fully updated, 32 and 64 bits.

Starting with Language and formatting both set to English:

> set | grep ^LC_
LC_COLLATE=en.UTF-8
LC_CTYPE=en.UTF-8
LC_MESSAGES=en.UTF-8
LC_MONETARY=en.UTF-8
LC_TIME=en.UTF-8
LC_TYPE=en_US.UTF-8

After changing that locale to, "Spanish (Latin America)" (either language, formating, or both), I keep getting the same output for set | ^LC, even new bash sessions (and even after restarting Terminal).

After rebooting:

> set | grep ^LC_
LC_COLLATE=es_419.UTF-8
LC_CTYPE=es_419.UTF-8
LC_MESSAGES=es_419.UTF-8
LC_MONETARY=es_419.UTF-8
LC_TIME=es_419.UTF-8
LC_TYPE=en_US.UTF-8

---

Applying https://review.haiku-os.org/c/haiku/+/7792 solves the issue right away for me.


For reference, the sidenote about the never-changing (and typoed) LC_TYPE got resolved by hrev57828.

Last edited 5 months ago by bipolar (previous) (diff)

comment:4 by nephele, 5 months ago

Milestone: UnscheduledR1/beta5

Fix merged in hrev57850

comment:5 by waddlesplash, 5 months ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.