Re: Diffing POT files



> [: Chris Leonard :]
> Does anyone know of such a tool? It would ideally be aware of PO file
> structure to treat string subunits of a PO file as a single "chunk" as
> opposed to a simple *nix diff which would be line-by-line.

You could try Pology, http://pology.nedohodnik.net/. It contains an actual
PO diffing script, poediff, where what "PO diff" means is documented in the
user guide. But it will not produce what you described as the ideal output;
this is very simple, and can be produced by the attached script using
Pology library.

-- 
Chusslove Illich (Часлав Илић)
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys

from pology.catalog import Catalog


old_pot, new_pot = sys.argv[1:]

old_cat = Catalog(old_pot)
new_cat = Catalog(new_pot)

old_uniq_pot = old_cat.name + "-unique.pot"
old_uniq_cat = Catalog(old_uniq_pot, create=True, truncate=True)
for msg in old_cat:
    if msg not in new_cat:
        old_uniq_cat.add_last(msg)
old_uniq_cat.sync()

new_uniq_pot = new_cat.name + "-unique.pot"
new_uniq_cat = Catalog(new_uniq_pot, create=True, truncate=True)
for msg in new_cat:
    if msg not in old_cat:
        new_uniq_cat.add_last(msg)
new_uniq_cat.sync()

common_pot = old_cat.name + "-" + new_cat.name + "-common.pot"
common_cat = Catalog(common_pot, create=True, truncate=True)
for msg in old_cat:
    if msg in new_cat:
        common_cat.add_last(msg)
common_cat.sync()

Attachment: signature.asc
Description: This is a digitally signed message part.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]