Closed FunkyMuse closed 6 months ago
There is third parameter for arguments:
fun pluralStringResource(resource: PluralStringResource, quantity: Int, vararg formatArgs: Any): String {...}
You are supposed to use
val text = pluralStringResource(Res.plurals.downloading_files, 10, 10)
Hello, interesting why the first one is needed, when we provide just resource and quantity?
@b0r1ngx The design is an imitation of Android's plural string resource. We can't decide which argument should be used as the quantity when there are multiple format arguments.
@terrakok, the plural string example in the new documentation provides a code without format arguments.
Text(pluralStringResource(Res.string.new_message, 1))
I think the third formatArgs argument should be noted to make fewer people confused.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Describe the bug Plural quantity placeholder is not respected
Affected platforms
Versions
To Reproduce Steps and/or the code snippet to reproduce the behavior:
It just displays the placeholder
Downloading %1$d files
Expected behavior The text should show
Downloading 10 files
Screenshots