How to change languages(translations) dynamically on PyQt5?

前端 未结 2 666
别跟我提以往
别跟我提以往 2020-12-30 16:30

I wonder if it is possible to change the languages(translations) dynamically without using qt designer to make the UI? That means I don\'t want to use the function retransla

2条回答
  •  礼貌的吻别
    2020-12-30 16:50

    No you will have to use a technique like Qt Designer does with retranslateUi because the Qt widget system does not have a way to redo the translation on it's own (otherwise QT Designer would be using that to).

    Building such a system would require a fundamental change to the widgets as for each string property you would need to know that it contains a translatable string (not a data value) and knowing the original string for looking up the new translation would be best (reversing translations could be ambiguous).

提交回复
热议问题