https://kotlinlang.org logo
#compose
Title
# compose
j

Joel Denke

02/26/2024, 8:44 AM
Is it possible to use
Locale.getAvailableLocales()
in CMP scope? When using Locale.current you get platform variant not seems to expose these kind of APIs. If not, is there any libraries to do this, I couldve missed?
d

Dima Avdeev

02/26/2024, 9:28 AM
Locale.getAvailableLocales()
is available only on desktopMain and androidMain sourceSet's. But you can create your own expect / actual implementation for all platforms. On iOS sourceSet you can use avaliableLocaleIdentifiers for implementation
1
j

Joel Denke

02/26/2024, 9:50 AM
Thanks! 👌
Also one issue I think here, is that the list in iOS and Android/Jvm will differ right. In my case want to use it to get dynamic list of spoken languages in the world. It will be used for end user to select which languages they speak 🙂 Not related to any Locale things in the end. But was thinking that API would be possible to use for this use case.