Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 541309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:19:49+00:00 2026-05-13T10:19:49+00:00

Currently using Gettext on a project and the .po files are nicely kept under

  • 0

Currently using Gettext on a project and the .po files are nicely kept
under version control.

PO files of course contain translations, but in addition to that they
also contain some metadata – information about the exact files and
line numbers where the translatable strings are located.

The problem is that each time you update the PO files the metadata
changes a whole lot more than the actual translations. This makes it
really hard to later see from version control diff what actually was
changed – you just see a myriad of changes to file names and line
numbers. Like that:

- #: somefile.js:43
- #: somefile.js:45
- #: somefile.js:118
+ #: somefile.js:203
+ #: somefile.js:215
  msgid "Translate me please"
  msgstr "Tõlgi mind palun"

- #: somefile.js:23
- #: somefile.js:135
+ #: otherfile.js:23
+ #: otherfile.js:135
  msgid "Note"
  msgstr "Märkus"

- #: andThatFile.js:18
  #: orThisFile.js:131
- msgid "Before I was like this"
- msgstr "Selline olin ma enne"
+ msgid "I happen to be changed"
+ msgstr "Paistab, et mind muudeti"

Of course, a simple fix would be to just disable the generation of
filename/linenumber comments in xgettext output. But I actually find
those file names to be quite useful hints when translating.

I surely cannot be the only one who doesn’t like the diffs of his PO files.
Suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:19:49+00:00Added an answer on May 13, 2026 at 10:19 am

    A simple fix would be to apply a grep filter to remove comment metadata from the viewed diff. You can either do this to the output of the version control diff utility:

    myVersionControl diff REV1 REV2 filea | grep -v '^..#'
    

    or you may be able to instruct the version control diff utility to ignore these before it makes the comparison, which will likely result in a more reliable and prettier output:

    I don’t know what version control system you use, but git (for example) allows you to preprocess the input to diff and remove the comment lines for certain file types (thanks VonC), see man gitattributes and search for Performing text diffs of binary files. Here’s the body of a sample script to save as /usr/local/bin/strippocomments which will do that:

    grep -v '^#:' $1
    

    You can then tell git to use this script to preprocess po files, by adding the following to the file .git/info/attributes in your repository:

    *.po diff=podiff
    

    and to the file .git/config in your repository:

    [diff "podiff"]
        textconv = /usr/local/bin/strippocomments
    

    Using git diff should then not include any lines starting with #:.

    Note that the diffs generated from git diff using this approach should not be used for patching – but git format-patch will still use the default diff, so patches generated for emailing will still be ok.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently using System.Web.UI.WebControls.FileUpload wrapped in our own control. We have licenses for Telerik. I
I'm currently using VS2005 Profesional and .NET 2.0, and since our project is rather
I'm currently using the awesome attachment-fu plugin for a Rails app, but as a
I am currently translating my PHP application using gettext with POEdit. Since I respect
Im currently using vs2008 with asp.net mvc framework for web development. Im missing a
I am currently using Windows Server 2008 Standard and have several Hyper V machines.
I am currently using the following command to upload my site content: scp -r
My company is currently using Sage MAS as their ERP system. While integrating our
I'm currently using DPack as this adds a Collapse All Projects option to the
We are currently using a somewhat complicated deployment setup that involves a remote SVN

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.