Skip to content

Instantly share code, notes, and snippets.

@stephenharris
Last active April 10, 2023 06:53
Show Gist options
  • Select an option

  • Save stephenharris/3c3792568494b2a7cf48 to your computer and use it in GitHub Desktop.

Select an option

Save stephenharris/3c3792568494b2a7cf48 to your computer and use it in GitHub Desktop.

Revisions

  1. stephenharris revised this gist Sep 5, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion strippocomments
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    grep -v '^#:' $1
    grep -vE '^#:|POT-Creation-Date' $1
  2. stephenharris created this gist Aug 10, 2015.
    18 changes: 18 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    # How to suppress comments when performing `git diff` on `.po` files.

    *Taken from: http://stackoverflow.com/questions/2006351/gettext-po-files-under-version-control*

    Changes in the codebase can alter line numberings given in `.po` 'comments'.
    While such changes should be committed they make obsecure the actual
    translation changes made, and make auditing them difficult.

    1. Create `/usr/local/bin/strippocomments` as given in this gist.

    2. Set up pre-processing of .po files by editing `.git/info/attributes` and adding:

    *.po diff=podiff

    3. Edit `.git/config` and add the line

    [diff "podiff"]
    textconv = /usr/local/bin/strippocomments
    1 change: 1 addition & 0 deletions strippocomments
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    grep -v '^#:' $1