0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 09:33:54 +01:00

Apply correct pluralisation to minimap error count

Fixes #9497
This commit is contained in:
Matt Westcott 2022-10-27 17:57:59 +01:00 committed by LB (Ben Johnston)
parent a2f491e0d8
commit b848254873
3 changed files with 8 additions and 2 deletions

View File

@ -109,6 +109,7 @@ Changelog
* Fix: Update latest version message on Dashboard to accept dev build version format used on nlightly builds (Sam Moran) * Fix: Update latest version message on Dashboard to accept dev build version format used on nlightly builds (Sam Moran)
* Fix: references extraction for ChooserBlock (Alex Tomkins) * Fix: references extraction for ChooserBlock (Alex Tomkins)
* Fix: Regression in field width for authentication pages (log in / password reset) (Chisom) * Fix: Regression in field width for authentication pages (log in / password reset) (Chisom)
* Fix: Ensure the new minimap correctly pluralises error counts for `aria-label`s (Matt Westcott)
4.0.4 (18.10.2022) 4.0.4 (18.10.2022)

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { gettext } from '../../utils/gettext'; import { ngettext } from '../../utils/gettext';
import Icon from '../Icon/Icon'; import Icon from '../Icon/Icon';
export interface MinimapMenuItem { export interface MinimapMenuItem {
@ -35,7 +35,11 @@ const MinimapItem: React.FunctionComponent<MinimapItemProps> = ({
}) => { }) => {
const { href, label, icon, required, errorCount, level } = item; const { href, label, icon, required, errorCount, level } = item;
const hasError = errorCount > 0; const hasError = errorCount > 0;
const errorsLabel = gettext('{num} errors').replace('{num}', `${errorCount}`); const errorsLabel = ngettext(
'{num} error',
'{num} errors',
errorCount,
).replace('{num}', `${errorCount}`);
const text = label.length > 26 ? `${label.substring(0, 26)}` : label; const text = label.length > 26 ? `${label.substring(0, 26)}` : label;
return ( return (
<a <a

View File

@ -135,6 +135,7 @@ There are multiple improvements to the documentation theme this release, here ar
* Update latest version message on Dashboard to accept dev build version format used on nlightly builds (Sam Moran) * Update latest version message on Dashboard to accept dev build version format used on nlightly builds (Sam Moran)
* Ensure `ChooserBlock.extract_references` uses the model class, not the model string (Alex Tomkins) * Ensure `ChooserBlock.extract_references` uses the model class, not the model string (Alex Tomkins)
* Regression in field width for authentication pages (log in / password reset) (Chisom) * Regression in field width for authentication pages (log in / password reset) (Chisom)
* Ensure the new minimap correctly pluralises error counts for `aria-label`s (Matt Westcott)
## Upgrade considerations ## Upgrade considerations