diff options
| author | Christian Tismer <tismer@stackless.com> | 2021-06-26 14:37:17 +0200 |
|---|---|---|
| committer | Christian Tismer <tismer@stackless.com> | 2021-06-29 11:24:00 +0200 |
| commit | c61141d43fd6e56a52449cbfe6cc13d07f9156bb (patch) | |
| tree | 174df2032544e229133a5d1257aaddf19b8ebbe3 /sources/pyside6/PySide6/support/generate_pyi.py | |
| parent | 020ada12c366e579b92803fd8a82010b8d93d87d (diff) | |
translate: Fix translation for derived types
[ChangeLog][PySide6] The `tr` function now works also for
PySide derived Python class instances with the right context.
Qt has a translation feature that works fine on strings that
are directly parsed from a Python class.
For derived classes, the correct context could not be found.
This problem could have been solved by obtaining the calling
function name from the frame stack, walking the mro and
examining in which class dict the calling function can be
found, but this works for Python functions, only.
For any function, simply probing the translation result is
even easier and always works.
We walk the mro, too, but simply use each class name in turn
as context and probe by comparison if a translation was done.
Change-Id: Ibca9dc0098a3aa26a674b3d5e24ea14e651fe6de
Fixes: PYSIDE-131
Pick-to: 6.1
Pick-to: 5.15
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/support/generate_pyi.py')
0 files changed, 0 insertions, 0 deletions
