-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Time To Read Block: Fix untranslated on front end #49704
Conversation
Flaky tests detected in dd22814. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4662975713
|
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 didn't dig deep to see why we need to have %s
, but in every similar usage in core is like this. Example:
/* translators: %s: Number of comments. */
$new_text = _n( '%s Comment', '%s Comments', $number );
I think we can land this. Although it would be cool to pinpoint the place in code that this is required to work properly.
Thank you for the review! I have not been able to find the root cause, but looking at the core codebase and Developer Resources, it appears that the |
That's not really the root cause. The reason is that the translation call here uses the WordPress default text domain ( Coincidentally, the strings Hope that helps. |
Oh, and WordPress often uses |
Thank you for the information, @swissspidy. Am I correct in understanding that after a major release of WordPress core (i.e., after Gutenberg is bundled with core), any new translations added on the Gutenberg plugin will not be translated unless that translation exists in WordPress core? If so, then maybe this PR was pointless 😅 |
It seems like that is the case, yes. But haven't checked if there's something special going on elsewhere. |
Fixes: #49694
What?
This PR fixes a problem where the unit of time is not translated when the Post Time to Read block is rendered on the front end.
Why?
I have changed the placeholder in the
_n()
function string from%d
to%s
and have confirmed that it translates correctly. I don't know the root cause, but in the WordPress core,%s
is used as a placeholder in the_n()
function as well. Also in Developer Resources, all examples use%s
as a placeholder.Testing Instructions
Screenshots or screencast
Japanese
German
Spanish