Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Locale.Script seems to be returning a value even though the language has no script

We just dropped support for iOS 16 in our app and migrated to the new properties on Locale to extract the language code, region, and script. However, after doing this we are seeing an issue where the script property is returning a value when the language has no script.

Here is the initializer that we are using to populate the values. The identifier is coming from the preferredLanguages property that is found on Locale.

init?(identifier: String) {
    let locale = Locale(identifier: identifier)
    guard
        let languageCode = locale.language.languageCode?.identifier
    else {
        return nil
    }
    language = languageCode
    region = locale.region?.identifier
    script = locale.language.script?.identifier
}

Whenever I inspect locale.language I see all of the correct values. However, when I inspect locale.language.script directly it is always returning Latn as the value. If I inspect the deprecated locale.scriptCode property it will return nil as expected.

Here is an example from the debugger for en-AU. I also see the same for other languages such as en-AE, pt-BR.

Since the language components show the script as nil, then I would expect locale.language.script?.identifier to also return nil.

I also opened FB17775472 to report this as well.

Locale.Script seems to be returning a value even though the language has no script
 
 
Q