[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-i18n-doc
Subject:    Re: Migrating Pology to Python 3
From:       Johnny Jazeix <jazeix () gmail ! com>
Date:       2022-12-24 10:31:42
Message-ID: CAEtcAPEqd0-J8GXVymvwb+Hwh=MKo=eg-Sw8+VviZh3V1D3P8g () mail ! gmail ! com
[Download RAW message or body]

Le sam. 24 déc. 2022 à 11:17, Albert Astals Cid <aacid@kde.org> a écrit :

> El diumenge, 18 de desembre de 2022, a les 13:13:25 (CET), Johnny Jazeix
> va
> escriure:
> > Hi,
> >
> > I've spotted an issue when using posieve with check_rules or check-spell
> > and wanted to output in xml.
> >
> https://invent.kde.org/sdk/pology/-/blob/python3/sieve/check_rules.py#L211
> > does not like the decode().
> > The same exists in
> >
> https://invent.kde.org/sdk/pology/-/blob/python3/sieve/check_spell.py#L116
> >
> > I'm not sure if only removing the "
> .decode(locale.getpreferredencoding() "
> > or how to replace it to keep this functionality.
>
> For those of us that have no idea how to use posieve but know a bit of
> coding.
>
> What's the command line invocation we have to do to get that error?
>
> Cheers,
>   Albert
>
>
Hi,

python ~/pology/scripts/posieve.py -b -s xml:test.xml -s lang:fr
check_rules
~/kde_i18n_fr/trunk/l10n-support/fr/summit/messages/kparts/kparts._desktop_.po

It creates the test.xml that should contain all the issues for this file
but it fails formatting the date to the prefered locale.

Cheers,

Johnny



> >
> > Cheers,
> >
> > Johnny
> >
> > Le sam. 8 oct. 2022 Ã  18:04, Karl Ove Hufthammer <karl@huftis.org> a
> écrit :
> > > Adrian Chaves skreiv 08.10.2022 17:11:
> > > > This is caused by
> > > >
> https://kingant.net/2019/01/rounding-numbers-in-python-2-and-python-3/
> > > >
> > > > When plural forms are found, the average is calculated and rounded.
> In
> > > > Python 2, round(2.5) is 3, in Python 3 round(2.5) is 2.
> > > >
> > > > I have no strong opinion on the matter, but I am slightly inclined to
> > > > keep the Python 3 behavior on this.
> > >
> > > Yes, I see no reason not to use Python's default rounding rules. But is
> > > there a reason that the average and not the sum is calculated
> > > (Chusslove)? After all, the sum *is* the number of words in the English
> > > source text (or translation).
> > >
> > >
> > > --
> > > Karl Ove Hufthammer
>
>
>
>
>

[Attachment #3 (text/html)]

<div dir="ltr"><div dir="ltr"><br></div><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">Le  sam. 24 déc. 2022 à  11:17, Albert Astals Cid &lt;<a \
href="mailto:aacid@kde.org">aacid@kde.org</a>&gt; a écrit  :<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">El diumenge, 18 de desembre de 2022, a les \
13:13:25 (CET), Johnny Jazeix va <br> escriure:<br>
&gt; Hi,<br>
&gt; <br>
&gt; I&#39;ve spotted an issue when using posieve with check_rules or check-spell<br>
&gt; and wanted to output in xml.<br>
&gt; <a href="https://invent.kde.org/sdk/pology/-/blob/python3/sieve/check_rules.py#L211" \
rel="noreferrer" target="_blank">https://invent.kde.org/sdk/pology/-/blob/python3/sieve/check_rules.py#L211</a><br>
 &gt; does not like the decode().<br>
&gt; The same exists in<br>
&gt; <a href="https://invent.kde.org/sdk/pology/-/blob/python3/sieve/check_spell.py#L116" \
rel="noreferrer" target="_blank">https://invent.kde.org/sdk/pology/-/blob/python3/sieve/check_spell.py#L116</a><br>
 &gt; <br>
&gt; I&#39;m not sure if only removing the &quot; \
.decode(locale.getpreferredencoding() &quot;<br> &gt; or how to replace it to keep \
this functionality.<br> <br>
For those of us that have no idea how to use posieve but know a bit of coding.<br>
<br>
What&#39;s the command line invocation we have to do to get that error?<br>
<br>
Cheers,<br>
   Albert<br>
<br></blockquote><div><br></div><div>
<div dir="ltr"><div>Hi,</div><div><br></div><div>python ~/pology/scripts/posieve.py \
-b -s xml:test.xml -s lang:fr  check_rules 
~/kde_i18n_fr/trunk/l10n-support/fr/summit/messages/kparts/kparts._desktop_.po</div></div><div><br></div><div>It \
creates the test.xml that should contain all the issues for this file but it fails \
formatting the date to the prefered locale.</div><div><br></div><div \
dir="ltr"><div>Cheers,</div><div><br></div><div>Johnny</div><div><br></div></div>

</div><div>  </div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> &gt; <br>
&gt; Cheers,<br>
&gt; <br>
&gt; Johnny<br>
&gt; <br>
&gt; Le sam. 8 oct. 2022 Ã  18:04, Karl Ove Hufthammer &lt;<a \
href="mailto:karl@huftis.org" target="_blank">karl@huftis.org</a>&gt; a écrit :<br> \
&gt; &gt; Adrian Chaves skreiv 08.10.2022 17:11:<br> &gt; &gt; &gt; This is caused \
by<br> &gt; &gt; &gt; <a \
href="https://kingant.net/2019/01/rounding-numbers-in-python-2-and-python-3/" \
rel="noreferrer" target="_blank">https://kingant.net/2019/01/rounding-numbers-in-python-2-and-python-3/</a><br>
 &gt; &gt; &gt; <br>
&gt; &gt; &gt; When plural forms are found, the average is calculated and rounded. \
In<br> &gt; &gt; &gt; Python 2, round(2.5) is 3, in Python 3 round(2.5) is 2.<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; I have no strong opinion on the matter, but I am slightly inclined \
to<br> &gt; &gt; &gt; keep the Python 3 behavior on this.<br>
&gt; &gt; <br>
&gt; &gt; Yes, I see no reason not to use Python's default rounding rules. But is<br>
&gt; &gt; there a reason that the average and not the sum is calculated<br>
&gt; &gt; (Chusslove)? After all, the sum *is* the number of words in the English<br>
&gt; &gt; source text (or translation).<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; --<br>
&gt; &gt; Karl Ove Hufthammer<br>
<br>
<br>
<br>
<br>
</blockquote></div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic