import { _n, sprintf } from '@wordpress/i18n'; import type { Fix } from '../api/types/fixes'; import { formatNumber } from '../lib/numbers'; export function unchangedPlacesText( fix: Fix ): string { if ( fix.places_failed === 0 ) { return ''; } return sprintf( /* translators: %s: number of places */ _n( '%s place could not be changed. Its link stays in the list.', '%s places could not be changed. Their links stay in the list.', fix.places_failed, 'aiplaz-link-checkup' ), formatNumber( fix.places_failed ) ); } export function withUnchangedPlaces( text: string, fix: Fix ): string { const unchanged = unchangedPlacesText( fix ); if ( unchanged === '' ) { return text; } return fix.places_done === 0 ? unchanged : `${ text } ${ unchanged }`; }