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

jeran

05/30/2022, 8:40 PM
hello all. my team is using moko resources for KMM. first of all, thank you for all the work! we’re working with formatting plurals and realized that the “zero” type works differently on iOS and on Android. saw this comment in one of the tests:
// 0 on android in english will be other
the strings we’re hoping to achieve are: x == 0 -> “Just now” x == 1 -> “1 hour ago” x > 1 -> “x hours ago” how can we achieve this if android doesn’t match zero properly? https://github.com/icerockdev/moko-resources/blob/a4759a4439a492b6b8a6f7fa631be7cf[…]library/src/commonMain/kotlin/com/icerockdev/library/Testing.kt
1
a

alex009

05/31/2022, 4:23 PM
hi. as i see - only way is process zero count by another logic. something like
Copy code
if(counter == 0) MR.strings.some_zero_text.desc()
else MR.strings.some_plural.desc(counter)
j

jeran

05/31/2022, 4:47 PM
oh i see. this is how the pure android version works as well. i didn’t realize it was expected behavior. thank you
50 Views