From 921c0a47bdc2cc72d9f8a1a5a7e8f64759a6822f Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 8 Oct 2026 16:57:09 -0400 Subject: [PATCH] Real plurals: the web's sync messages and Android's tag counts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Web: one counted(n, one, other) helper. The sync screen's three "(s)" messages (attachments that didn't download, changes refused, files that didn't upload) now say "1 file" / "2 files". The six hand-written ternaries (SyncView x2, ImportNotes, GroupList, ShareDialog, LabelsModal) use it too. Android: tags_count was two strings chosen in code, and is now . The delete confirmation read "It is on 1 notes … removed from all of them" and now has a one form of its own. Operator decision on #5371, 2026-10-08. Co-Authored-By: Claude Opus 5.5 --- .../java/com/fabledsword/inkwell/ui/TagsScreen.kt | 6 +++--- android/app/src/main/res/values/strings.xml | 11 ++++++++--- frontend/src/components/GroupList.vue | 3 ++- frontend/src/components/ImportNotes.vue | 4 ++-- frontend/src/components/LabelsModal.vue | 3 ++- frontend/src/components/ShareDialog.vue | 4 ++-- frontend/src/counted.test.ts | 14 ++++++++++++++ frontend/src/counted.ts | 5 +++++ frontend/src/views/SyncView.vue | 12 +++++++----- 9 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 frontend/src/counted.test.ts create mode 100644 frontend/src/counted.ts diff --git a/android/app/src/main/java/com/fabledsword/inkwell/ui/TagsScreen.kt b/android/app/src/main/java/com/fabledsword/inkwell/ui/TagsScreen.kt index fa99a18..66270f7 100644 --- a/android/app/src/main/java/com/fabledsword/inkwell/ui/TagsScreen.kt +++ b/android/app/src/main/java/com/fabledsword/inkwell/ui/TagsScreen.kt @@ -39,6 +39,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.res.pluralStringResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.unit.dp @@ -203,7 +204,7 @@ fun TagsScreen( body = open.tag.count ?.takeIf { it > 0 } - ?.let { stringResource(R.string.tags_delete_body_counted, it) } + ?.let { pluralStringResource(R.plurals.tags_delete_body_counted, it.toInt(), it.toInt()) } ?: stringResource(R.string.tags_delete_body), footnote = stringResource(R.string.tags_delete_from_text), confirm = stringResource(R.string.tags_delete_confirm), @@ -378,8 +379,7 @@ private fun countLabel(count: Long?): String = when { count == null -> "" count <= 0L -> stringResource(R.string.tags_count_none) - count == 1L -> stringResource(R.string.tags_count_one) - else -> stringResource(R.string.tags_count, count.toInt()) + else -> pluralStringResource(R.plurals.tags_count, count.toInt(), count.toInt()) } /** diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 60f89f0..0f7d5f2 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -137,8 +137,10 @@ Back New tag Create - %1$d notes - 1 note + + %d note + %d notes + No notes yet No tags yet Create one above, or write a #tag in a note and it becomes one. @@ -166,7 +168,10 @@ Delete Delete %1$s? It will be removed from every note that has it, on every device you sync with. The notes themselves are kept. - It is on %1$d notes. It will be removed from all of them, on every device you sync with. The notes themselves are kept. + + It is on %d note. It will be removed from it, on every device you sync with. The note itself is kept. + It is on %d notes. It will be removed from all of them, on every device you sync with. The notes themselves are kept. + Delete