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

List:       kwrite-devel
Subject:    Re: Using i18n
From:       Shaheed Haque <srhaque () theiet ! org>
Date:       2013-05-03 19:47:48
Message-ID: CAHAc2jcjf7uZ97h3c73r7XmCn_gicEO7c3Cz7P1Nbr1ivfwEww () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Just after I hit "send", I found this:

http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg14058.html

which suggests this is not an issue???


On 3 May 2013 20:42, Shaheed Haque <srhaque@theiet.org> wrote:

> Hi Philipp,
> 
> On 3 May 2013 19:56, Philipp A. <flying-sheep@web.de> wrote:
> 
> > Hi, i've seen some uses of kdecore.i18n popping up in Paté plugins, and
> > have some recommendations:
> > 
> > 2. It takes more than one argument. so for the sake of consistency
> > instead of doing the ugly
> > i18n(b'foo %(name)s.') % { 'name': 'bar'}
> > or even the better
> > i18n(b'foo {name}.').format(name='bar')
> > we should do the Qt-style
> > i18n(b'foo %1.', 'bar')
> > 
> > 1.  i18n takes byte strings. even on python3. this means that every time
> > a developer accustomed to python2 who doesn't know it tries to use it, the
> > plugin WILL break for python3 users.
> > 
> 
> I've been using the argument syntax of the third form, but simply
> specified quoted strings (i.e. without the "b" prefix). Without really
> thinking about it, I had assumed that i18n would have done something
> plausible on Python2 (not sure exactly what though!), and on Python3 it
> would just be Unicode all the way. I'd certainly prefer not avoid having to
> use "b" all over the place.
> 
> https://github.com/Werkov/PyQt4/blob/master/examples/tools/i18n/i18n.py
> 
> seems to suggest that something like that is possible, but when I went
> looking for some docs on this, but could not see an obvious spec. Do you
> have a reference handy?
> 
> Thanks, Shaheed
> 
> 
> > 
> > we have to come up with a solution.
> > 
> > there is a possible solution here, but it involves a fairly convoluted
> > i18n replacement:
> > 
> > https://projects.kde.org/projects/kde/applications/kate/repository/revisions/maste \
> > r/entry/addons/kate/pate/src/plugins/python_console_ipython/python_console_ipython.py#L36
> >  
> > should we add that function to libkatepate and call it a day?
> > 
> > _______________________________________________
> > KWrite-Devel mailing list
> > KWrite-Devel@kde.org
> > https://mail.kde.org/mailman/listinfo/kwrite-devel
> > 
> > 
> 


[Attachment #5 (text/html)]

<div dir="ltr">Just after I hit &quot;send&quot;, I found this:<div><br></div><div><a \
href="http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg14058.html">http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg14058.html</a> \
</div> <div><br></div><div>which suggests this is not an issue???</div></div><div \
class="gmail_extra"><br><br><div class="gmail_quote">On 3 May 2013 20:42, Shaheed \
Haque <span dir="ltr">&lt;<a href="mailto:srhaque@theiet.org" \
target="_blank">srhaque@theiet.org</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div>Hi Philipp,<br></div><div \
class="gmail_extra"><br><div class="gmail_quote"><div class="im">On 3 May 2013 19:56, \
Philipp A. <span dir="ltr">&lt;<a href="mailto:flying-sheep@web.de" \
target="_blank">flying-sheep@web.de</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div \
dir="ltr"><div><div><div><div>Hi, i've seen some uses of kdecore.i18n popping up in \
Paté plugins, and have some recommendations:<br>

<div><br></div>2. It takes more than one argument. so for the sake of consistency \
instead of doing the ugly<br>  i18n(b&#39;foo %(name)s.&#39;) % { &#39;name&#39;: \
&#39;bar&#39;}<br><div>or even the better<br></div><div>      i18n(b&#39;foo \
{name}.&#39;).format(name=&#39;bar&#39;)<br></div>we should do the Qt-style<br>       \
i18n(b&#39;foo %1.&#39;, &#39;bar&#39;)<br>


<br></div><div>1.   i18n takes byte strings. even on python3. this means that every \
time a developer accustomed to python2 who doesn't know it tries to use it, the \
plugin WILL break for python3 users.<br></div></div></div>

</div></div></blockquote><div><br></div></div><div><div>I&#39;ve been using the \
argument syntax of the third form, but simply specified quoted strings (i.e. without \
the &quot;b&quot; prefix). Without really thinking about it, I had assumed that i18n \
would have done something plausible on Python2 (not sure exactly what though!), and \
on Python3 it would just be Unicode all the way. I&#39;d certainly prefer not avoid \
having to use &quot;b&quot; all over the place.</div>

<div><br></div><div><a \
href="https://github.com/Werkov/PyQt4/blob/master/examples/tools/i18n/i18n.py" \
target="_blank">https://github.com/Werkov/PyQt4/blob/master/examples/tools/i18n/i18n.py</a><br></div><div><br></div><div>
 seems to suggest that something like that is possible, but when I went looking for \
some docs on this, but could not see an obvious spec. Do you have a reference \
handy?</div> </div><div><br></div><div>Thanks, Shaheed</div><div>  </div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
 <div class="im">
<div dir="ltr"><div><div><div><div><br></div><div>we have to come up with a \
solution.<br> <br></div><div>there is a possible solution here, but it involves a \
fairly convoluted i18n replacement:<br><a \
href="https://projects.kde.org/projects/kde/applications/kate/repository/revisions/mas \
ter/entry/addons/kate/pate/src/plugins/python_console_ipython/python_console_ipython.py#L36" \
target="_blank">https://projects.kde.org/projects/kde/applications/kate/repository/rev \
isions/master/entry/addons/kate/pate/src/plugins/python_console_ipython/python_console_ipython.py#L36</a><br>



<br></div><div>should we add that function to libkatepate and call it a \
day?<br></div></div></div></div></div> \
<br></div>_______________________________________________<br> KWrite-Devel mailing \
list<br> <a href="mailto:KWrite-Devel@kde.org" \
target="_blank">KWrite-Devel@kde.org</a><br> <a \
href="https://mail.kde.org/mailman/listinfo/kwrite-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/kwrite-devel</a><br> \
<br></blockquote></div><br></div></div> </blockquote></div><br></div>



_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel


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

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