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

Further reduction of l10n sync commits



Hi Christian,

There still are times when a minor change in the translation for a
language will result in all packages being updated. Often this is caused
by very minor changes in comments in the head of the po file.

Please consider the following two options for l10n-sync to ignore these.


1. Just ignore any change in comments
Reasoning: any important changes in comments (if not accompanied by other
changes) come from the POT file, not from the translator.

The following patch will do that (and has a minor optimization which I've
already committed).

--- l10n-sync   (revision 35133)
+++ l10n-sync   (working copy)
@@ -569,7 +569,7 @@
         filter="((PO-Revision-Date|Project-Id-Version|Report-Msgid-Bugs-To|POT-Creation-Date|Last-Translator|Language-Team|MIME-Version|Content-Type|Content-Transfer-Encoding|X-Generator|Plural-Forms):)|^#[^,]|^\#$"
         cat $lang.po | egrep -v "$filter" >$oldfiltered
         cat $lang.po.new | egrep -v "$filter" >$newfiltered
-        if [ -z "$(diff --ignore-matching-lines="PO-Revision-Date:" $lang.po $lang.po.new)" ] ; then
+        if [ -z "$(diff --ignore-matching-lines="\(^#\|PO-Revision-Date:\)" $lang.po $lang.po.new)" ] ; then
          # We don't commit if only PO-Revision-Date changed
          rm $lang.po.new
         else


BTW. I think we should also ignore changes in the "Last-Translator:" header.
That would also make sure that more often than currently the real person who
made a change for a component will be credited in the changelog, rather than
the last committer. Thus:
--ignore-matching-lines="\(^#\|PO-Revision-Date:\|Last-Translator:\)"


2. Ignore any changes in lines leading up to the first msgid line
This is probably the better option.

The first msgid line is actually the one before the PO header lines of
course, so changes in those _will_ be considered.

This will require some fancy scripting, but the following snippet will
result in a file that has only the relevant part of the PO file.
The same would of course have to be done for $lang.po.new.

egrep -v "$filter" $lang.po | \
tail -n $(( \
	    $(cat $lang.po | wc -l) - \
	    $(grep -n -m1 "^msgid" $lang.po | cut -d: -f1) + 1 \
	 )) $lang.po > $oldfiltered

Explanation:
tail -n { <total nr of lines> -/- <line number of first msgid line> +/+ 1 }


Please test yourself before committing.

Cheers,
Frans

Attachment: pgpX9J1dXlrNb.pgp
Description: PGP signature


Reply to: