-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix missing translations #1227
Fix missing translations #1227
Conversation
{ __( 'Help us improve the Site Kit plugin by allowing tracking of anonymous usage stats. All data are treated in accordance with ', 'google-site-kit' ) } | ||
<a href="https://policies.google.com/privacy" target="_blank" rel="noopener noreferrer">{ __( 'Google Privacy Policy', 'google-site-kit' ) }</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect because strings can't be properly translated when concatenated. This also renders oddly in some cases, e.g. in Español where the translation is missing the space at the end so the text and the link are running together.
@@ -1102,7 +1102,8 @@ class AnalyticsSetup extends Component { | |||
} | |||
|
|||
{ !! existingTag && | |||
<p>{ sprintf( __( 'An existing analytics tag was found on your site with the id %s. If later on you decide to replace this tag, Site Kit can place the new tag for you. Make sure you remove the old tag first.', 'google-site-kit' ), existingTag ) }</p> | |||
/* translators: %s: Analytics tag ID */ | |||
<p>{ sprintf( __( 'An existing analytics tag was found on your site with the ID %s. If later on you decide to replace this tag, Site Kit can place the new tag for you. Make sure you remove the old tag first.', 'google-site-kit' ), existingTag ) }</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalized "ID"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt that this translator comment is going to be picked up. It should be inside the brackets, preceding either sprintf
or ideally the __()
call.
<p>{
sprintf(
/* translators: %s: Analytics tag ID */
__( 'An existing analytics tag was found on your site with the ID %s. If later on you decide to replace this tag, Site Kit can place the new tag for you. Make sure you remove the old tag first.', 'google-site-kit' ),
existingTag
)
}</p>
let title = __( 'Search Traffic Summary', 'google-site-kit' ); | ||
|
||
if ( pageTitle && pageTitle.length ) { | ||
/* translators: %s: page title */ | ||
title = sprintf( __( 'Search Traffic Summary for %s', 'google-site-kit' ), decodeHtmlEntity( pageTitle ) ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ESLint rules weren't properly detecting the translators string in a multiline ternary so I split it up this way, which is probably cleaner anyway 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense 👍
With the ternary it wouldn't be clear which __()
call it should be associated with.
sprintf( __( 'Set up %s', 'google-site-kit' ), name ) : | ||
sprintf( __( 'Setup Analytics to gain access to %s', 'google-site-kit' ), name ) | ||
/* translators: %s: module name */ | ||
sprintf( __( 'Set up Analytics to gain access to %s', 'google-site-kit' ), name ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed from "Setup Analytics" to "Set up Analytics" for consistency, but also because it is the correct form to use here. This caused VRT to fail, hence updates for those as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! +1 on changing the concatenated strings - I'm sure there are more of these around, let's keep improving these problematic occurrences as we spot them.
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
Summary
Addresses issue #1163
Relevant technical choices
One of these required VRT references to be updated
Once the above PR is merged, and we're using the newer ESLint plugin, we can add the following to our
eslintrc.json
Checklist