The present invention discloses a language switching method and
system for QT-based applications, which relates to the field of computers and solves the problems of the existing QT language switching method that requires restarting the application program and has complex
software design. The key points of its technical solution are as follows: It includes creating a
data structure based on the QT property interface to
record the objects that need to be translated, the property names of the objects that need to be translated, and the source language text of the property values, and entering the data members in the form of a combination of the object, the property, and the source language text; in response to the language switching instruction, unloading the source language file and loading the new language file according to the language to be translated, traversing each object and property in the data members to obtain the source language text, calling the QT translation method to translate the source language text into the translated text, and setting the
property value of the object according to the translated text; implementing a simple, readable, and easy-to-maintain dynamic language switching method through the QT property interface.