From 02e08a3d22e65e6dd6a026ebcd65234723e1e66e Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Fri, 31 Jul 2026 15:21:03 +0000 Subject: [PATCH] Capitalize weekday names in the scheduled-message time picker. --- .../java/org/thoughtcrime/securesms/util/DateUtils.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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)