NSTextView always uses system language when hyphenating?

It seems to me that English texts will get better hyphenation if the system language in macOS is set to English. It is hard to be sure, but I think that when my system is set to Swedish, I see a lot more hyphenations like "somet-hing".

This is on macOS Big Sur, in an NSTextView with hyphenation switched on by setting hyphenationFactor to 1 on an NSParagraphStyle object in an NSAttritributedString, not a web view or anything like that. The application is not localized, so the app language is English. Setting NSAccessibilityLanguageTextAttribute to "en-US" seems to have no effect.

I'd like to know if anyone can confirm this, and if so, is there anything to do about it?

Answered by Dalaplan in 673459022
I got this reply on StackOverflow:

NSAttributedString reads the language from NSUserDefaults with key NSHyphenationLanguage. This is undocumented and may not work in every version of macOS.

I guess that is as close to a fix for this as I am going to get.
It was pointed out to me that the documentation for hyphenationFactor states "This property detects the user-selected language by examining the first item in preferredLanguages." So I guess there is no way to change this undesirable behaviour.
Accepted Answer
I got this reply on StackOverflow:

NSAttributedString reads the language from NSUserDefaults with key NSHyphenationLanguage. This is undocumented and may not work in every version of macOS.

I guess that is as close to a fix for this as I am going to get.
NSTextView always uses system language when hyphenating?
 
 
Q