System language switching method and device, electronic equipment and storage medium

By calling the translation resource file package during system language switching and using rendering functions for rendering processing, the problems of low efficiency and consistency of system language switching in the prior art are solved, and automated system language switching and efficient language switching results are realized.

CN119248407APending Publication Date: 2025-01-03GUANGZHOU BAOLUN ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411362837.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

The prior art has problems such as low switching efficiency and difficulty in ensuring consistency and integrity during system language switching, especially when it is necessary to manually perform switching processing for each control to be switched separately.

Method used

When receiving the system language switching instructions, the translation resource file package of the target system is retrieved, and the translation resource file of the switching object is rendered based on the target rendering function, thereby realizing automatic switching of the system language.

Benefits of technology

It improves the efficiency of system language switching, ensures the consistency and integrity of language switching results of all objects to be switched, and reduces repetitive labor.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248407A_ABST
    Figure CN119248407A_ABST
Patent Text Reader

Abstract

The invention discloses a system language switching method and device, electronic equipment and a storage medium, and the method comprises the steps: calling a translation resource file package corresponding to a target system language according to the target system language corresponding to the target system when a system language switching instruction of the target system is received; for at least one to-be-switched object in the target system, determining a target translation resource file and a target rendering function corresponding to the current to-be-switched object from the translation resource file package; and performing rendering processing on the target translation resource file based on the target rendering function to switch the system language of the current to-be-switched object to the target system language. The system language of the to-be-switched object in the system is automatically switched to the target system language, and the switching efficiency of the system languages is improved on the premise that the accuracy of the switching result of the system languages of all the to-be-switched objects is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of system control, and in particular to a system language switching method, device, electronic equipment and storage medium. Background Art

[0002] Currently, when switching the system language of an operating system or application software, you can reload a new language resource file without restarting the program, then manually call each UI control in the application and reset its translation text. However, this system language switching method has low switching efficiency, and because each control to be switched needs to be switched manually, there is a lot of duplication of work in the system language switching process, and it is difficult to ensure the consistency and integrity of the system language switching.

[0003] In order to solve the above problems, it is necessary to improve the system language switching method. Summary of the invention

[0004] The present invention provides a system language switching method, device, electronic device and storage medium to solve the problems in the prior art that when switching the system language of a target system, each object to be switched in the system needs to be switched separately, resulting in a large amount of repeated work, difficulty in ensuring the consistency and integrity of the system language switching, and low switching efficiency.

[0005] In a first aspect, an embodiment of the present invention provides a method for switching a system language, comprising:

[0006] When receiving a system language switching instruction of a target system, calling a translation resource file package corresponding to the target system language according to the target system language corresponding to the target system; wherein the target system is an operating system or an application software system;

[0007] For at least one object to be switched in the target system, determining a target translation resource file and a target rendering function corresponding to the current object to be switched from the translation resource file package;

[0008] The target translation resource file is rendered based on the target rendering function to switch the system language of the current object to be switched to the target system language.

[0009] In a second aspect, an embodiment of the present invention further provides a system language switching device, comprising:

[0010] A file package retrieval module, configured to retrieve a translation resource file package corresponding to the target system language according to the target system language corresponding to the target system when receiving a system language switching instruction of the target system; wherein the target system is an operating system or an application software system;

[0011] A determination module, configured to determine, for at least one object to be switched in the target system, a target translation resource file and a target rendering function corresponding to the current object to be switched from the translation resource file package;

[0012] The system language switching module is used to render the target translation resource file based on the target rendering function to switch the system language of the current object to be switched to the target system language.

[0013] In a third aspect, an embodiment of the present invention further provides an electronic device, including:

[0014] at least one processor; and

[0015] a memory communicatively connected to the at least one processor; wherein,

