Skip to content

Locale.current returns en_US even when the user's locale settings is different on Linux #717

Open
@jasaldivara

Description

@jasaldivara

I'm using Swift Language on a Linux system

My OS Distro is Fedora 37 on an ARM64 CPU
I'm using Swift version 5.7.3 (swift-5.7.3-RELEASE) from the Fedora repos

I'm using GNOME desktop and have set my user session language to spanish, and my region to Mexico

When I run the locale command on a terminal, I get this output:

LANG=es_ES.UTF-8
LC_CTYPE="es_ES.UTF-8"
LC_NUMERIC=es_MX.UTF-8
LC_TIME=es_MX.UTF-8
LC_COLLATE="es_ES.UTF-8"
LC_MONETARY=es_MX.UTF-8
LC_MESSAGES="es_ES.UTF-8"
LC_PAPER=es_MX.UTF-8
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT=es_MX.UTF-8
LC_IDENTIFICATION="es_ES.UTF-8"
LC_ALL=

But when I reference Locale.current, either on a compiled program, or from the Swift REPL, I get a "en_US" Locale. For example, if I run print (Locale.current.identifier) on the REPL, i get:

en_US

I think the expected behavior is that Locale.current returns the same locale from my user settings. Or am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions