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).
Created attachment 84532 [details] [review] 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.
Created attachment 84652 [details] [review] 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>
Created attachment 84655 [details] [review] 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>
(In reply to Josef Moravec from comment #3) > Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com> > > Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Thanks Pierre-Marc and Josef !
Awesome work all! Pushed to master for 19.05
Nice fix, Pushed to 18.11.x for 18.11.03
backported to 18.05.x for 18.05.09
I prefer not risk backporting to oldoldstable 17.11.x