Use correct plural handling for some strings
-
Hi Edward,
While quickly checking your Swedish translations, I noted three strings that would be much better off if you used_n()
instead, since that would allow correct translations to be made to Russian and some other languages with complicated plural handling.
The phrases are:
? %s rows left to check…
? %s seconds
? How many seconds to add for each image that is attached to the post. %s seconds is the default value to upload the image, caption it and then insert it into the post.
Note that with_n()
you need to include the number twice: one time as a text string to be injected into the string, the other time as an argument to pick the correct plural form.By the way, when you need to inject a decimal integer into a
printf()
then%d
may be a more convenient placeholder choice.EditAdd: One more thing: When you use placeholders in a string, it may sometimes be good to give a hint to the translator about what kind of content will be placed into the phrase (say, a user name or the total number of seconds since midnight, or whatever. Here’s the example from https://codex.www.ads-software.com/I18n_for_WordPress_Developers on how to include a hint for translators that will be visible while translating:
/* translators: draft saved date format, see https://php.net/date */ $draft_saved_date_format = esc_html__( 'g:i:s a', 'my-text-domain' );
- The topic ‘Use correct plural handling for some strings’ is closed to new replies.