Skip to content

Preserve formatting of existing files is not respected #922

Description

@SilverGreen93

Hi,

It seems that Poedit is not respecting the line wrap settings in some cases. I especially refer to Preserve formatting of existing files setting.
I have my settings setup this way (the default):

Image

I am using Poedit version 3.8.2 on Windows 11 to edit translations. I am working on the following file: original.zip

Steps to reproduce:

  1. Open the attached po file in any text editor
  2. Go to line 3778 and change the word "profile" to "profilurile". Notice that the line length is now changed from 79 to 83.
  3. Save and close the file
  4. Open the file with poedit, validate and save it.
  5. Diff with the initial file and notice that a lot of lines got changed for no reason.

Why did this change occur? I cannot explain it myself. The only lines that should have changed are lines 3778 and 3779. All others have no reason to change.

Activity

  1. vslavik commented on Feb 28, 2026

    @vslavik
    Owner

    Please read this document, and provide detailed and self-contained steps to reproduce, and a clear description of what you believe is incorrect. It doesn’t help that the issue subject appears corrupted.

    I’m happy to look into it, but I can’t reasonably be expected to investigate details scattered across another repository and figure them on my own. Having all relevant information in one place makes it much easier to understand and address the issue.

  2. SilverGreen93 commented on Mar 1, 2026

    @SilverGreen93
    Author

    I’m happy to look into it, but I can’t reasonably be expected to investigate details scattered across another repository and figure them on my own. Having all relevant information in one place makes it much easier to understand and address the issue.

    Thanks, I updated the PR with the steps to reproduce.

  3. changed the title [-]Lines wrap at not preserved[/-] [+]Preserve formatting of existing files is not respected[/+] on Mar 1, 2026
  4. vslavik commented on Mar 6, 2026

    @vslavik
    Owner

    Thanks, I updated

    The appropriate way of doing clarifications in response to a comment is to add an explanatory comment too, not to rewrite history. The latter is hard to follow in a conversation, so please don't do it.

    the PR

    (You didn't make any "PR" - that would have received enthusiastic response. You filed a bug report.)

    Anyway:

    It took me a while to understand that you complain about editing the file outside of Poedit.

    You modified the file to use non-standard formatting. Poedit did its best to detect the desired line width, but couldn’t, because you edited the file to be internally inconsistent.

    The only lines that should have changed are lines 3778 and 3779. All others have no reason to change.

    Poedit uses msgcat - that is to say, expects normal formatting of files. That may result in normalization of weird files. Poedit doesn’t promise not to normalize, and the UI you screenshotted doesn’t claim so.

    Ideally, Poedit would only update edited portions of the file, regardless of how bizarre the rest might be. We don’t live in an ideal world. Changing the implementation to behave like that, while on my todo list, is no small undertaking — a complete rewrite of all of catalog_po.cpp basically — for only limited gains. IOW, it should be done, but I can’t promise when, or if, I will do it.

    If you care about this, contributing a PR (as in, a pull request with code) would be most welcome.

  5. SilverGreen93 commented on Mar 7, 2026

    @SilverGreen93
    Author

    Thanks, I updated

    The appropriate way of doing clarifications in response to a comment is to add an explanatory comment too, not to rewrite history. The latter is hard to follow in a conversation, so please don't do it.

    I usually do this because whoever new here and starts to read, to not waste time with incorrect info, just read the correct steps.

    the PR

    (You didn't make any "PR" - that would have received enthusiastic response. You filed a bug report.)

    My bad, I was working on other PRs in the same time, and just wrote PR withouth thinking :)

    It took me a while to understand that you complain about editing the file outside of Poedit.

    You modified the file to use non-standard formatting. Poedit did its best to detect the desired line width, but couldn’t, because you edited the file to be internally inconsistent.

    I sort-of understand what you are saying, and it makes sense to a point.

    The reason that I edited the po file outside poedit was because I corrected some issues in the oringinal PR, so the issues were correctly directly with an external editor, being easier to make corrections at the lines indicated in the PR defects.

    Still, I would have expected that if all other lines were correct, poedit to just rework the offending lines.

    Would be a good improvement somewhere in the future to have this non-intrusive behaviour :)

    Cheers!

  6. SlowMo24 commented on Apr 20, 2026

    @SlowMo24

    I got to this issue via python-babel/babel#1266 and the (maybe obvious) work around is to disable the preserve formatting ... option to let poedit enforce line length

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions