polib icon indicating copy to clipboard operation
polib copied to clipboard

List of occurrences wrapped differently than xgettext

Open gamboz opened this issue 1 year ago • 1 comments

I think that xgettext --no-wrap does not apply to the list of occurrences, so polib and xgettext will format the #: lines differently.

If you have a structure like the following:

.
├── f
│   └── c.py
├── folder_medium_length
│   └── b.py
├── folder_name_with_a_very_long_name_and_in_any_case_longer_than_seventy_eight_characters
│   └── a.py

where all the files contain the same string to translate, polib with wrapwidth=0 gives something like

#: /tmp/x/folder_name_with_a_very_long_name_and_in_any_case_longer_than_seventy_eight_characters/a.py:4 /tmp/x/folder_medium_length/b.py:4 /tmp/x/f/c.py:4

while xgettext --no-wrap something like the following (that was somewhat unexpected for me :)

#: /tmp/x/folder_name_with_a_very_long_name_and_in_any_case_longer_than_seventy_eight_characters/a.py:4
#: /tmp/x/folder_medium_length/b.py:4
#: /tmp/x/f/c.py:4

I think this can be changed by editing polib.py l.1037 from

            if wrapwidth > 0 and len(filestr) + 3 > wrapwidth:

to

            if wrapwidth > 1 and len(filestr) + 3 > wrapwidth:

I'm not yet opening a PR, because these are my first steps in the "translations" world and I might be making stupid mistakes (so please be patient :slightly_smiling_face: )

gamboz avatar Apr 28 '23 10:04 gamboz