Opened 8 years ago

Closed 8 years ago

#1934 closed enhancement (invalid)

Prevent difference in number of placeholders in original text and translation

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: Priority: normal
Component: Translate Site & Plugins Keywords:


Ref: #WP37807

A translation for the following text in core was provided and approved, but the translation contained two placeholders instead of just one, which results in a PHP error.

Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="%1$s">WordPress Plugin Directory</a> or upload a plugin in .zip format by clicking the button at the top of this page.

GlotPress should:

  1. Detect translations that use a greater number of placeholders than the original string, and prevent the translation from being approved by anyone.
  2. Detect translations that use a fewer number of placeholders than the original string, and raise a warning to alert the translators in case of an error.

Change History (4)

#1 @swissspidy
8 years ago

AFAIK GlotPress already does that. I assume the problem in that case was a change to the original string without an update to the translation.

#2 @SergeyBiryukov
8 years ago

Yes, GlotPress already issues a warning in this case:

*Warning:* Too many tags in translation. Extra %2$s placeholder in translation.

I've found two related entries in #polyglots-warnings:

Not sure why there was no warning for Spanish. Maybe because it was a fuzzy string?

#3 @johnbillion
8 years ago

In that case, this is probably a duplicate of

#4 @ocean90
8 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Issues with GlotPress should be reported on the GitHub repo.

It looks like fuzzy translations are not checked for warnings, see

Note: See TracTickets for help on using tickets.