diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/DateUtils.kt b/app/src/main/java/org/thoughtcrime/securesms/util/DateUtils.kt index 6c5ba9e087..6fc4b99a3c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/DateUtils.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/util/DateUtils.kt @@ -296,7 +296,9 @@ object DateUtils : android.text.format.DateUtils() { } else if (isTomorrow(timestamp)) { context.getString(R.string.DateUtils_tomorrow) } else { - localDateTime.dayOfWeek.getDisplayName(TextStyle.FULL, Locale.getDefault()) + val locale = Locale.getDefault() + // Many locales (e.g. Dutch, French, Spanish) render weekday names in lowercase, but this is used as a standalone label, so we want it capitalized. + localDateTime.dayOfWeek.getDisplayName(TextStyle.FULL, locale).capitalizeFirstChar(locale) } val time = localDateTime.toLocalTime().formatHours(context) return context.getString(R.string.DateUtils_schedule_at, dayModifier, time) @@ -457,6 +459,13 @@ object DateUtils : android.text.format.DateUtils() { return this } + /** + * Uppercases the first character using the rules of the provided [locale]. A no-op for scripts that have no notion of case. + */ + private fun String.capitalizeFirstChar(locale: Locale): String { + return replaceFirstChar { it.titlecase(locale) } + } + private data class TemplateLocale(val template: String, val locale: Locale) private data class Is24HourDateEntry(val value: Boolean, val lastUpdated: Long)