Browse Source
`NSLocale.regionCode` is only available on macOS 14 and higher. This PR changes the code so it works on older versions, similar to #4473 but for macOS instead of iOS https://developer.apple.com/documentation/foundation/nslocale/4172868-regioncode?language=objc In addition to the fix explained above, I also applied the another fix as on iOS here: https://github.com/JetBrains/compose-multiplatform/pull/4507. I tested it with these settings: ![Screenshot 2024-12-09 at 21 27 11](https://github.com/user-attachments/assets/4673ff41-1c0e-46dc-9292-ab8da57b6e53) Resulting in: ``` println(NSLocale.currentLocale().localeIdentifier) -> en_NL println(NSLocale.preferredLanguages().first().let { NSLocale(it as String) }.localeIdentifier) -> en-GB ``` In this case I think `preferredLanguages` is the better option as compose is interested in the actual set language, which is English (UK). Note that there are still some additional issues explained in detail here: https://youtrack.jetbrains.com/issue/CMP-6614/iOS-Localization-strings-for-language-qualifiers-that-are-not-the-same-between-platforms-appear-not-translated For this PR, I decided to just match the iOS behaviour for now, so at least it is consistent. In the future I guess some locale mapping is required (see my comment in YouTrack)pull/3743/merge
Thomas Vos
4 days ago
committed by
GitHub
1 changed files with 8 additions and 3 deletions
Loading…
Reference in new issue