[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the system language switching method described in any embodiment of the present invention.

[0017] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the system language switching method described in any embodiment of the present invention when executed.

[0018] In a fifth aspect, an embodiment of the present invention further provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, the system language switching method as described in any one of the embodiments of the present invention is implemented.

[0019] The technical solution of the embodiment of the present invention is to call the translation resource file package corresponding to the target system language according to the target system language corresponding to the target system when receiving the system language switching instruction of the target system; determine the target translation resource file and target rendering function corresponding to the current object to be switched from the translation resource file package for at least one object to be switched in the target system; render the target translation resource file based on the target rendering function to switch the system language of the current object to be switched to the target system language. In this technical solution, by presetting a translation resource file package corresponding to at least one system language, and determining the target system language corresponding to the target system according to the target system language in the instruction when receiving the system language switching instruction, the translation resource file package corresponding to the target system language is determined from the pre-set multiple translation resource file packages. Among them, the translation resource file package includes the target translation resource files corresponding to all the objects to be switched in the target system. Further, the target system is switched from the currently used system language to the target system language by calling the target rendering function for language switching of the target translation resource file. In this process, when the system language of the target system is switched, the target translation resource files corresponding to each object to be switched in the target system can be determined based on the translation resource files corresponding to the target system language. Therefore, when the system language is switched, the language switching rendering can be directly performed, and there is no need to translate the system language for each object to be switched. The problem of a large amount of repetitive work, difficulty in ensuring the consistency and integrity of the system language switching, and low switching efficiency when switching the system language of the target system in the prior art is solved. The system language of the object to be switched in the system is automatically switched to the target system language, and the switching efficiency of the system language is improved under the premise of ensuring the accuracy of the system language switching results of all objects to be switched.

[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 is a flow chart of a method for switching a system language provided according to Embodiment 1 of the present invention;

[0023] Figure 2 is a flow chart of a method for switching a system language provided according to a second embodiment of the present invention;

[0024] Figure 3 is a flowchart of a specific example of a method for switching a system language provided according to Embodiment 2 of the present invention;

[0025] Figure 4 is a schematic diagram of the structure of a system language switching device provided according to Embodiment 3 of the present invention;

[0026] Figure 5 The present invention is a schematic diagram of the structure of an electronic device for implementing the method for switching the system language according to an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only an embodiment of a part of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention. The acquisition, transmission, storage, use, and processing of data in the technical scheme of this application are in compliance with the relevant provisions of national laws and regulations. It should be noted that in the embodiments of this application, certain software, components, or models that already exist in the industry may be mentioned. They should be considered as exemplary. Their purpose is only to illustrate the feasibility of the implementation of the technical scheme of this application, but it does not mean that the applicant has or will necessarily use the scheme.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein.

[0029] Embodiment 1

[0030] Figure 1A flowchart of a system language switching method is provided for the first embodiment of the present invention. This embodiment can be applied to the situation where, when a system language switching instruction is received, a target system language corresponding to a target system is determined, and the system language of each object to be switched in the target system is switched to the target system language based on a target rendering function in the target system and a translation resource file corresponding to a preset target system language. The method can be executed by a system language switching device, which can be implemented in the form of hardware and / or software, and can be configured in a computing device that can execute the system language switching method.

[0031] like Figure 1 As shown, the method includes:

[0032] S110 , when a system language switching instruction of the target system is received, a translation resource file package corresponding to the target system language is retrieved according to the target system language corresponding to the target system.

[0033] The target system is an operating system or an application software system. For example, the target system may be a Windows operating system, an XP operating system, or a Linux operating system, or may be an application software system deployed in a mobile communication device or an intelligent terminal device. The system language switching instruction may be understood as an instruction for switching the system language of the target system. The target system language refers to the language after the target system language is switched.

[0034] It is understandable that when switching the system language of the target system, it is necessary to switch all the text information that can be displayed in the target system to the corresponding target system language, such as the operation controls, icon information, application software, system properties and other text information that can be displayed in the target system. In this technical solution, each text information that can be switched to the system language in the target system is called an object to be translated. Based on this, the translation resource file package can be understood as a collection of text translation information corresponding to all the objects to be translated in the target system under the same system language.

[0035] It should be noted that, according to different user requirements for the system language of the target system, different categories of translation resource file packages can be pre-set, for example, a translation resource file package corresponding to Chinese, a translation resource file package corresponding to English, a translation resource file package corresponding to Korean, or a translation resource file package corresponding to Russian, etc. The advantage of such a setting is that by pre-setting a variety of translation resource file packages, the requirements of different users for the system language of the target system can be met, and it is more flexible and convenient when switching the system language of the target system.

[0036] Exemplarily, a trigger operation is performed based on the operation interface of the target system, such as inputting or selecting "Chinese-English" in the system language selection box of the operation interface, and the English language is the target system language. Further, generating a system language switching instruction based on the trigger operation can enable the target system to switch the target system from the currently used Chinese language to the English language according to the system language switching instruction, and call a pre-set translation resource file package corresponding to English, so as to switch the system language of the target system based on the translation resource file package.

[0037] Optionally, before calling the translation resource file corresponding to the target system language according to the target system language corresponding to the target system, it also includes: determining at least one convertible system language corresponding to the current object to be translated for at least one object to be translated in the target system; determining a binary translation resource file corresponding to the current convertible system language for each convertible system language; and constructing a translation resource file package based on at least one binary translation resource file associated with each object to be translated in the target system.

[0038] Among them, the convertible system language can be any language that can transmit text information, for example, the convertible system language can be Chinese, English, Japanese, Korean, Spanish, German, Italian or French, etc. In this technical solution, there is no limitation on the specific language type of the convertible system language, and the system language can be pre-set in the target system according to actual needs.

[0039] In actual applications, a translation resource file package corresponding to at least one convertible system language is pre-set. Here, when the current convertible language is English, the translation resource file package corresponding to the current convertible system language is set as an example. If the target system contains 1,000 objects to be translated, each object to be translated is translated into English separately to obtain binary translation resource files corresponding to the 1,000 objects to be translated, and then the translation resource file package corresponding to the English language is obtained based on the binary translation resource files of all the objects to be translated.

[0040] Optionally, calling a translation resource file corresponding to the target system language according to the target system language corresponding to the target system includes: parsing a system language switching instruction to obtain a target system language corresponding to the target system; and determining a translation resource file package corresponding to the target system language from at least one resource file package to be selected based on a pre-built target mapping table.

[0041] The target mapping table includes at least one system language, each system language is associated with a corresponding translation resource file package, and each translation file package is a collection of translation resource files of all objects to be translated in the target system under the corresponding system language.

[0042] It is understandable that there are many types of system languages ​​that can be set in the target system. When setting the system language, the translation resource file packages corresponding to each system language can be used as the resource file packages to be selected. In other words, the number of translation resource file packages to be selected is equal to the number of system languages ​​in the target system, and corresponds one-to-one to various system languages.

[0043] In actual applications, in order to quickly switch the system language of the target system to the target system language after receiving a system language switching instruction and determining the target system language corresponding to the target system in the system language switching instruction, a query can be performed through a pre-established mapping relationship between each system language and the corresponding resource file package to be selected, and at least one resource file package to be selected can be selected as a translation resource file package corresponding to the target system language based on the query result.

[0044] For example, if the target system contains 1000 objects to be translated, and it is assumed that resource file packages to be selected corresponding to 50 system languages ​​need to be constructed, then for each object to be translated, the current object to be translated is translated into translation information corresponding to the 50 system languages ​​(i.e., binary translation resource files). Based on this, after all objects to be translated are translated, the set of translation information corresponding to all objects to be translated associated with the same system language is used as the resource file package to be selected, and each resource file package to be selected is mapped and associated with the corresponding system language, so that after determining the target system language corresponding to the target system, the corresponding translation resource file package is determined from at least one resource file package to be selected based on the target system language and the pre-set mapping relationship.

[0045] S120: For at least one object to be switched in the target system, determine a target translation resource file and a target rendering function corresponding to the current object to be switched from the translation resource file package.

[0046] The object to be switched can be understood as the object to be translated that needs to be switched to the system language in the target system after receiving the system language switching instruction. The target translation resource file refers to the binary translation resource file corresponding to the object to be switched. The target rendering function can be understood as a conversion tool that converts the object to be switched from the currently used system language to the target system language.

[0047] Specifically, when a system language switching instruction is received, the target system language corresponding to the target system can be determined, and on this basis, the system language of at least one object to be switched in the target system needs to be switched. For example, if the target system includes 1,000 objects to be switched, the system language of each object to be switched needs to be switched separately.

[0048] During this process, one or more target rendering functions of each object to be switched can be determined according to the callback function corresponding to each object to be switched, so that the target translation resource file corresponding to the object to be switched can be translated and rendered through each target rendering function to obtain the rendering result corresponding to each object to be switched, and the system language of each object to be switched can be switched to the target system language.

[0049] S130: Rendering the target translation resource file based on the target rendering function to switch the system language of the current object to be switched to the target system language.

[0050] Taking one of the objects to be switched as the current object to be switched as an example, the callback function corresponding to the current object to be switched is called to determine the target rendering function corresponding to the callback function of the current object to be switched based on the mapping relationship between the callback function and the rendering function. Furthermore, if the target translation resource file corresponding to the current object to be switched is known, the system language of the current object to be switched can be switched to the target system language by controlling the target rendering function to perform rendering of the target translation resource file.

[0051] The technical solution of the embodiment of the present invention is to call the translation resource file package corresponding to the target system language according to the target system language corresponding to the target system when receiving the system language switching instruction of the target system; determine the target translation resource file and target rendering function corresponding to the current object to be switched from the translation resource file package for at least one object to be switched in the target system; render the target translation resource file based on the target rendering function to switch the system language of the current object to be switched to the target system language. In this technical solution, by presetting a translation resource file package corresponding to at least one system language, and determining the target system language corresponding to the target system according to the target system language in the instruction when receiving the system language switching instruction, the translation resource file package corresponding to the target system language is determined from the pre-set multiple translation resource file packages. Among them, the translation resource file package includes the target translation resource files corresponding to all the objects to be switched in the target system. Further, the target system is switched from the currently used system language to the target system language by calling the target rendering function for language switching of the target translation resource file. In this process, when the system language of the target system is switched, the target translation resource files corresponding to each object to be switched in the target system can be determined based on the translation resource files corresponding to the target system language. Therefore, when the system language is switched, the language switching rendering can be directly performed, and there is no need to translate the system language for each object to be switched. The problem of a large amount of repetitive work, difficulty in ensuring the consistency and integrity of the system language switching, and low switching efficiency when switching the system language of the target system in the prior art is solved. The system language of the object to be switched in the system is automatically switched to the target system language, and the switching efficiency of the system language is improved under the premise of ensuring the accuracy of the system language switching results of all objects to be switched.

[0052] Embodiment 2

[0053] Figure 2 A flowchart of a system language switching method provided in Embodiment 2 of the present invention, optionally, the target translation resource file and the target rendering function corresponding to the current object to be switched determined from the translation resource file package are refined.

[0054] like Figure 2 As shown, the method includes:

[0055] S210: When a system language switching instruction of the target system is received, a translation resource file package corresponding to the target system language is retrieved according to the target system language corresponding to the target system.

[0056] S220: Determine a target translation resource file corresponding to the current object to be switched based on a mapping relationship between the object to be switched and the translation resource file in a pre-constructed object language switching table.

[0057] The object language switching table includes at least one object to be switched in the target system, and the system language corresponding to the object to be switched under the corresponding translation resource file package.

[0058] Exemplarily, a translation resource file package corresponding to at least one system language is pre-set, and a corresponding object language switching table can be set for each translation resource file package, so that when it is necessary to switch the system language of the object to be switched in the target system, the target translation resource file corresponding to each object to be switched is determined from the translation resource file package according to the object language switching table corresponding to the required translation resource file package.

[0059] Specifically, the target system language corresponding to the target system corresponds to the translation resource file package A, and an object language switching table A corresponding to the translation resource file A is set. Among them, the translation resource file A includes translation information of at least one object to be switched in the system language corresponding to the translation resource file A (that is, the target translation resource file), and accordingly, the object language switching table includes each object to be switched and the corresponding target translation resource file. When the system language switching instruction is received, the target translation resource file corresponding to each object to be switched can be determined according to the mapping relationship between the object to be switched and the translation resource file in the object language switching table.

[0060] S230: Determine the target callback function corresponding to the current object to be switched according to the pre-built callback function linked list.

[0061] The callback function linked list can be understood as an information table for storing callback functions corresponding to each object to be switched. The target callback function refers to the callback function corresponding to the current object to be switched determined according to the callback function list.

[0062] In a specific example, the system language translation and deployment of each object to be translated in the target system can be performed based on the QT graphics view framework, so as to implement the Ttr_manage translation resource management class based on the QT graphics view framework. The QT graphics view framework can provide a model view programming method based on graphics items, which mainly consists of three parts: scene, view and graphics item. The Ttr_manage translation resource management class is mainly used to load binary translation resource files, manage the system language switching function of the target system, and register to trigger the update callback. The class appears as a global singleton.

[0063] Specifically, by reading the .qm translation resource binary file, the translation file is loaded through the QTranslator class and the resource pointer is obtained. After loading, the corresponding language type enumeration is created, and the corresponding language type enumeration and the QTranslator class pointer are saved in the std::map container in the form of Key-Value to complete the loading function of the resource file. Further, a std::list translation callback list (i.e., callback function list) is created, which is used to store the callback functions corresponding to each object to be switched in the target system. A translation callback registration function is created to register the translation callback function to the std::list translation callback list. On this basis, a translation callback trigger function is created, which will cyclically trigger all registered callback functions in the std::list translation callback list to update all UI classes registered to the list, and further create a translation switching function, which is used to switch resource files and trigger the translation callback list to notify all UI classes that have registered to update the translation.

[0064] On this basis, after the callback function linked list is created, the target callback function corresponding to the current object to be switched can be determined based on the mapping relationship between each object to be switched and each callback function in the callback function linked list.

[0065] S240: Determine at least one rendering function associated with the target callback function as the target rendering function corresponding to the current object to be switched.

[0066] In the present technical solution, the rendering function is a conversion tool that actually switches the system language to be switched, and the target rendering function corresponding to each object to be switched cannot be directly determined from a large number of rendering functions. Based on this, the present technical solution not only needs to establish a mapping relationship between the object to be switched and the callback function, but also needs to establish a mapping relationship between each callback function and the rendering function, so that after determining the target callback function corresponding to the current object to be switched based on the callback function linked list, the target rendering function corresponding to the current object to be switched is determined according to the mapping relationship between the target callback function and the rendering function. Among them, the number of the target rendering functions can be one or more.

[0067] Based on the above examples, the Ttr_reload translation reload class is implemented based on the QT graphics view framework. This class is mainly used to call back the text setting function (i.e., rendering function) to update the translation. This class is very concise. Specifically, it adds a member variable std::function callback function pointer _fn_tr; adds a registered std::function callback set_tr_fn function to assign a callback function to the _fn_tr variable; adds a reload_tr_fn reload function that triggers the _fn_tr callback to trigger the execution of the _fn_tr callback function; in the Ttr_reload translation In the constructor of the overload class, the reload_tr_fn overload function is registered with the Ttr_manage translation resource management class. The effect is that every time a Ttr_reload or an object that inherits Ttr_reload is created, the reload_tr_fn overload function is added to the std::list translation callback list of the Ttr_manage translation resource management class, waiting for the Ttr_manage class to execute the trigger_fn_tr callback function, and determine the target rendering function corresponding to the current object to be switched from at least one rendering function through the target callback function corresponding to the current object to be switched.

[0068] S250: Rendering the target translation resource file based on the target rendering function to switch the system language of the current object to be switched to the target system language.

[0069] In actual application, at least one target rendering function associated with the current object to be switched is triggered; when each target rendering function receives a target translation resource file, the system language of the current object to be switched is translated based on each target rendering function according to the target translation resource file.

[0070] Based on the above example, the TrPushButton class is implemented based on the QT graphics view framework (this class is an example of QPushButton. If you need to dynamically translate QLabel, you can implement the TrLabel class and then take the same implementation steps). This class is a double inheritance class, inheriting both QPushButton and Ttr_reload. You can register the reload_tr_fn overload function to the Ttr_manage translation resource management class through the Ttr_reload class constructor, and register the setText(Ttr("")) text setting function to the set_tr_fn callback registration function of the Ttr_reload class to achieve one-time registration and multiple triggers, thereby achieving the effect of automatically updating the translation language.

[0071] In order to more clearly introduce the technical solution, in a specific example, a system language switching program is created, and the control automatically updates the translation (that is, the system language switching of the object to be switched) as follows: Figure 3 As shown, the specific implementation steps of the program are: calling the .qm loading function of the Ttr_manage translation resource management class in the main program to complete the loading of the translation file (that is, pre-setting a translation resource file package corresponding to at least one system language, and the translation resource file package includes translation resource files corresponding to each object to be switched). Further, the control layout is completed in the main window UI class (graphical interface). Among them, the control classes that need dynamic translation all need to inherit the Ttr_reload class, which is used to call the set_tr_fn callback registration function in the Ttr_reload of various multi-inherited controls to set the translation file and complete the registration of the text setting function (that is, rendering function). In the main window UI class, create a QComboBox class drop-down object (that is, for selecting the target system language that the target system is about to convert to use), and bind the currentTextChanged signal slot to trigger the slot function when the QComboBox class text changes. The control loads the Ttr_manage translation resource management class. All the translated texts corresponding to the various languages ​​have been loaded. On this basis, in the slot function of the QComboBox class drop-down object, the translation switching function of the Ttr_manage translation resource management class is called to switch the system language of each object to be switched in the target system to the target system language.

[0072] The technical solution of the embodiment of the present invention is to call the translation resource file package corresponding to the target system language according to the target system language corresponding to the target system when receiving the system language switching instruction of the target system; determine the target translation resource file and target rendering function corresponding to the current object to be switched from the translation resource file package for at least one object to be switched in the target system; render the target translation resource file based on the target rendering function to switch the system language of the current object to be switched to the target system language. In this technical solution, by presetting a translation resource file package corresponding to at least one system language, and determining the target system language corresponding to the target system according to the target system language in the instruction when receiving the system language switching instruction, the translation resource file package corresponding to the target system language is determined from the pre-set multiple translation resource file packages. Among them, the translation resource file package includes the target translation resource files corresponding to all the objects to be switched in the target system. Further, the target system is switched from the currently used system language to the target system language by calling the target rendering function for language switching of the target translation resource file. In this process, when the system language of the target system is switched, the target translation resource files corresponding to each object to be switched in the target system can be determined based on the translation resource files corresponding to the target system language. Therefore, when the system language is switched, the language switching rendering can be directly performed, and there is no need to translate the system language for each object to be switched. The problem of a large amount of repetitive work, difficulty in ensuring the consistency and integrity of the system language switching, and low switching efficiency when switching the system language of the target system in the prior art is solved. The system language of the object to be switched in the system is automatically switched to the target system language, and the switching efficiency of the system language is improved under the premise of ensuring the accuracy of the system language switching results of all objects to be switched.

[0073] Embodiment 3

[0074] Figure 4 This is a schematic diagram of the structure of a system language switching device provided in Embodiment 3 of the present invention. Figure 4 As shown, the device includes: a file package retrieving module 310, a determining module 320 and a system language switching module 330.

[0075] The file package retrieval module 310 is used to retrieve the translation resource file package corresponding to the target system language according to the target system language corresponding to the target system when receiving the system language switching instruction of the target system; wherein the target system is an operating system or an application software system;

[0076] A determination module 320 is used to determine, for at least one object to be switched in the target system, a target translation resource file and a target rendering function corresponding to the current object to be switched from the translation resource file package;

[0077] The system language switching module 330 is used to render the target translation resource file based on the target rendering function to switch the system language of the current object to be switched to the target system language.

[0078] The technical solution of the embodiment of the present invention is to call the translation resource file package corresponding to the target system language according to the target system language corresponding to the target system when receiving the system language switching instruction of the target system; determine the target translation resource file and target rendering function corresponding to the current object to be switched from the translation resource file package for at least one object to be switched in the target system; render the target translation resource file based on the target rendering function to switch the system language of the current object to be switched to the target system language. In this technical solution, by presetting a translation resource file package corresponding to at least one system language, and determining the target system language corresponding to the target system according to the target system language in the instruction when receiving the system language switching instruction, the translation resource file package corresponding to the target system language is determined from the pre-set multiple translation resource file packages. Among them, the translation resource file package includes the target translation resource files corresponding to all the objects to be switched in the target system. Further, the target system is switched from the currently used system language to the target system language by calling the target rendering function for language switching of the target translation resource file. In this process, when the system language of the target system is switched, the target translation resource files corresponding to each object to be switched in the target system can be determined based on the translation resource files corresponding to the target system language. Therefore, when the system language is switched, the language switching rendering can be directly performed, and there is no need to translate the system language for each object to be switched. The problem of a large amount of repetitive work, difficulty in ensuring the consistency and integrity of the system language switching, and low switching efficiency when switching the system language of the target system in the prior art is solved. The system language of the object to be switched in the system is automatically switched to the target system language, and the switching efficiency of the system language is improved under the premise of ensuring the accuracy of the system language switching results of all objects to be switched.

[0079] Optionally, the system language switching device further includes: a convertible system language determination module, which is used to determine at least one convertible system language corresponding to the current object to be translated for at least one object to be translated in the target system before calling the translation resource file corresponding to the target system language according to the target system language corresponding to the target system;

[0080] A resource file determination module, for determining, for each convertible system language, a binary translation resource file corresponding to the current convertible system language;

[0081] The translation resource file package construction module is used to construct a translation resource file package based on at least one binary translation resource file associated with each to-be-translated object of the target system.

[0082] Optionally, the file package calling module includes: a target system language determining unit, used to parse the system language switching instruction to obtain a target system language corresponding to the target system;

[0083] The file package determination unit is used to determine a translation resource file package corresponding to the target system language from at least one resource file package to be selected based on a pre-constructed target mapping table; wherein the target mapping table includes at least one system language, each system language is associated with a corresponding translation resource file package, and each translation file package is a collection of translation resource files of all objects to be translated in the target system under the corresponding system language.

[0084] Optionally, the determination module includes: determining a target translation resource file corresponding to the current object to be switched based on a mapping relationship between the object to be switched and the translation resource file in a pre-built object language switching table;

[0085] Determine the target callback function corresponding to the current object to be switched according to the pre-built callback function linked list;

[0086] At least one rendering function associated with the target callback function is determined as the target rendering function corresponding to the current object to be switched.

[0087] Optionally, the system language switching module includes: a function determination unit, configured to trigger at least one target rendering function associated with the current object to be switched;

[0088] The system language switching unit is used to translate the system language of the current object to be switched based on the target translation resource file when each target rendering function receives the target translation resource file.

[0089] The system language switching device provided in the embodiment of the present invention can execute the system language switching method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0090] Embodiment 4

[0091] Figure 5A schematic diagram of the structure of an electronic device 10 of an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0092] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0093] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0094] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a method for switching the system language.

