[PyQt] PyQt5 fstring translation

Dmitry Shachnev mitya57 at ubuntu.com
Tue Apr 2 15:21:09 BST 2019


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190402/14f51d01/attachment.sig>


More information about the PyQt mailing list