Spotting fuzzy difference in large html block

Oliver Kellogg olivermkellogg at gmail.com
Sat Nov 4 13:07:40 GMT 2023


While `lokalize` does help a little, I made a little script that eases the
pain some more, see below.

Usage:
* Copy/paste the po-file hunk following the ", fuzzy" line to a file, e.g.
fuzzy.txt
* Copy/paste the po-file hunk following the msgid "" line to another file,
e.g. new.txt
* poprettyxml.sh fuzzy.txt > fuzzy.xml
* poprettyxml.sh new.txt > new.xml
* diff -u fuzzy.xml new.xml

The output from the `diff` shows what's going on in a more readable format.

-Oliver

#!/bin/bash
#
# poprettyxml.sh
# Pretty print GNU gettext PO-file msgid or msgstr which contains XML
#
# Usage:
# Copy/paste the text following ", fuzzy" or following msgid ""
# to a separate file and provide this file as argument.
#
# Copyright (C) 2023 Oliver Kellogg <okellogg at users.sourceforge.net>
# Distributable under the MIT license https://opensource.org/license/mit/
#

pofrag=$1
tmpfile=pretty.tmp

sed 's/^#*|* *"//; s/"$//; s/\\"/"/g' $pofrag | tr -d '\n' > $tmpfile
echo >> $tmpfile
haveHtmlDecl=$(grep '<html>' $tmpfile)
if [ -z "$haveHtmlDecl" ]; then
 sed -e '1i <html><body>' -e '$a </body></html>' -i $tmpfile
fi
cat $tmpfile | xmllint --format -

rm -f $tmpfile




On Mon, Jul 3, 2023 at 9:49 PM Łukasz Wojniłowicz <
lukasz.wojnilowicz at gmail.com> wrote:

> I am of the same opinion. Maybe the maintainer of KStars isn't
> aware of that, and would find feedback from the translators useful, so
> CCing.
>
> On Wed, 28 Jun 2023 11:49:39 +0200
> Karl Ove Hufthammer <karl at huftis.org> wrote:
>
> > Yuri Chornoivan skreiv 28.06.2023 07:44:
> > >> ... And all that just to find:
> > >> The only difference between the two large hunks was a one
> > >> character typo fix, "encapulates" -> "encapsulates"
> > >> at original line:
> > >> #| "circle centred on the star centroid that encapulates half the
> > >> star's flux."
> > >>
> > >> Is there an easier way to find the difference(s)?
> > > Hi,
> > >
> > > I use Lokalize and it shows the diffrences immediately.
> >
> > I also recommend using Lokalize. The built-in coloured diff feature
> > is very useful. See attached screenshot (if it is accepted by the
> > mailing list). I could not imagine doing translation work without
> > such a feature.
> >
> > But these complicated HTML strings (with full HTML headers, lots of
> > style attributes &c.) are annoying. I think they’re automatically
> > generated by Qt Designer if you’re not careful.
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-i18n-doc/attachments/20231104/ac563fdf/attachment.htm>


More information about the kde-i18n-doc mailing list