#5455 closed defect (fixed)

update-po and update-pot result in different output from different machines

Reported by: strk Owned by: robe
Priority: medium Milestone: PostGIS 3.5.0
Component: l18n Version: master
Keywords: Cc:

Description

Line length in .pot files changes depending on version of poxml and this can be annoying as different developers would keep pushing changes with no reason.

Change History (10)

comment:1 by strk, 12 months ago

This contending pot format is happening between machines with poxml 4:20.12.0-1 and machines with poxml 4:21.12.3-0ubuntu1. Running make update-pot on one and on the other result in different newlines, like:

diff --git a/doc/po/templates/administration.xml.pot b/doc/po/templates/administration.xml.pot
index 6f5e7e861..bbddcbd1e 100644
--- a/doc/po/templates/administration.xml.pot
+++ b/doc/po/templates/administration.xml.pot
@@ -288,9 +288,9 @@ msgstr ""
 #: administration.xml:139
 #, no-c-format
 msgid ""
-"If you are running PostGIS 3 or above, then you should use the <xref "
-"linkend=\"PostGIS_Extensions_Upgrade\"/> function to upgrade to the latest "
-"version you have installed."
+"If you are running PostGIS 3 or above, then you should use the <xref linkend="
+"\"PostGIS_Extensions_Upgrade\"/> function to upgrade to the latest version "
+"you have installed."
 msgstr ""
 
 #. Tag: para

The problem seem to not be even fixable with msgattrib, although from the same version. Both machines have msgattrib from GNU gettext-tools 0.21, but when running this command against the SAME version of po/templates/administration.xml.pot:

$ msgattrib --no-wrap po/templates/administration.xml.pot | msgattrib --width 79  | grep "PostGIS 3"

They give these two different answers: 1:

"If you are running PostGIS 3 or above, then you should use the <xref "

2:

"If you are running PostGIS 3 or above, then you should use the <xref linkend="

Note that the —no-wrap call results in the SAME output:

$ msgattrib --no-wrap po/templates/administration.xml.pot | grep "PostGIS 3"
msgid "If you are running PostGIS 3 or above, then you should use the <xref linkend=\"PostGIS_Extensions_Upgrade\"/> function to upgrade to the latest version you have installed."

comment:2 by strk, 12 months ago

We should maybe avoid line wrapping as a whole. Incidentally it looks like weblate at some point used to remove line wrapping, I'm not sure this is still the case. Commit with no line wrapping from weblate: [a0db0dbf4afab21b67d534bb9fff53fe4751f3d3/git]

The above commit is the last one coming from weblate, maybe a component was disabled ?

comment:3 by strk, 12 months ago

Line wrapping could be disabled on the weblate side too, from here: https://weblate.osgeo.org/addons/postgis/postgis/69/

I verified that on my 2 contending systems disabling line wrapping works effectively at avoiding the war (between those two machines)

comment:4 by strk, 12 months ago

I've sent an email to gettext bug and was told the component responsible for line wrapping is libunistring. The version of that library is indeed different between the two machines I was testing on. (1.0 vs. 0.9.10). The upstream suggestion is to completely avoid text wrapping if the files are meant to be translated using tools (like weblate for example). I've mixed feelings about this

in reply to:  2 comment:5 by robe, 11 months ago

Replying to strk:

We should maybe avoid line wrapping as a whole. Incidentally it looks like weblate at some point used to remove line wrapping, I'm not sure this is still the case. Commit with no line wrapping from weblate: [a0db0dbf4afab21b67d534bb9fff53fe4751f3d3/git]

The above commit is the last one coming from weblate, maybe a component was disabled ?

Yah there is a component add-on in weblate that controls line wrapping. https://weblate.osgeo.org/addons/postgis/postgis/

It's called "Customize gettext output" and is set to break after 77. I think when we started we didn't have that add-on enabled and WEblate's default behavior was to not linewrap. I think you were the one that suggested we install this plugin to force line wrapping at 77.

Should we disable it. I think we might need to disable for each individual component, cause the add-ons I think are only copied via the component discovery add-on when they are first created.

comment:6 by robe, 11 months ago

Actually maybe this one is needed to also remove line wrapping. I can't remember. But the options for the plugin are:

  1. Wrap lines at 77 characters and at new lines (this is what we have it set to currently) (xgettext — default)
  2. Only wrap lines at new lines (xgettext —no-wrap)
  3. No line wrapping

comment:7 by robe, 11 months ago

Milestone: PostGIS 3.4.0PostGIS 3.5.0

push back if you get to it before 3.4.0 release time.

comment:8 by Sandro Santilli <strk@…>, 10 months ago

In 26b88d2/git:

Drop line wrapping from pot and po files

This is aimed at reducing style war between developers and bots.
References #5455

comment:9 by Sandro Santilli <strk@…>, 10 months ago

In dfdc9c4f/git:

Do not override .po files if no messages changed in template file

References #5455

comment:10 by Sandro Santilli <strk@…>, 10 months ago

Resolution: fixed
Status: newclosed

In f9f2002c/git:

Do not override .pot file if no messages changed in XML files

Closes #5455

Note: See TracTickets for help on using tickets.