[0095] In some embodiments, the system language switching method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the system language switching method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the system language switching method in any other appropriate manner (e.g., by means of firmware).

[0096] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0097] The computer program for implementing the system language switching method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0098] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0099] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0100] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0101] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0102] Embodiment 5

[0103] An embodiment of the present invention further provides a computer program product, including a computer program, which, when executed by a processor, implements the system language switching method provided in any embodiment of the present application.

[0104] In the process of implementation, the computer program product can be written in one or more programming languages ​​or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0105] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0106] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for switching a system language, characterized in that: include: When receiving a system language switching instruction of a target system, calling a translation resource file package corresponding to the target system language according to the target system language corresponding to the target system; wherein the target system is an operating system or an application software system; For at least one object to be switched in the target system, determining a target translation resource file and a target rendering function corresponding to the current object to be switched from the translation resource file package; The target translation resource file is rendered based on the target rendering function to switch the system language of the current object to be switched to the target system language.

2. The method according to claim 1, characterized in that Before calling the translation resource file corresponding to the target system language according to the target system language corresponding to the target system, the method further includes: For at least one object to be translated in the target system, determining at least one convertible system language corresponding to the current object to be translated; For each convertible system language, determining a binary translation resource file corresponding to the current convertible system language; A translation resource file package is constructed based on at least one binary translation resource file associated with each to-be-translated object of the target system.

