Migrating Pology to Python 3

Johnny Jazeix jazeix at gmail.com
Wed Oct 5 21:14:40 BST 2022


Adding back the _escape in
https://invent.kde.org/sdk/pology/-/blob/python3/pology/message.py#L556
self.__dict__[att_lins] = wrapf(fname, msgsth,
->
self.__dict__[att_lins] = wrapf(fname, _escape(msgsth),
fixes it for the msgid, but I haven't found the one for msgstr.

If I add back the one that was in
https://invent.kde.org/sdk/pology/-/blob/python3/pology/message.py#L574, it
works again if I don't do the previous change in the header.py.
I've attached the patch.

It causes multiple changes in the formatting of the po:
-#, kde-kuit-format, no-c-format
+#, no-c-format, kde-kuit-format
...
-msgid ""
-"The folder %1 is part of the album path and cannot be imported
recursively!"
-msgstr ""
-"Le dossier %1 fait partie d'un emplacement d'album et ne peut être
importé"
-" récursivement !"
+msgid "The folder %1 is part of the album path and cannot be imported
recursively!"
+msgstr "Le dossier %1 fait partie d'un emplacement d'album et ne peut être
importé récursivement !"

Except this, the results look good but I would need to check more the diff..
Thank you for working on porting these scripts to python3!

Cheers,

Johnny


Le mer. 5 oct. 2022 à 21:24, Johnny Jazeix <jazeix at gmail.com> a écrit :

> Hi,
> This can be fixed by replacing in:
> https://invent.kde.org/sdk/pology/-/blob/master/pology/header.py#L245
> "%s: %s\n" % tuple(field) with r"%s: %s\n" % tuple(field)
> After fixing it, I have another issue in
> /tmp/calendarjanitor.po~merged-70359:307: missing 'msgstr' section
> #. +> trunk5 stable5
> #: calendarjanitor.cpp:621
> #, kde-format
> msgid "id=%1; summary="%2""
> msgstr "id=%1; summary= « %2 »"
>
> The " are not escaped in the msgid.
> I'm taking a quick look in case I find it but I don't guarantee anything.
>
> Cheers,
>
> Johnny
>
>
> Le mer. 5 oct. 2022 à 19:41, Karl Ove Hufthammer <karl at huftis.org> a
> écrit :
>
>> Luigi Toscano skreiv 05.10.2022 19:25:
>> >> Traceback (most recent call last):
>> >>   File "/path/to/pology/bin/./posummit", line 21, in <module>
>> >>     from pology import version, _, n_, t_, PologyError
>> >> ModuleNotFoundError: No module named 'pology'
>> >>  From which folder should I run the script?
>> > Add the path to the pology directory to PYTHONPATH.
>> >
>> > In the long run we should add the support for properly installing
>> pology with
>> > python tools, not with cmake.
>>
>> Thanks. Adding the directory to PYTHONPATH worked.
>>
>> Running posummit, I got an error message about invalid syntax in the
>> summit_helpers_NO.py script that we use for the Norwegian translations.
>> But this was easily fixed using 2to3.
>>
>> Then running posummit quickly resulted in an error message about an
>> invalid .po file akonadi-calendar-tools._desktop_.po. The original file
>> was valid, but Pology writes an invalid file. The original file looked
>> like this:
>>
>> msgid ""
>> msgstr ""
>> "Project-Id-Version: desktop_kdepim\n"
>> "Report-Msgid-Bugs-To: https://bugs.kde.org\n"
>> "POT-Creation-Date: 2019-05-20 12:22+0200\n"
>> "PO-Revision-Date: 2015-05-08 01:10+0200\n"
>> […]
>>
>> But Pology writes out this file (to /tmp):
>>
>> msgid ""
>> msgstr "Project-Id-Version: desktop_kdepim
>> Report-Msgid-Bugs-To: https://bugs.kde.org
>> POT-Creation-Date: 2019-05-20 12:22+0200
>> PO-Revision-Date: 2015-05-08 01:10+0200
>> […]
>>
>> So it looks like the \n" is missing from the header lines.
>>
>>
>> --
>> Karl Ove Hufthammer
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-i18n-doc/attachments/20221005/08faa35a/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pology.diff
Type: application/octet-stream
Size: 1587 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-i18n-doc/attachments/20221005/08faa35a/attachment-0001.obj>


More information about the kde-i18n-doc mailing list