It seems to me that English texts will get better hyphenation if the system language in macOS is set to English. Thing is, it is hard to be sure, and restarting with a new system language is cumbersome, so I haven't tested this thoroughly, but I'm reasonable sure that I've only seen "somet-hing" and similar when my system was set to Swedish.
This is on macOS Big Sur, in an NSTextView with hyphenation switched on by setting hyphenationFactor to 1 on an NSParagraphStyle object in an NSAttributedString. It is not a web view. The application is not localized, so the app language is English even when the system is set to Swedish. Setting NSAccessibilityLanguageTextAttribute to "en-US" seems to have no effect.
I'd like to know if anyone can confirm this, and if so, can anything be done about it?
From the documentation of
hyphenationFactor
:+[NSLocale preferredLanguages]
is called once from-[NSAttributedString lineBreakByHyphenatingBeforeIndex:withinRange:]
but before that the language is read fromNSUserDefaults
with keyNSHyphenationLanguage
. Setting the language withseems to work but it is undocumented, so use it at your own risk.