Bugzilla – Attachment 84655 Details for
Bug 22236
Translation should generate tags with consistent attribute order
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22236: Translation should generate tags with consistent attribute order
Bug-22236-Translation-should-generate-tags-with-co.patch (text/plain), 2.00 KB, created by
Josef Moravec
on 2019-02-02 08:43:20 UTC
(
hide
)
Description:
Bug 22236: Translation should generate tags with consistent attribute order
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-02-02 08:43:20 UTC
Size:
2.00 KB
patch
obsolete
>From 3a338ea257be8e00e865fecbe4ad742dd9bdb645 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 30 Jan 2019 15:37:10 +0000 >Subject: [PATCH] Bug 22236: Translation should generate tags with consistent > attribute order > >When running misc/translator/translate, the order of attributes in the translated templates is not consistent and may vary. This is caused by the random order of hash keys in perl. > >This causes things like this in run 1: ><input type="submit" class="btn" value="Plaats aanvraag" /> >And this in run 2: ><input value="Plaats aanvraag" type="submit" class="btn" /> >As you can see, there is actually no difference apart from the order. > >When comparing the result of various translation runs, I would rather get rid of such noise and only see the real changes. > >The needed change is not trivial to find, but only requires a simple addition to a sort operation in tmpl_process3.pl. The current sort only makes sure that the '/' comes at the end. We should sort the names of the keys too when this value is 0 (just meaning: no end tag symbol). > >Test plan: >[1] Run a translation without this patch and set a few templates aside. >[2] Run a translation with this patch. >[3] Run a compare (diff) on the templates copied in step 1. Verify that the > only changes are found in the sort order of attributes in html tags. > >Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > misc/translator/tmpl_process3.pl | 1 + > 1 file changed, 1 insertion(+) > >diff --git a/misc/translator/tmpl_process3.pl b/misc/translator/tmpl_process3.pl >index e39e64c390..6f4c39e786 100755 >--- a/misc/translator/tmpl_process3.pl >+++ b/misc/translator/tmpl_process3.pl >@@ -91,6 +91,7 @@ sub text_replace_tag ($$) { > > } sort { > $attr->{$a}->[3] <=> $attr->{$b}->[3] #FIXME >+ || $a cmp $b # Sort attributes BZ 22236 > } keys %$attr); > $it .= '>'; > } >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22236
:
84532
|
84652
| 84655