Hello Kotliners?
I am trying to add multi language to KMM project
moko-resources
is good however strings cannot be used inside KMM module , only in IOS,Android
I find this solution, but seems crazy
Copy code
interface StringProvider {
var appName :String
fun init(language : String)
}
class ArabicStrings : StringProvider {
override var appName = "epstein reporter"
}
class EnglishStrings : StringProvider {
override var appName = "ابلاغ عن خطر"
}
my cons
1. 3000 words will be loaded to memory, when 10% of them will be used
2. load words by lazy { } will add more complexity
3. xml is easy to manage
p
Pablichjenkov
01/15/2024, 7:55 PM
Have you tried Lyricist or Libre?
p
pers
01/15/2024, 8:19 PM
Lyricist only cocopods
Libre scale up to 10 words after that it is super crazy
p
Pablichjenkov
01/16/2024, 2:46 AM
Got you, I didn't know that, thanks for sharing your experience.
Something like the solution above should work, I agree with your points, 1 and 2 definitely a big no. Just use a json or xml file for this purpose. You will need some optimizations to read from this file.