Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#5927 closed defect (bug) (fixed)

GlotPress is giving a warning when saving a record with unknown placeholder

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


WooCommerce uses placeholders that are not know by GlotPress
So if you save the record a warning is given, and a polyglots-warning is generated
This is a link to the offending translation[warnings]=yes&sort[by]=translation_date_added

Attachments (1)

Yith WooCommerce_error.JPG (79.8 KB) - added by psmits1567 3 years ago.
Image showing the problem

Download all attachments as: .zip

Change History (8)

3 years ago

Image showing the problem

#1 @tobifjellner
3 years ago

  • Type changed from enhancement to defect

In order to spell it out for those who can't/won't see the attached image:
A printf() string like the following:

Data: %1$.2fMB | Index: %2$.2fMB | Free: %3$.2fMB | Engine: %4$s

Raises the warning:

Warning: The translation contains the following unexpected placeholders: %1$., %2$., %3$.

#2 @dd32
3 years ago

I've seen this message fly by in the warnings channel a few times, but I hadn't had a chance to look into adding full printf-syntax support.

I'm thinking one way around this is to leave the placeholder check as-is, but to also then do a if unknown placeholder exists at all within original, skip check.

#3 @tobifjellner
3 years ago

if unknown placeholder exists at all within original, skip check.

Yes, that's probably better than getting stuck in ever more complicated regex expressions.

#4 @psmits1567
3 years ago

I think that would be the best solution for the future. Unless the placeholder brakes functionality. Then it should still give a warning, but only if it is wrong formatted.

#5 @Amieiro
3 years ago

I have resolve this problem in GlotPress with this PR
Tomorrow I will review it with @dd32, and we will update it at

#6 @dd32
3 years ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In 11314:

Translate: Custom Warnings: Support precision within printf strings, and add an extra safety check to prevent warning about an incorrect placeholder if it existed within the original.

Fixes #5927.

#7 @dd32
3 years ago

In 11315:

Translate: Custom Warnings: Partially revert [11314] in favour of the upstream changes.

See #5927.

Note: See TracTickets for help on using tickets.