|
|
|
@ -45,6 +45,22 @@ fun pluralStringResource(resource: PluralStringResource, quantity: Int): String
|
|
|
|
|
suspend fun getPluralString(resource: PluralStringResource, quantity: Int): String = |
|
|
|
|
loadPluralString(resource, quantity, DefaultResourceReader, getResourceEnvironment()) |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 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. |
|
|
|
|
* @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 |
|
|
|
|
): String = loadPluralString(resource, quantity, DefaultResourceReader, environment) |
|
|
|
|
|
|
|
|
|
private suspend fun loadPluralString( |
|
|
|
|
resource: PluralStringResource, |
|
|
|
|
quantity: Int, |
|
|
|
@ -102,6 +118,29 @@ suspend fun getPluralString(resource: PluralStringResource, quantity: Int, varar
|
|
|
|
|
getResourceEnvironment(), |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 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, |
|
|
|
|