diff --git a/app/src/androidTest/java/org/dhis2/usescases/flow/searchFlow/SearchFlowTest.kt b/app/src/androidTest/java/org/dhis2/usescases/flow/searchFlow/SearchFlowTest.kt index 41d93c24c26..7c7d105c5b2 100644 --- a/app/src/androidTest/java/org/dhis2/usescases/flow/searchFlow/SearchFlowTest.kt +++ b/app/src/androidTest/java/org/dhis2/usescases/flow/searchFlow/SearchFlowTest.kt @@ -27,6 +27,7 @@ class SearchFlowTest : BaseTest() { setDatePicker() val registerTEIDetails = createRegisterTEI() val enrollmentStatus = context.getString(R.string.filters_title_enrollment_status) + .format(context.resources.getQuantityString(R.plurals.enrollment, 1)) val filterCounter = "1" val filterTotalCount = "2" prepareWomanProgrammeIntentAndLaunchActivity(rule) diff --git a/app/src/androidTest/java/org/dhis2/usescases/searchte/SearchTETest.kt b/app/src/androidTest/java/org/dhis2/usescases/searchte/SearchTETest.kt index b7cf9e5d5f2..7b753c30bd7 100644 --- a/app/src/androidTest/java/org/dhis2/usescases/searchte/SearchTETest.kt +++ b/app/src/androidTest/java/org/dhis2/usescases/searchte/SearchTETest.kt @@ -145,6 +145,7 @@ class SearchTETest : BaseTest() { @Test fun shouldSuccessfullyFilterByEnrollmentStatusActive() { val enrollmentStatusFilter = context.getString(R.string.filters_title_enrollment_status) + .format(context.resources.getQuantityString(R.plurals.enrollment, 1)) val totalFilterCount = "2" val filterCount = "1" @@ -310,6 +311,7 @@ class SearchTETest : BaseTest() { val lastName = "Jones" val namePosition = 0 val enrollmentStatus = context.getString(R.string.filters_title_enrollment_status) + .format(context.resources.getQuantityString(R.plurals.enrollment, 1)) val totalCount = "2" val totalFilterCount = "1" diff --git a/commons/src/main/java/org/dhis2/commons/resources/ResourceManager.kt b/commons/src/main/java/org/dhis2/commons/resources/ResourceManager.kt index 4b9bba7bcd4..b6a257e0b1d 100644 --- a/commons/src/main/java/org/dhis2/commons/resources/ResourceManager.kt +++ b/commons/src/main/java/org/dhis2/commons/resources/ResourceManager.kt @@ -4,6 +4,8 @@ import android.content.Context import androidx.annotation.DrawableRes import androidx.annotation.PluralsRes import androidx.annotation.StringRes +import androidx.compose.ui.text.capitalize +import androidx.compose.ui.text.intl.Locale import androidx.core.content.ContextCompat import org.dhis2.commons.R import org.dhis2.commons.network.NetworkUtils @@ -39,10 +41,16 @@ class ResourceManager( } ?: getPlural(R.plurals.enrollment, quantity) return with(getString(stringResource)) { + val finalLabel = if (this@with.startsWith("%s")) { + enrollmentLabel.capitalize(Locale.current) + } else { + enrollmentLabel + } + if (formatWithQuantity) { - format(quantity, enrollmentLabel) + format(quantity, finalLabel) } else { - format(enrollmentLabel) + format(finalLabel) } } }