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

AmrJyniat

03/27/2023, 3:42 PM
I tried to use string formatted from the shared code but it seems to not work, although its works fine on the platform side.
Here is my string resource:
Copy code
<string name="login_succeed">Login succeed! \'%s\'</string>
And here is the used way to get the formatted string:
Copy code
MR.strings.login_succeed.format(arg).toString()
I noticed that when I use the above code on the Android side it gives me another form of
toString()
that accept the context as parameter, can I use the same function in the shared code?
a

alex009

03/27/2023, 3:48 PM
you can't get localized text in shared code - android require context to get String. only in compose multiplatform you can get localized string inside @Composable
a

AmrJyniat

03/27/2023, 3:51 PM
I see, thanks
7 Views