Feature Description
The anchor html should be included within the translation string with classes inserted later as discussed here
|
__( 'We were unable to generate your reports due to insufficient permissions in Search Console. To fix this, contact your administrator or %1$sget help%2$s.', 'google-site-kit' ), |
|
__( 'Report delivery will automatically resume once the issue is resolved.', 'google-site-kit' ), |
|
), |
|
'error-email-permissions-analytics-4' => array( |
|
/* translators: 1: opening anchor tag for help link, 2: closing anchor tag */ |
|
__( 'We were unable to generate your reports due to insufficient permissions in Analytics. To fix this, contact your administrator or %1$sget help%2$s.', 'google-site-kit' ), |
|
__( 'Report delivery will automatically resume once the issue is resolved.', 'google-site-kit' ), |
|
), |
|
'error-email-report-search-console' => array( |
|
/* translators: 1: opening anchor tag for settings link, 2: closing anchor tag, 3: opening anchor tag for help link, 4: closing anchor tag */ |
|
__( 'We were unable to generate your report because data loading failed for Search Console. To fix this, go to %1$sSearch Console settings%2$s in Site Kit or %3$sget help%4$s.', 'google-site-kit' ), |
|
__( 'Report delivery will automatically resume once the issue is resolved.', 'google-site-kit' ), |
|
), |
|
'error-email-report-analytics-4' => array( |
|
/* translators: 1: opening anchor tag for settings link, 2: closing anchor tag, 3: opening anchor tag for help link, 4: closing anchor tag */ |
|
__( 'We were unable to generate your report because data loading failed for Analytics. To fix this, go to %1$sAnalytics settings%2$s in Site Kit or %3$sget help%4$s.', 'google-site-kit' ), |
|
__( 'Report delivery will automatically resume once the issue is resolved.', 'google-site-kit' ), |
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- Error email translation strings contain complete anchor tags with
href placeholder(s) instead of separate opening/closing tag placeholders
- Inline styles (e.g. link color) are injected after translation, not within the translatable string
- HTML and plain text email output remains visually identical to current behavior
- Existing
wp_kses allowlist in the HTML template continues to sanitize anchor tags correctly
Implementation Brief
Backend
Test Coverage
QA Brief
Changelog entry
Feature Description
The anchor html should be included within the translation string with classes inserted later as discussed here
site-kit-wp/includes/Core/Email_Reporting/Content_Map.php
Lines 197 to 213 in e63ffe4
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
hrefplaceholder(s) instead of separate opening/closing tag placeholderswp_ksesallowlist in the HTML template continues to sanitize anchor tags correctlyImplementation Brief
Backend
Update file
includes/Core/Email_Reporting/Content_Map.php<a href="%s">within the translation string instead of separate opening/closing tag placeholders:error-email-permissions-search-console: change to single%shref placeholdererror-email-permissions-analytics-4: change to single%shref placeholdererror-email-report-search-console: change to two%shref placeholders (settings link + help link)error-email-report-analytics-4: change to two%shref placeholders (settings link + help link)/* translators: %s: "get help" link URL */)add_inline_link_styles( string $html )that post-processes translated body paragraphs to inject inline styles onto anchor tags:<atags and addclass="link"andstyle="color:#108080;"attributesget_body_argsreturn valuesget_body_args()to return only the URL strings (not full<a>opening/closing tags):error-email-permissions-*: returnarray( $help_url )error-email-report-*: returnarray( $settings_url, $help_url )add_inline_link_styles()inget_body_with_args()to each paragraph aftervsprintfsubstitutionUpdate file
includes/Core/Email_Reporting/Batch_Error_Notifier.phpContent_Map::get_body_args()andContent_Map::get_body_with_args()which will handle the new format transparentlyUpdate file
includes/Core/Email_Reporting/templates/simple-email/parts/content.phpwp_ksesallowlist for anchor tags already permitshref,style, andclassattributes — addclassto the allowlist if missingTest Coverage
tests/phpunit/integration/Core/Email_Reporting/Content_MapTest.phptest_get_body_with_args_substitutes_placeholdersand error-email-related assertions to match new string format (inline anchors instead of separate open/close tags)add_inline_link_stylesmethod: verify styles are injected on anchor tagsget_body_with_argscontain complete<a href="...">tags with inline stylesPlain_Text_Formatter::convert_links_to_textcorrectly extracts URLs from the new formatQA Brief
Changelog entry