3. The method according to claim 1, characterized in that The step of retrieving the translation resource file corresponding to the target system language according to the target system language corresponding to the target system includes: Parsing the system language switching instruction to obtain a target system language corresponding to the target system; Based on a pre-constructed target mapping table, a translation resource file package corresponding to the target system language is determined from at least one resource file package to be selected; wherein the target mapping table includes at least one system language, each system language is associated with a corresponding translation resource file package, and each translation file package is a collection of translation resource files of all objects to be translated in the target system under the corresponding system language.

4. The method according to claim 1, characterized in that: The step of determining the target translation resource file and the target rendering function corresponding to the current object to be switched from the translation resource file package includes: Determine the target translation resource file corresponding to the current object to be switched based on the mapping relationship between the object to be switched and the translation resource file in the pre-built object language switching table; Determine the target callback function corresponding to the current object to be switched according to the pre-built callback function linked list; At least one rendering function associated with the target callback function is determined as the target rendering function corresponding to the current object to be switched.

5. The method according to claim 1, characterized in that The rendering process of the target translation resource file based on the target rendering function to switch the system language of the current object to be switched to the target system language includes: Triggering at least one target rendering function associated with the current object to be switched; When each target rendering function receives the target translation resource file, the system language of the current object to be switched is translated based on the target translation resource file by each target rendering function.

6. A system language switching device, characterized in that: include: A file package retrieval module, configured to retrieve a translation resource file package corresponding to the target system language according to the target system language corresponding to the target system when receiving a system language switching instruction of the target system; wherein the target system is an operating system or an application software system; A determination module, configured to determine, for at least one object to be switched in the target system, a target translation resource file and a target rendering function corresponding to the current object to be switched from the translation resource file package; The system language switching module is used to render the target translation resource file based on the target rendering function to switch the system language of the current object to be switched to the target system language.

7. The device according to claim 6, characterized in that Also includes: a convertible system language determination module, configured to determine, for at least one object to be translated in the target system, at least one convertible system language corresponding to the current object to be translated before calling the translation resource file corresponding to the target system language according to the target system language corresponding to the target system; A resource file determination module, for determining, for each convertible system language, a binary translation resource file corresponding to the current convertible system language; The translation resource file package construction module is used to construct a translation resource file package based on at least one binary translation resource file associated with each to-be-translated object of the target system.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the system language switching method according to any one of claims 1 to 5.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the system language switching method according to any one of claims 1 to 5 when executed.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the system language switching method according to any one of claims 1 to 5.