import { __, sprintf } from '@wordpress/i18n'; import type { Fix } from '../api/types/fixes'; import { shortUrl } from '../lib/url'; import { linksPhrase, placesPhrase } from '../text/countedPhrases'; function ignoredText( fix: Fix ): string { if ( fix.links_total > 1 ) { return sprintf( /* translators: %s: number of links, for example "4 links" */ __( '%s ignored.', 'aiplaz-link-checkup' ), linksPhrase( fix.links_done ) ); } return __( 'Ignored. We will not report it again.', 'aiplaz-link-checkup' ); } export function fixDoneText( fix: Fix ): string { switch ( fix.action ) { case 'replace': return sprintf( /* translators: %s: number of places, for example "3 places" */ __( 'Replaced in %s.', 'aiplaz-link-checkup' ), placesPhrase( fix.places_done ) ); case 'update': return sprintf( /* translators: %s: number of places, for example "3 places" */ __( 'Updated in %s.', 'aiplaz-link-checkup' ), placesPhrase( fix.places_done ) ); case 'remove': return sprintf( /* translators: %s: number of places, for example "3 places" */ __( 'Link removed from %s. The text stayed.', 'aiplaz-link-checkup' ), placesPhrase( fix.places_done ) ); case 'redirect': return sprintf( /* translators: %s: the address visitors are sent to */ __( 'Redirect created. Visitors now go to %s.', 'aiplaz-link-checkup' ), shortUrl( fix.new_url ?? '' ) ); case 'ignore': return ignoredText( fix ); case 'works': return __( 'Marked as working.', 'aiplaz-link-checkup' ); } }