Software interface language switching processing method, device and storage medium
By classifying software interface controls and adopting different update strategies, the problems of accuracy and low efficiency in language switching processing in the prior art are solved, and more efficient and accurate language switching processing is achieved.
Patent Information
- Application Number
- CN202411929914.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-12-25
AI Technical Summary
The existing technology has problems in the translation of multiple words, the completeness of dynamic control translation, and the precise matching of control text lists in the software interface language switching process, resulting in reduced accuracy and reliability of language switching results, increased time consumption and low efficiency of the switching process.
By classifying the controls and adopting the system translation method or the variable object list update strategy, we can ensure that different types of controls are accurately translated, and perform targeted updates on custom and non-custom controls to generate the post-switching interface.
Improved the translation accuracy and reliability of the overall interface, reduced memory usage, and improved the processing speed and efficiency of language switching.
Smart Images

Figure CN119883466B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, and storage medium for language switching processing in a software interface. Background Art
[0002] With the increasing complexity of software technology, language switching processing has become an important requirement. Developers usually use different language environments to develop corresponding interfaces and prepare interface resource files in multiple languages. Due to the complexity of the interface of large-scale equipment software, the large number of controls and the inclusion of a large number of custom controls, the development workload is too heavy and the development cycle is long. Secondly, the date and time formats in different language environments are inconsistent, which affects the data processing and storage process within the program. Therefore, developing a more efficient language switching processing method for software interfaces has become a promising direction.
[0003] In the prior art, there are two main methods for language switching in software interfaces: one is to use the current text as a key to update the translation, and the other is to traverse all controls when the software is started and obtain the translation results through a unique ID or <window name, control name> identifier;
[0004] However, existing technical methods have shortcomings in the translation of multiple words, the completeness of dynamic control translation, and the precise matching of control text lists, and the memory usage is too high. These problems together lead to reduced accuracy and reliability of language switching results, increased time consumption of the switching process, and technical problems such as low efficiency and poor accuracy of language switching processing. Summary of the Invention
[0005] The present application provides a method, device, and storage medium for processing language switching in a software interface, so as to achieve the effect of improving the efficiency and accuracy of language switching processing.
[0006] In a first aspect, the present application provides a method for processing language switching of a software interface, comprising:
[0007] Get the interface to be processed and traverse it to get all the corresponding windows and controls;
[0008] Classify all controls to obtain custom controls and / or non-custom controls;
[0009] If all controls include non-custom controls, the vocabulary dictionary and the record dictionary are called, and the system translation method is used to update the non-custom controls to obtain a first updated control, wherein the vocabulary dictionary is a preconfigured dictionary, the record dictionary is used to record historical data of the translation process, the system translation method is a preset universal translation method, and the first updated control is the control after the language switching control is updated for the non-custom controls according to the system translation method;
[0010] If all controls include custom controls, determine whether the custom controls are bound to variables;
[0011] If so, the variable object list is called to update the custom control to obtain a second updated control, wherein the variable object list is a preconfigured list, and the second updated control is a control after the custom control is updated with a language switching control according to the variable object list;
[0012] If not, calling the vocabulary dictionary and the record dictionary, using the system translation method to update the custom control, and obtaining a third updated control, wherein the third updated control is a control after the custom control is updated by the language switching control according to the system translation method;
[0013] A post-switching interface is generated according to the first update control, the second update control, and the third update control.
[0014] In a possible implementation, the variable object list includes multiple multilingual description texts corresponding to multiple variables;
[0015] Accordingly, the variable object list is called to update the custom control to obtain the second updated control, including:
[0016] Determine the variables corresponding to the custom controls;
[0017] According to the variables corresponding to the custom controls, determine the multilingual description text corresponding to the variables;
[0018] According to the multilingual description text corresponding to the variable, the custom control is updated with a language switching control to obtain a second updated control.
[0019] In one possible implementation, the keys of the vocabulary dictionary are Chinese texts, and the values of the vocabulary dictionary are multilingual data objects;
[0020] The key of the record dictionary is the control handle, and the value of the record dictionary is the Chinese text list of the control.
[0021] In one possible implementation, the system translation method includes:
[0022] Pass in the control handle and the current text of the control, and check whether the key of the record dictionary includes the control handle;
[0023] If the key of the record dictionary does not include the control handle, initialize the key-value pair and add the initialized key-value pair to the record dictionary;
[0024] The vocabulary dictionary is searched according to the Chinese text corresponding to the current text of the control to update the language switching control.
[0025] In a possible implementation, the method for processing language switching of a software interface further includes:
[0026] If the key of the record dictionary includes the control handle, then obtain the Chinese text list of the control corresponding to the control handle in the record dictionary;
[0027] According to the Chinese text list of the control corresponding to the control handle, the language switching control is updated.
[0028] In a possible implementation, updating the language switching control according to the Chinese text list of the control corresponding to the control handle includes:
[0029] Determine whether the current text of the control is Chinese;
[0030] If the current text of the control is in Chinese, the vocabulary dictionary is searched according to the Chinese text corresponding to the current text of the control to implement the language switching control update;
[0031] If the current text of the control is not Chinese, the multilingual data objects in the record dictionary are traversed and matched with the multilingual data object corresponding to the current text of the control to implement the language switching control update.
[0032] In a possible implementation, before obtaining the interface to be processed, the method further includes:
[0033] Extract Chinese text from all interfaces and obtain the foreign text corresponding to the Chinese text;
[0034] Build a vocabulary dictionary and a list of variable objects based on Chinese text and foreign text.
[0035] In a second aspect, the present application provides a language switching processing device for a software interface, comprising:
[0036] The first processing module is used to obtain the interface to be processed and perform traversal processing to obtain all corresponding windows and all controls;
[0037] The second processing module is used to classify all controls to obtain custom controls and / or non-custom controls;
[0038] A first update module is configured to, if all controls include non-custom controls, call a vocabulary dictionary and a record dictionary, and use a system translation method to update the non-custom controls to obtain a first updated control, wherein the vocabulary dictionary is a preconfigured dictionary, the record dictionary is used to record historical data of the translation process, the system translation method is a preset universal translation method, and the first updated control is a control after the language switching control of the non-custom controls is updated according to the system translation method;
[0039] A judgment module is used to judge whether a custom control is bound to a variable if all controls include the custom control;
[0040] A second update module is configured to call a variable object list to update the custom control and obtain a second updated control if the custom control is bound to a variable, wherein the variable object list is a preconfigured list and the second updated control is a control after the custom control is updated with a language switching control according to the variable object list;
[0041] A third updating module is configured to call a vocabulary dictionary and a record dictionary if the custom control is not bound to a variable, and update the custom control using a system translation method to obtain a third updated control, wherein the third updated control is a control obtained by performing a language switching control update on the custom control according to the system translation method;
[0042] The generating module is used to generate a post-switching interface according to the first updating control, the second updating control and the third updating control.
[0043] In a possible implementation, the variable object list includes multiple multilingual description texts corresponding to multiple variables;
[0044] Accordingly, the second update module is further configured to:
[0045] Determine the variables corresponding to the custom controls;
[0046] According to the variables corresponding to the custom controls, determine the multilingual description text corresponding to the variables;
[0047] According to the multilingual description text corresponding to the variable, the custom control is updated with a language switching control to obtain a second updated control.
[0048] In a possible implementation, the first update module is further configured to:
[0049] The key of the vocabulary dictionary is Chinese text, and the value of the vocabulary dictionary is a multilingual data object;
[0050] The key of the record dictionary is the control handle, and the value of the record dictionary is the Chinese text list of the control.
[0051] In a possible implementation, the second update module is further configured to:
[0052] Pass in the control handle and the current text of the control, and check whether the key of the record dictionary includes the control handle;
[0053] If the key of the record dictionary does not include the control handle, initialize the key-value pair and add the initialized key-value pair to the record dictionary;
[0054] The vocabulary dictionary is searched according to the Chinese text corresponding to the current text of the control to update the language switching control.
[0055] In a possible implementation, the second update module is further configured to:
[0056] If the key of the record dictionary includes the control handle, then obtain the Chinese text list of the control corresponding to the control handle in the record dictionary;
[0057] According to the Chinese text list of the control corresponding to the control handle, the language switching control is updated.
[0058] In a possible implementation, the second update module is further configured to:
[0059] Determine whether the current text of the control is Chinese;
[0060] If the current text of the control is in Chinese, the vocabulary dictionary is searched according to the Chinese text corresponding to the current text of the control to implement the language switching control update;
[0061] If the current text of the control is not Chinese, the multilingual data objects in the record dictionary are traversed and matched with the multilingual data object corresponding to the current text of the control to implement the language switching control update.
[0062] In a possible implementation, the first processing module is further configured to:
[0063] Extract Chinese text from all interfaces and obtain the foreign text corresponding to the Chinese text;
[0064] Build a vocabulary dictionary and a list of variable objects based on Chinese text and foreign text.
[0065] In a third aspect, the present application provides a software interface language switching processing device, comprising: a memory, a processor;
[0066] The memory stores computer-executable instructions;
[0067] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.
[0068] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the above first aspect and / or various possible implementations of the first aspect.
[0069] In a fifth aspect, the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementations of the first aspect.
[0070] The present application provides a method, device and storage medium for language switching processing of a software interface. The method obtains the interface to be processed and performs traversal processing to obtain all corresponding windows and all controls; classifies all controls to obtain custom controls and / or non-custom controls; if all controls include non-custom controls, calls a vocabulary dictionary and a record dictionary, adopts a system translation method to update the non-custom controls and obtain a first updated control; if all controls include custom controls, determines whether the custom controls are bound to variables; if so, calls a variable object list, updates the custom controls and obtains a second updated control; if not, calls a vocabulary dictionary and a record dictionary, adopts a system translation method , update the custom control to obtain the third updated control; generate the post-switching interface according to the first updated control, the second updated control and the third updated control. Thus, on the one hand, by classifying the controls and adopting different update strategies (system translation or variable object list update), it ensures that different types of controls can be translated more accurately, thereby improving the translation accuracy and reliability of the overall interface. On the other hand, by classifying the controls and processing the custom controls and non-custom controls in a targeted manner, the flexibility of language switching is improved while reducing the memory usage, so that the processing speed of language switching is greatly improved, thereby achieving the effect of improving the processing efficiency and accuracy of language switching. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0072] Figure 1 A schematic diagram of an application data processing system architecture provided in an embodiment of the present application;
[0073] Figure 2 Schematic diagram of the process of language switching processing method of the software interface provided in the embodiment of the present application Figure 1 ;
[0074] Figure 3 A schematic diagram of the value pair structure of the vocabulary dictionary and record dictionary provided in an embodiment of the present application;
[0075] Figure 4 Schematic diagram of the process of language switching processing method of the software interface provided in the embodiment of the present application Figure 2 ;
[0076] Figure 5 Schematic diagram of the process of language switching processing method of the software interface provided in the embodiment of the present application Figure 3 ;
[0077] Figure 6 Schematic diagram of the process of language switching processing method of the software interface provided in the embodiment of the present application Figure 4 ;
[0078] Figure 7 A schematic diagram of the structure of a language switching processing device for a software interface provided in an embodiment of the present application;
[0079] Figure 8 A schematic diagram of the structure of a language switching processing device for a software interface provided in an embodiment of the present application.
[0080] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0081] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0082] Since existing technical methods have shortcomings in the translation of multiple words, the completeness of dynamic control translation, and the precise matching of control text lists, and the memory usage is too high, these problems together lead to reduced accuracy and reliability of language switching results, increased time consumption of the switching process, and technical problems such as low efficiency and poor accuracy of language switching processing.
[0083] In response to the above problems, the embodiments of the present application provide a language switching processing method, device and storage medium for a software interface. On the one hand, by classifying the controls and adopting different update strategies, namely, system translation method or variable object list update, it ensures that different types of controls can be translated more accurately, thereby improving the translation accuracy and reliability of the overall interface. On the other hand, by classifying the controls and processing custom controls and non-custom controls in a targeted manner, while improving the flexibility of language switching, it reduces the memory occupancy rate so that the processing speed of language switching is greatly improved, thereby achieving the effect of improving the efficiency and accuracy of language switching processing.
[0084] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0085] Figure 1 This is a schematic diagram of an application data processing system architecture provided in an embodiment of the present application. The application data processing system is a computer device. Figure 1 As shown, the above architecture includes at least one of a data acquisition device 101 , a processing device 102 and a display device 103 .
[0086] It is understood that the structure illustrated in the embodiments of this application does not constitute a specific limitation on the architecture of the application data processing system. In other feasible implementations of this application, the above architecture may include more or fewer components than shown, or combine or split certain components, or arrange the components differently. The specific configuration can be determined based on the actual application scenario and is not limited here. Figure 1 The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0087] In a specific implementation process, the data acquisition device 101 may include an input / output interface and may also include a communication interface. The data acquisition device 101 may be connected to the processing device via the input / output interface or the communication interface.
[0088] The processing device 102 can obtain the interface to be processed and traverse it to obtain all corresponding windows and all controls; classify all controls to obtain custom controls and / or non-custom controls; if all controls include non-custom controls, call the vocabulary dictionary and record dictionary, use the system translation method to update the non-custom controls, and obtain a first updated control; if all controls include custom controls, determine whether the custom controls are bound to variables; if so, call the variable object list, update the custom controls, and obtain a second updated control; if not, call the vocabulary dictionary and record dictionary, use the system translation method to update the custom controls, and obtain a third updated control; generate a switched interface based on the first updated control, the second updated control, and the third updated control.
[0089] The display device 103 may also be a touch screen display or a screen of a terminal device, which is used to receive user instructions while displaying the above content to achieve interaction with the user.
[0090] It should be understood that the above-mentioned processing device can be implemented by a processor reading instructions in a memory and executing the instructions, or it can be implemented by a chip circuit.
[0091] In addition, the network architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0092] Figure 2 Schematic diagram of the process of language switching processing method of the software interface provided in the embodiment of the present application Figure 1 ,like Figure 2 As shown, the language switching processing method of the software interface provided in this embodiment includes:
[0093] S201, obtain the interface to be processed and perform traversal processing to obtain all corresponding windows and all controls;
[0094] Determine the interface that needs to be language switched, traverse the interface, and obtain all forms and all controls in the interface.
[0095] S202: Classify all controls to obtain custom controls and / or non-custom controls;
[0096] In this embodiment, the non-customized control refers to the system control.
[0097] According to the types of all the acquired controls, all the controls are classified to acquire custom controls and / or non-custom controls.
[0098] S203: If all controls include non-custom controls, call the vocabulary dictionary and the record dictionary, use the system translation method to update the non-custom controls, and obtain a first updated control;
[0099] In this embodiment, the vocabulary dictionary is a preconfigured dictionary, the recording dictionary is used to record historical data of the translation process, its initial state is an empty dictionary, the system translation method is a preset universal translation method, and the first update control is a control after the language switching control of the non-customized control is updated according to the system translation method.
[0100] When it is determined that all controls include non-custom controls, the vocabulary dictionary and record dictionary are called, and the language switching control of the non-custom controls is updated using the preconfigured vocabulary dictionary and record dictionary according to the preconfigured system translation method to obtain the updated first updated control.
[0101] Optionally, Figure 3 A schematic diagram of the value pair structure of the vocabulary dictionary and record dictionary provided in the embodiment of the present application, such as Figure 3 As shown in the figure, the key of the vocabulary dictionary is Chinese text, and the value of the vocabulary dictionary is a multilingual data object; the key of the record dictionary is the control handle, and the value of the record dictionary is the Chinese text list of the control. The vocabulary dictionary is used to retrieve translation results with Chinese text during translation, and the record dictionary is used to solve the translation problems of multiple words, dynamically added controls, and multi-text controls.
[0102] S204: If all controls include a custom control, determine whether the custom control is bound to a variable;
[0103] When determining whether custom controls are included in all controls, you need to first determine whether the custom controls are bound to variables.
[0104] S205: If yes, call the variable object list, update the custom control, and obtain a second updated control;
[0105] In this embodiment, the variable object list is a preconfigured list, which includes multiple multilingual description texts corresponding to multiple variables. The second update control is a control that updates the custom control with a language switch control based on the variable object list.
[0106] If the custom control is bound to a variable, you need to call the pre-configured variable object list to determine the multilingual description text corresponding to the variable, and use the multilingual description text recorded in the variable object list to update the language switch control of the custom control to obtain the updated second update control.
[0107] S206: If not, call the vocabulary dictionary and the record dictionary, use the system translation method to update the custom control, and obtain a third updated control;
[0108] In this embodiment, the third updated control is a control obtained by updating the language switching control of the custom control according to the system translation method.
[0109] If the custom control is not bound to a variable, the preconfigured vocabulary dictionary and record dictionary are called, and the language switching control of the custom control is updated using the preconfigured vocabulary dictionary and record dictionary according to the preconfigured system translation method to obtain an updated third update control.
[0110] S207: Generate a post-switching interface according to the first update control, the second update control, and the third update control.
[0111] According to the first update control, the second update control and the third update control, the language of the pop-up window title text, the message text and the button text in the interface to be processed is switched to generate a switched interface.
[0112] It should be noted that after the switched interface is generated, the first update control, the second update control, and the third update control may update the interface according to actual conditions.
[0113] The language switching processing method of the software interface provided by the embodiment of the present application obtains the interface to be processed and traverses it to obtain all corresponding windows and all controls; classifies all controls to obtain custom controls and / or non-custom controls; if all controls include non-custom controls, calls the vocabulary dictionary and the record dictionary, adopts the system translation method to update the non-custom controls and obtains the first updated control; if all controls include custom controls, determines whether the custom controls are bound to variables; if so, calls the variable object list, updates the custom controls and obtains the second updated control; if not, calls the vocabulary dictionary and the record dictionary, adopts the system translation method to update the custom controls Define the control and obtain the third update control; generate the post-switching interface based on the first update control, the second update control and the third update control. On the one hand, by classifying the controls and adopting different update strategies, namely system translation or variable object list update, it is ensured that different types of controls can be translated more accurately, thereby improving the translation accuracy and reliability of the overall interface. On the other hand, by classifying the controls and processing custom controls and non-custom controls in a targeted manner, the flexibility of language switching is improved while reducing the memory usage, so that the processing speed of language switching is greatly improved, thereby achieving the effect of improving the efficiency and accuracy of language switching processing.
[0114] Figure 4 Schematic diagram of the process of language switching processing method of the software interface provided in the embodiment of the present application Figure 2 ,like Figure 4 As shown, this embodiment, based on the above embodiment, describes in detail the process of obtaining the second update control, and the method includes:
[0115] S401, determining the variable corresponding to the custom control;
[0116] After determining that the custom control is bound to a variable, further determine the specific variable corresponding to the custom control.
[0117] S402: Determine, based on the variables corresponding to the custom controls, the multilingual description text corresponding to the variables;
[0118] According to the variables corresponding to the custom control, the redundant description text corresponding to the above variables is determined in the pre-configured variable object list.
[0119] S403: Update the language switching control of the custom control according to the multilingual description text corresponding to the variable to obtain a second updated control.
[0120] According to the redundant description text corresponding to the above variable, the language switching and updating of the above custom control are performed, and the updated second update control is obtained.
[0121] The language switching processing method for the software interface provided in the embodiment of the present application obtains the multilingual description text corresponding to the variable in a pre-configured variable object list based on the binding relationship between the custom control and the variable, and updates the language switching control of the custom control in a targeted manner based on the multilingual description text to obtain a second updated control, thereby improving the accuracy of language switching, effectively reducing the processing time of language switching, and achieving the effect of improving the efficiency and accuracy of language switching processing.
[0122] Figure 5 Schematic diagram of the process of language switching processing method of the software interface provided in the embodiment of the present application Figure 3 ,like Figure 5 As shown, this embodiment, based on the above embodiment, provides a detailed description of the system translation method, including:
[0123] S501: Input the control handle and the current text of the control, and determine whether the key of the record dictionary includes the control handle;
[0124] Pass in the control handle and the current text of the control, and check whether the key of the record dictionary contains the passed in control handle.
[0125] S502: If the key of the record dictionary does not include the control handle, initialize the key-value pair and add the initialized key-value pair to the record dictionary;
[0126] If the control handle is not included in the record dictionary key, a list is constructed whose initial value is only the current incoming text, with the control handle as the key and the list as the value, and the new key-value pair is added to the record dictionary.
[0127] S503, searching the vocabulary dictionary according to the Chinese text corresponding to the current text of the control to update the language switching control;
[0128] The language switching control for the above control is updated by searching the vocabulary dictionary based on the Chinese text corresponding to the current text of the control.
[0129] It should be noted that since the default interface is Chinese when the software is initialized, when the control calls the translation method for the first time, its current displayed text must be Chinese, so the text passed in must be Chinese. Therefore, you can directly search the vocabulary dictionary based on the passed in text to obtain the text translation.
[0130] S504: If the key of the record dictionary includes a control handle, obtain a control Chinese text list corresponding to the control handle in the record dictionary;
[0131] If the key of the record dictionary contains the control handle, it can be determined that the control has performed a translation operation. Then, the corresponding Chinese text list is retrieved from the record dictionary using the handle as the key.
[0132] S505, determining whether the current text of the control is in Chinese;
[0133] Determines whether the current text of the passed-in control is Chinese.
[0134] S506: If the current text of the control is in Chinese, search the vocabulary dictionary based on the Chinese text corresponding to the current text of the control to implement language switching control update;
[0135] If the current text of the passed-in control is in Chinese, the vocabulary dictionary is searched according to the Chinese text corresponding to the current text of the passed-in control to obtain the text translation, so as to implement the language switching control update of the passed-in control.
[0136] S507: If the current text of the control is not Chinese, traverse the multilingual data objects in the record dictionary and match the multilingual data object corresponding to the current text of the control to implement language switching control update.
[0137] If the current text of the control passed in is in a foreign language, the Chinese text list is traversed. This list records the Chinese texts of all previous translation requests for the current control. For each Chinese text, its corresponding multilingual data object in the vocabulary dictionary is obtained. It is determined whether the current text is consistent with any foreign text in the multilingual data object. After matching the corresponding multilingual data object, the corresponding translation result in the multilingual data object is returned according to the target language, thereby implementing the language switching control update of the current control.
[0138] The language switching processing method for the software interface provided in the embodiment of the present application judges and records the translation status of the control according to a preset execution method by passing in a control handle and the current text. Whether the control is being translated for the first time or has been translated, the vocabulary dictionary can be retrieved for language switching, thereby improving the reliability and accuracy of the language switching. At the same time, different update strategies are adopted for Chinese and non-Chinese texts, thereby improving the flexibility and speed of the language switching processing, ensuring the comprehensiveness of the language switching processing, and achieving the effect of improving the efficiency and accuracy of the language switching processing.
[0139] Figure 6 Schematic diagram of the process of language switching processing method of the software interface provided in the embodiment of the present application Figure 4 ,like Figure 6 As shown, this embodiment, based on the above embodiment, provides a supplementary explanation of the processing process of the interface to be processed, including:
[0140] S601, extracting Chinese texts from all interfaces and obtaining foreign texts corresponding to the Chinese texts;
[0141] Extract the Chinese texts of all interfaces from the software, and use translation software to obtain the foreign language texts corresponding to all Chinese texts.
[0142] S602, constructing a vocabulary dictionary, a record dictionary and a variable object list according to the Chinese text and the foreign text;
[0143] Based on all the obtained Chinese texts and their corresponding foreign texts, the corresponding vocabulary dictionary, record dictionary and variable object list are constructed.
[0144] S603: Obtain the interface to be processed and perform traversal processing to obtain all corresponding windows and all controls.
[0145] Determine the interface that needs to be language switched, traverse the interface, and obtain all forms and all controls in the interface.
[0146] The language switching processing method for the software interface provided in the embodiment of the present application provides the necessary data basis for subsequent language switching processing by extracting the Chinese text of all interfaces and obtaining the foreign text corresponding to the Chinese text, thereby ensuring the accuracy and completeness of the translated content. In addition, based on the extracted Chinese text and foreign text, a vocabulary dictionary, a record dictionary and a variable object list are constructed, providing an efficient data structure and support for the subsequent language switching processing, ensuring the speed and accuracy of the subsequent language switching processing, and reducing the overall memory occupancy rate. Finally, the interface to be processed is obtained and traversed to obtain all corresponding windows and all controls, so that the system can accurately identify and process each element in the software interface, providing the necessary information and basis for the subsequent language switching processing of each control, improving the accuracy and reliability of the subsequent language processing, and achieving the effect of improving the efficiency and accuracy of the language switching processing.
[0147] Figure 7 This is a schematic diagram of the structure of the language switching processing device for the software interface provided in the embodiment of the present application. The device of this embodiment can be in the form of software and / or hardware. Figure 7 As shown, the language switching processing device 700 of the software interface provided in the embodiment of the present application includes: a first processing module 701, a second processing module 702, a first updating module 703, a judgment module 704, a second updating module 705, a third updating module 706, and a generation module 707:
[0148] The first processing module 701 is used to obtain the interface to be processed and perform traversal processing to obtain all corresponding windows and all controls;
[0149] The second processing module 702 is used to classify all controls to obtain custom controls and / or non-custom controls;
[0150] A first updating module 703 is configured to, if all controls include non-custom controls, call a vocabulary dictionary and a record dictionary, and use a system translation method to update the non-custom controls to obtain a first updated control, wherein the vocabulary dictionary is a preconfigured dictionary, the record dictionary is used to record historical data of the translation process, the system translation method is a preset universal translation method, and the first updated control is a control after the non-custom controls are updated by switching the language according to the system translation method;
[0151] The judging module 704 is configured to judge whether the custom control is bound to a variable if all the controls include the custom control;
[0152] The second update module 705 is configured to call the variable object list if the custom control is bound to a variable, update the custom control, and obtain a second updated control, wherein the variable object list is a preconfigured list, and the second updated control is a control after the custom control is updated with a language switch control according to the variable object list;
[0153] A third updating module 706 is configured to call a vocabulary dictionary and a record dictionary if the custom control is not bound to a variable, and update the custom control using a system translation method to obtain a third updated control, wherein the third updated control is a control obtained by performing a language switch control update on the custom control using the system translation method;
[0154] The generating module 707 is configured to generate a post-switching interface according to the first updating control, the second updating control, and the third updating control.
[0155] In a possible implementation, the variable object list includes multiple multilingual description texts corresponding to multiple variables;
[0156] Accordingly, the second updating module 705 is further configured to:
[0157] Determine the variables corresponding to the custom controls;
[0158] According to the variables corresponding to the custom controls, determine the multilingual description text corresponding to the variables;
[0159] According to the multilingual description text corresponding to the variable, the custom control is updated with a language switching control to obtain a second updated control.
[0160] In a possible implementation, the first updating module 703 is further configured to:
[0161] The key of the vocabulary dictionary is Chinese text, and the value of the vocabulary dictionary is a multilingual data object;
[0162] The key of the record dictionary is the control handle, and the value of the record dictionary is the Chinese text list of the control.
[0163] In a possible implementation, the second update module is further configured to:
[0164] Pass in the control handle and the current text of the control, and check whether the key of the record dictionary includes the control handle;
[0165] If the key of the record dictionary does not include the control handle, initialize the key-value pair and add the initialized key-value pair to the record dictionary;
[0166] The vocabulary dictionary is searched according to the Chinese text corresponding to the current text of the control to update the language switching control.
[0167] In a possible implementation, the second updating module 705 is further configured to:
[0168] If the key of the record dictionary includes the control handle, then obtain the Chinese text list of the control corresponding to the control handle in the record dictionary;
[0169] According to the Chinese text list of the control corresponding to the control handle, the language switching control is updated.
[0170] In a possible implementation, the second updating module 705 is further configured to:
[0171] Determine whether the current text of the control is Chinese;
[0172] If the current text of the control is in Chinese, the vocabulary dictionary is searched according to the Chinese text corresponding to the current text of the control to implement the language switching control update;
[0173] If the current text of the control is not Chinese, the multilingual data objects in the record dictionary are traversed and matched with the multilingual data object corresponding to the current text of the control to implement the language switching control update.
[0174] In a possible implementation, the first processing module 701 is further configured to:
[0175] Extract Chinese text from all interfaces and obtain the foreign text corresponding to the Chinese text;
[0176] Build a vocabulary dictionary and a list of variable objects based on Chinese text and foreign text.
[0177] The language switching processing device for the software interface provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.
[0178] Figure 8 This is a schematic diagram of the structure of the language switching processing device for the software interface provided in the embodiment of the present application. Figure 8As shown, the electronic device 800 provided in this embodiment includes: at least one processor 801 and a memory 802. Optionally, the device 800 also includes a communication component 803. The processor 801, the memory 802 and the communication component 803 are connected via a bus.
[0179] During the specific implementation process, at least one processor 801 executes the computer-executable instructions stored in the memory 802, so that the at least one processor 801 performs the above method.
[0180] The specific implementation process of the processor 801 can be found in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here in this embodiment.
[0181] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASICs), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.
[0182] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage.
[0183] A bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.
[0184] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0185] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0186] The readable storage medium may be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0187] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0188] The division of units is merely a logical functional division; actual implementations may employ alternative divisions, such as combining or integrating multiple units or components into another system, or omitting or disabling certain features. Furthermore, any direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units, either through an interface, electrical, mechanical, or other means.
[0189] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0190] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0191] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the method of the present invention. The aforementioned storage medium includes various media that can store program code, such as USB flash drives, mobile hard drives, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.
[0192] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0193] Finally, it should be noted that those skilled in the art will readily identify other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art not disclosed herein. The present invention is not limited to the precise structure described above and illustrated in the accompanying drawings, and various modifications and variations may be made without departing from the scope thereof. The scope of the present invention is limited solely by the appended claims.
Claims
1. A method for language switching of a software interface, characterized in that: include: Get the interface to be processed and traverse it to get all the corresponding windows and controls; Classifying all the controls to obtain custom controls and / or non-custom controls; If the non-customized control is included in all the controls, a vocabulary dictionary and a record dictionary are called, and the non-customized control is updated using a system translation method to obtain a first updated control, wherein the vocabulary dictionary is a preconfigured dictionary, the record dictionary is used to record historical data of the translation process, the system translation method is a preset universal translation method, and the first updated control is a control after the language switching control of the non-customized control is updated according to the system translation method; If all the controls include a custom control, determining whether the custom control is bound to a variable; If so, calling the variable object list to update the custom control and obtain a second updated control, wherein the variable object list is a preconfigured list, and the second updated control is a control after the custom control is updated with a language switching control according to the variable object list; If not, calling the vocabulary dictionary and the record dictionary, using the system translation method, updating the custom control to obtain a third updated control, wherein the third updated control is a control obtained by updating the custom control by performing a language switching control update according to the system translation method; A post-switching interface is generated according to the first update control, the second update control, and the third update control.
2. The method according to claim 1, characterized in that The variable object list includes multiple multilingual description texts corresponding to multiple variables; Accordingly, calling the variable object list, updating the custom control, and obtaining a second updated control includes: Determine the variables corresponding to the custom controls; Determining, according to the variable corresponding to the custom control, a multilingual description text corresponding to the variable; According to the multilingual description text corresponding to the variable, the custom control is updated with a language switching control to obtain a second updated control.
3. The method according to claim 2, characterized in that The keys of the vocabulary dictionary are Chinese texts, and the values of the vocabulary dictionary are multilingual data objects; The key of the record dictionary is the control handle, and the value of the record dictionary is the control Chinese text list.
4. The method according to claim 3, characterized in that The system translation method includes: Pass in the control handle and the current text of the control, and determine whether the key of the record dictionary includes the control handle; If the control handle is not included in the key of the record dictionary, initializing the key-value pair and adding the initialized key-value pair to the record dictionary; The vocabulary dictionary is retrieved according to the Chinese text corresponding to the current text of the control to implement the language switching control update.
5. The method according to claim 4, characterized in that Also includes: If the key of the record dictionary includes the control handle, obtaining a control Chinese text list corresponding to the control handle in the record dictionary; According to the control Chinese text list corresponding to the control handle, the language switching control is updated.
6. The method according to claim 5, characterized in that The updating of the language switching control according to the control Chinese text list corresponding to the control handle includes: Determine whether the current text of the control is Chinese; If the current text of the control is in Chinese, searching the vocabulary dictionary according to the Chinese text corresponding to the current text of the control to update the language switching control; If the current text of the control is not Chinese, the multilingual data objects in the record dictionary are traversed and the multilingual data objects corresponding to the current text of the control are matched to implement the language switching control update.
7. The method according to any one of claims 1 to 5, characterized in that Before obtaining the interface to be processed, the method further includes: Extract the Chinese texts from all interfaces and obtain the foreign texts corresponding to the Chinese texts; The vocabulary dictionary and the variable object list are constructed according to the Chinese text and the foreign text.
8. A software interface language switching processing device, characterized in that: include: The first processing module is used to obtain the interface to be processed and perform traversal processing to obtain all corresponding windows and all controls; A second processing module is used to classify all the controls to obtain custom controls and / or non-custom controls; A first updating module is configured to, if the non-customized control is included in all the controls, call a vocabulary dictionary and a record dictionary, and adopt a system translation method to update the non-customized control to obtain a first updated control, wherein the vocabulary dictionary is a preconfigured dictionary, the record dictionary is used to record historical data of the translation process, the system translation method is a preset universal translation method, and the first updated control is a control after the language switching control of the non-customized control is updated according to the system translation method; a judgment module, configured to judge whether a custom control is bound to a variable if all the controls include the custom control; A second update module is configured to call a variable object list to update the custom control if the custom control is bound to a variable, thereby obtaining a second updated control, wherein the variable object list is a preconfigured list, and the second updated control is a control obtained by performing a language switching control update on the custom control according to the variable object list; a third updating module configured to, if the custom control is not bound to a variable, call the vocabulary dictionary and the record dictionary, and use the system translation method to update the custom control to obtain a third updated control, wherein the third updated control is a control obtained by performing a language switching control update on the custom control according to the system translation method; A generating module is used to generate a post-switching interface according to the first updating control, the second updating control and the third updating control.
9. A software interface language switching processing device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the language switching processing method for the software interface according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the language switching processing method for a software interface according to any one of claims 1 to 7.
11. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the language switching processing method for a software interface according to any one of claims 1 to 7 is implemented.