Idea Hub tabs are not properly localized
Bug Description
The tabs in the Idea Hub widget (https://github.com/google/site-kit-wp/blob/1919e84c8c7030dcf510710c59dc5f9b50e4aa21/assets/js/modules/idea-hub/components/dashboard/DashboardIdeasWidget/index.js#L186-L189 https://github.com/google/site-kit-wp/blob/1919e84c8c7030dcf510710c59dc5f9b50e4aa21/assets/js/modules/idea-hub/components/dashboard/DashboardIdeasWidget/index.js#L192-L195) are not properly localized and will not be fully translated.
This is because the counts are not part of a translation string. We need to use __ and createInterpolateElement to properly format these tab titles.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- Idea Hub widget tab titles should be fully translatable.
Implementation Brief
- Use
sprintf,__, andcreateInterpolateElementto translate the tab titles, eg:
{ savedIdeas?.length >= 0 &&
createInterpolateElement(
sprintf(
/* translators: %s: number of saved Idea Hub ideas */
__(
'Saved <span>(%s)</span>',
'google-site-kit'
),
savedIdeas.length
),
{
span: <span />,
}
) }
{ savedIdeas?.length === undefined &&
__( 'Saved', 'google-site-kit' ) }
Test Coverage
- N/A
Visual Regression Changes
- None.
QA Brief
- We don't have any translations for this text yet, but verify the Idea Hub tabs still work as before including outputting the count inside a
<span>tag and that the translations contain the entire text of the tab title, as per the ACs
Changelog entry
- Fix Idea Hub tab localization text.
IB ✅
QA ✅
- Verified that the count is rendered in a
<span> - Verified that the translations contain the entire text of the tab title