If you change the iOS language, the device will restart automatically. At this time, if you acquire the language with the network extension, the language before the change will be acquired. You must manually restart the device to get the changed language.
let language = NSLocale.preferredLanguages.first?.components(separatedBy: "-").first
This happens on iOS 15.1 and later. In 15.0.1 I was able to get the changed language.
Is it a bug?