diff --git a/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/ResourceEnvironment.ios.kt b/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/ResourceEnvironment.ios.kt index b941d0ff10..6fd9d908e9 100644 --- a/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/ResourceEnvironment.ios.kt +++ b/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/ResourceEnvironment.ios.kt @@ -8,14 +8,16 @@ import platform.UIKit.UIUserInterfaceStyle internal actual fun getSystemEnvironment(): ResourceEnvironment { val locale = NSLocale.currentLocale() + val languageCode = locale.languageCode + val regionCode = locale.objectForKey(NSLocaleCountryCode) as? String val mainScreen = UIScreen.mainScreen val isDarkTheme = mainScreen.traitCollection().userInterfaceStyle == UIUserInterfaceStyle.UIUserInterfaceStyleDark //there is no an API to get a physical screen size and calculate a real DPI val density = mainScreen.scale.toFloat() return ResourceEnvironment( - language = LanguageQualifier(locale.languageCode), - region = RegionQualifier(locale.regionCode.orEmpty()), + language = LanguageQualifier(languageCode), + region = RegionQualifier(regionCode.orEmpty()), theme = ThemeQualifier.selectByValue(isDarkTheme), density = DensityQualifier.selectByDensity(density) )