https://kotlinlang.org logo
Title
k

kevindmoore

08/16/2021, 3:25 PM
How do you handle string resources in desktop?
d

dbaelz

08/16/2021, 3:35 PM
While playing around with desktop apps and Compose for Desktop, I've used
java.util.ResourceBundle
because I want to do some localization. I'm not sure, if there are better alternatives and the last time I did desktop apps professionally is some time ago 😉 Without localization: Object with const Strings. Plain and simple
k

kevindmoore

08/16/2021, 4:01 PM
Seems like we'll need some sort of expect/actual library so that for Android it uses built in resources and for desktop ResourceBundle
d

dbaelz

08/16/2021, 4:11 PM
Yes, when Compose Desktop is getting more traction the topic will be much more important. Maybe even with stuff that isn't supported in ResourceBoundles like quantity string/pluralization. Also, there is an open issue about the topic in https://github.com/JetBrains/compose-jb/issues/425
k

kevindmoore

08/16/2021, 4:12 PM
Now, that I think about it, we used to do this all the time in Swing
👍 2
m

Michael Paus

08/16/2021, 6:30 PM
This issue needs a solution not only for String resources. There must be a concept to handle any kind of resource in a platform independent way, e.g. image resources. The problem is that Android deviated from the standard Java way of doing these things and has its own concepts. Maybe a totally new concept is needed for this. (By the way, as far as I know the good old Java methods still work in Android. They are just not used normally.)
a

alex009

08/25/2021, 4:48 PM
now you can try moko-resources - we release 0.17.0 with jvm support