A3: singular and plural counts in the Problems window

The summary and the per-file count tooltip pick one/other catalog
messages ("1 error", "3 errors") instead of the plural-free wording.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-31 14:55:15 +01:00
parent 765dbf71b7
commit af24899ac5
3 changed files with 35 additions and 7 deletions

View file

@ -68,13 +68,27 @@ const status = computed(() => {
return t("problems.empty");
}
const c = problems.counts;
const others = c.info + c.hint;
return t("problems.summary", {
errors: String(c.error),
warnings: String(c.warning),
infos: String(c.info + c.hint),
errors:
c.error === 1 ? t("problems.count.error.one") : t("problems.count.error.other", { count: String(c.error) }),
warnings:
c.warning === 1
? t("problems.count.warning.one")
: t("problems.count.warning.other", { count: String(c.warning) }),
infos: t("problems.count.other", { count: String(others) }),
});
});
/**
* The tooltip of a file's problem count, singular for one.
*
* @param count - the file's problems.
*/
function fileCountTitle(count: number): string {
return count === 1 ? t("problems.file.count.one") : t("problems.file.count.other", { count: String(count) });
}
/** A file with its rows and their indexes in the flat list. */
interface ProblemGroup {
/** Project-relative path. */
@ -238,7 +252,7 @@ watch(
<span class="problems__file-dir">{{ dirName(group.path) }}</span>
<span
class="problems__file-count"
:title="t('problems.file.count', { count: String(group.rows.length) })"
:title="fileCountTitle(group.rows.length)"
>{{ group.rows.length }}</span>
</div>
<div

View file

@ -208,8 +208,14 @@
"palette.label": "Command palette",
"palette.noMatches": "No matching commands",
"palette.placeholder": "Type a command name",
"problems.count.error.one": "1 error",
"problems.count.error.other": "{count} errors",
"problems.count.other": "{count} other",
"problems.count.warning.one": "1 warning",
"problems.count.warning.other": "{count} warnings",
"problems.empty": "No problems found in open files",
"problems.file.count": "{count} problems",
"problems.file.count.one": "1 problem",
"problems.file.count.other": "{count} problems",
"problems.list.label": "Problems of the project",
"problems.lsp.failed": "Phpactor stopped: {message}",
"problems.lsp.progress.label": "Language server: {title}",
@ -223,7 +229,7 @@
"problems.severity.hint": "Hint",
"problems.severity.info": "Information",
"problems.severity.warning": "Warning",
"problems.summary": "Errors: {errors}, warnings: {warnings}, other: {infos}",
"problems.summary": "{errors}, {warnings}, {infos}",
"problems.toolWindow.title": "Problems",
"project.empty.noFolder": "No folder is open.",
"project.openFolder": "Open Folder…",