WordPress.org

Making WordPress.org

Opened 9 months ago

Last modified 5 months ago

#5563 new enhancement

I a translation file is imported that contains wrong placeholders the line is not rejected.

Reported by: psmits1567 Owned by:
Milestone: Priority: normal
Component: Translate Site & Plugins Keywords:
Cc:

Description

Currently, if you import a file that contains a translation where the placeholder is not properly formatted, the line is not rejected but inserted and creates a waiting record with warning.
Looking at the daily number of errors passing by, it would be better to reject those lines instead of inserting them with an error.
The person that imports translations is responsible to import properly formatted strings. Now as a PTE or GTE you have to either correct those lines or remove them. Because obviously they are not corrected by the person that imports them
Examples "% s", "% 1 $ s", "% d", "% 2 $ s"
If rejected indicate the number of lines rejected, and a hint of the rejected reason.
E.g. "Import has finished with errors in XXX lines, containing wrong formatted placeholders!"

Change History (5)

#1 @dd32
9 months ago

  • Keywords needs-design removed

The person that imports translations is responsible to import properly formatted strings. Now as a PTE or GTE you have to either correct those lines or remove them. Because obviously they are not corrected by the person that imports them
Examples "% s", "% 1 $ s", "% d", "% 2 $ s"

Whenever you see spaces after/around those placeholders like that, you can bet it's a machine translated (probably Google Translate) translation.

My understanding was that importing/uploading of strings required a higher level of access though? As in, regular accounts shouldn't have the ability to upload accounts, and if a PTE is processing uploads such as this they probably shouldn't have the status for that language they're not reviewing? This is incorrect, all users have upload permissions, they're just imported as waiting.

Possibly a dup of #4171

Last edited 7 months ago by dd32 (previous) (diff)

#2 @psmits1567
9 months ago

It is related, but a more progressive approach. The number of warning records is huge, so we need to really concider to make a decision about this.

Maybe also consider to not save records that have a missing/wrong placeholder. Currrently if you are manually translating, a warning is given. But the record is stored and creates a warning in polyglots warning channel. If you do not have PTE or GTE capability, you cannot correct it. Hence a PTE or GTE needs to correct it. Just generate a warning without saving the record, would cause less records in the database and less waiting strings, and less work for the PTE/GTE

Last edited 9 months ago by psmits1567 (previous) (diff)

#3 @dd32
7 months ago

I'm behind outright blocking of incorrectly spaced placeholders. Currently we have a warning on it, and a JS warning prior to save, but that doesn't help those who import them.

#4 @dd32
7 months ago

In 10683:

Translate: Auto-correct spaced placeholders, common with machine translations.

This replaces % 1 $ s with %1$s in translations if it corrects the translation.

Machine translations aren't always wanted, but in many cases simply re-submitting the translation with the fixed placeholder is all that's done, this just reduces the amount of warnings generated, allowing translators to focus on the language content of the string.

See #5563, #5154.

#5 @dd32
5 months ago

In 10956:

Translate: When removing spaced placeholders, only do it if it ends on a word boundary.

This fixes it attempting to correct 100% over to 100%over, while still allowing it to convert <a href='% 1 $ s'> to <a href='%1$s'>.

Follow up to r10683.
See #5563, #5154.

Note: See TracTickets for help on using tickets.