PyQt5 fstring translation

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

PyQt5 fstring translation

Shyne
Hello,

It seems that fstring translation doesn't work with PyQt 5.11.3, every
fstring are ignored by pylupdate.
is it planned to add it later?

Thanks.

Shyne



--
Sent from: http://python.6.x6.nabble.com/PyQt-f1792048.html
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: PyQt5 fstring translation

Phil Thompson-5
On 1 Apr 2019, at 10:42 am, Shyne <[hidden email]> wrote:
>
> Hello,
>
> It seems that fstring translation doesn't work with PyQt 5.11.3, every
> fstring are ignored by pylupdate.
> is it planned to add it later?

Try tonight's snapshot.

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: PyQt5 fstring translation

Shyne
I'll try that tomorrow, thanks :)



--
Sent from: http://python.6.x6.nabble.com/PyQt-f1792048.html
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: PyQt5 fstring translation

Shyne
Ok I can see the fstrings now in linguist with the last snapshot !

But the translation work only if I remove the string variable ex:

var = "plop"

Working: self.tr(f"Test without")

Not working: self.tr(f"Test with {var}")



--
Sent from: http://python.6.x6.nabble.com/PyQt-f1792048.html
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: PyQt5 fstring translation

Dmitry Shachnev
On Tue, Apr 02, 2019 at 06:54:11AM -0700, Shyne wrote:
> Ok I can see the fstrings now in linguist with the last snapshot !
>
> But the translation work only if I remove the string variable ex:
>
> var = "plop"
>
> Working: self.tr(f"Test without")
>
> Not working: self.tr(f"Test with {var}")

How do you think it will work? pylupdate5 does not know what will be the
value of var, so what should it put into the .ts file?

I think if you need to translate some string, you should use percent
formatting or the format() method, not fstrings.

--
Dmitry Shachnev

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PyQt5 fstring translation

Phil Thompson-5
In reply to this post by Shyne
On 2 Apr 2019, at 2:54 pm, Shyne <[hidden email]> wrote:

>
> Ok I can see the fstrings now in linguist with the last snapshot !
>
> But the translation work only if I remove the string variable ex:
>
> var = "plop"
>
> Working: self.tr(f"Test without")
>
> Not working: self.tr(f"Test with {var}")

If the string appears as expected in linguist then pylupdate is working as expected.

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: PyQt5 fstring translation

Shyne
I've just asked if it was possible to translate fstring, apparently it's not.

Thanks you all.



--
Sent from: http://python.6.x6.nabble.com/PyQt-f1792048.html
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: PyQt5 fstring translation

Barry Scott


> On 2 Apr 2019, at 15:56, Shyne <[hidden email]> wrote:
>
> I've just asked if it was possible to translate fstring, apparently it's not.

Correct. It cannot be translated and never will be possible for f strings by design.

Barry
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt