Repository: JetBrains/compose-multiplatform
File: components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/PluralStringResources.kt (Kotlin)

Code before:
 * @return The loaded string resource.
 *
 * @throws IllegalArgumentException If the provided ID or the pluralization is not found in the resource file.
 */
suspend fun getPluralString(resource: PluralStringResource, quantity: Int, vararg formatArgs: Any): String =
    loadPluralString(
        resource, quantity,
        formatArgs.map { it.toString() },
        DefaultResourceReader,
        getSystemResourceEnvironment(),
    )

/**
 * Loads a string using the specified string resource.
 *
 * @param environment The resource environment.
 * @param resource The string resource to be used.
 * @param quantity The quantity of the pluralization to use.
 * @param formatArgs The arguments to be inserted into the formatted string.
 * @return The loaded string resource.
 *
 * @throws IllegalArgumentException If the provided ID or the pluralization is not found in the resource file.
 */
suspend fun getPluralString(
    environment: ResourceEnvironment,
    resource: PluralStringResource,
    quantity: Int,
    vararg formatArgs: Any
): String = loadPluralString(
    resource, quantity,
    formatArgs.map { it.toString() },
    DefaultResourceReader,
    environment
)

private suspend fun loadPluralString(
    resource: PluralStringResource,
    quantity: Int,
    args: List<String>,
    resourceReader: ResourceReader,
    environment: ResourceEnvironment
): String {
    val str = loadPluralString(resource, quantity, resourceReader, environment)
    return str.replaceWithArgs(args)
}


Review comment (suggestion):
```suggestion
@ExperimentalResourceApi
suspend fun getPluralString(
```

Code after:
 * @param formatArgs The arguments to be inserted into the formatted string.
 * @return The loaded string resource.
 *
 * @throws IllegalArgumentException If the provided ID or the pluralization is not found in the resource file.
 */
suspend fun getPluralString(resource: PluralStringResource, quantity: Int, vararg formatArgs: Any): String =
    loadPluralString(
        resource, quantity,
        formatArgs.map { it.toString() },
        DefaultResourceReader,
        getSystemResourceEnvironment(),
    )

/**
 * Loads a string using the specified string resource.
 *
 * @param environment The resource environment.
 * @param resource The string resource to be used.
 * @param quantity The quantity of the pluralization to use.
 * @param formatArgs The arguments to be inserted into the formatted string.
 * @return The loaded string resource.
 *
 * @throws IllegalArgumentException If the provided ID or the pluralization is not found in the resource file.
 */
@ExperimentalResourceApi
suspend fun getPluralString(
    environment: ResourceEnvironment,
    resource: PluralStringResource,
    quantity: Int,
    vararg formatArgs: Any
): String = loadPluralString(
    resource, quantity,
    formatArgs.map { it.toString() },
    DefaultResourceReader,
    environment
)

private suspend fun loadPluralString(
    resource: PluralStringResource,
    quantity: Int,
    args: List<String>,
    resourceReader: ResourceReader,
    environment: ResourceEnvironment
): String {
    val str = loadPluralString(resource, quantity, resourceReader, environment)
    return str.replaceWithArgs(args)
}