start

Although PO files will show us which strings have changed, sometimes the string can be very long and complex, such as a help screen. Also, HTML and text files do not show changes in the organized, summary way gettext PO files do in our translation editors.

## How to find specific changes

Text editors, and some translation editors, will run a “diff” routine which compares two directories, and shows you which files have changes. That’s certainly a good start.

But how do we find specific changes? Ordinarily, we can run “diff”, in the terminal, or in our editor:

    diff -u old_file new_file

and the output will show in our terminal. To output the information to a file:

    diff -u old_file new_file >output_file.diff

But this will only show what the editor regards as line-by-line changes, which in a PO file are often whole sections.

You can hard-wrap the older file (but not the newer file) before running diff, and that will actually give you a line-by-line comparison (you can remove the line-breaks from the older file afterwards, if necessary). That’s a definite improvement.

But we can do even better.

If you run wdiff instead:

    wdiff -u old_file new_file >output_file.diff

you get output that looks like this:

    Test of a very long line where something [-has changed-] {+did change+} and
    you don't know what it {+really+} was, why?

In other words, you get a word-by-word comparison.

You can clearly see what has changed: the {braces} show additions, and the [brackets] show deletions.

If you use the ‘less’ program in the terminal:

    wdiff -l  testA testB |less

you will also see bold text and underscored text highlighting the differences.

You can find more information on wdiff.