[wp-meta] [Making WordPress.org] #5154: Automatically fix some translation errors
Making WordPress.org
noreply at wordpress.org
Fri May 7 02:40:19 UTC 2021
#5154: Automatically fix some translation errors
--------------------------------------+---------------------
Reporter: dd32 | Owner: (none)
Type: defect | Status: closed
Priority: normal | Milestone:
Component: Translate Site & Plugins | Resolution: fixed
Keywords: |
--------------------------------------+---------------------
Comment (by dd32):
Replying to [comment:18 tobifjellner]:
> >This fixes it attempting to correct 100% over to 100%over,...
>
> In Swedish, we always put a space between a number and a following
percent sign or unit. I.e. 110V, 25mm, and 50% we change to 110 V, 25 mm
and 50 %.
Yeah that's fine, that won't be affected by this at all. The descriptions
for these fixes are a bit.. not great and I apologise for that :)
I also need to write some unit tests, so that you can see what exactly is
happening here.. so that errors don't happen too..
This was an issue where the auto-correction was improper.
Take this translation for example:
https://translate.wordpress.org/projects/meta/wordpress-org/en-
gb/default/?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=11765836&filters%5Btranslation_id%5D=83944362
Original: `In March 2004, the <a href="%1$s">.... 80%% of our users? ....`
Submitted: `In March 2004, the <a href="%1$s">.... 80% of our users? ....`
The translation fixer kicked in and transformed it like so:
Submitted: `In March 2004, the <a href="%1$s">.... 80% of our users? ....`
Whitespace fix: `In March 2004, the <a href="%1$s">.... 80%of our users?
....`
Percent fix: No change, doesn't apply as `%o` is a valid printf-style
placeholder (which we shouldn't touch)
Result: Still has warnings because `%%` isn't present. Translation fix
failed, Translation accepted with warnings about improper placeholders.
What should've happened, and will after this:
Submitted: `In March 2004, the <a href="%1$s">.... 80% of our users? ....`
Whitespace fix: No change, doesn't apply
Percent fix: `In March 2004, the <a href="%1$s">.... 80%% of our users?
....`
Result: No warnings, all placeholders exist, no stray placeholders,
translation is accepted.
The whitespace fix would look something like this:
Submitted: `In March 2004, the <a href="% 1 $ s">.... 80% of our users?
....` (automated translation tools, etc)
Whitespace fix: `In March 2004, the <a href="%1$s">.... 80% of our users?
....`
Percent fix: `In March 2004, the <a href="%1$s">.... 80%% of our users?
....`
Result: Accepted, no warnings, all placeholders as expected.
There was also an issue, fixed through a different commit, [10955] where a
placeholder wouldn't be picked up as being incorrect if escaped.
For example:
Original: `Over in %s we code.`
Translation: `Over in %%s we code.`
Previous Result: No warnings, `%s` exists within string, all is okay.
Expected Result: Warning, `%s` placeholder not present.
--
Ticket URL: <https://meta.trac.wordpress.org/ticket/5154#comment:19>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org
More information about the wp-meta
mailing list