Multi-language processing method and device, electronic equipment and storage medium
By using language switching instructions and annotation information in multilingual processing, and using multilingual storage tables to find translation values, the problems of poor data redundancy and scalability in the prior art are solved, and efficient multilingual processing and language switching are achieved.
Patent Information
- Application Number
- CN202311501858.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-10
- Publication Date
- 2025-05-13
AI Technical Summary
The prior art has problems of data redundancy and large storage resource usage during multilingual processing, and poor data scalability, especially when new language types are needed to be added, data tables or databases need to be reconstructed.
By receiving language switching instructions, determining the language identity, and traversing the annotation information in the target program to encapsulate the translation object, using the pre-created multilingual storage table to find the target translation value, and performing language type conversion processing.
It reduces data redundancy and memory resource usage, improves data scalability, and achieves more efficient multilingual processing and language switching.
Smart Images

Figure CN119990153A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of computer processing technology, and in particular to a multi-language processing method, device, electronic device and storage medium. Background Art
[0002] In recent years, many application systems usually convert specific business into corresponding information under the corresponding language type in order to meet the application needs of users who use different languages. For example, the language type can be English, Chinese or other languages. In order to meet the needs of different language types, multiple data tables or multiple databases are usually established. In actual application, business information is converted according to the selected language type and the stored table or library.
[0003] When implementing the technical solution based on the above method, the inventor found the following problems:
[0004] If a business supports multiple language types, then each language type requires a data table or database; if multiple language types are stored in one data table, then each language type corresponds to one record; if multiple language types correspond to one record in one data table, then multiple language type fields are required to store them. Based on the above, it can be seen that the current methods will have data redundancy and large storage resource usage. Furthermore, when a new language type needs to be added, the data table or database corresponding to the language type needs to be rebuilt, resulting in poor data scalability. Summary of the invention
[0005] The present invention provides a multi-language processing method, device, electronic device and storage medium, which achieve the technical effect of improving data scalability while reducing data redundancy and memory resource occupation.
[0006] In a first aspect, an embodiment of the present invention provides a multi-language processing method, the method comprising:
[0007] Based on the received language switching instruction, determining the language identifier carried by the language switching instruction;
[0008] If the language identifier is inconsistent with the preset language identifier, traversing the annotation information in the target program to encapsulate at least one object to be translated based on the annotation information to obtain a target encapsulated object; wherein the annotation information includes the object to be translated that needs to be processed in multiple languages in the target business;
[0009] Based on the target encapsulated object and a pre-created multi-language storage table, a target translation value corresponding to the at least one object to be translated is determined; wherein the multi-language storage table includes an identifier of a translation object to be matched and a translation value to be used corresponding to the object to be translated in each language type, and the target translation value is one of the translation values to be used;
[0010] A language type conversion process is performed on the target service based on the target translation value.
[0011] Furthermore, the method further comprises:
[0012] Based on the triggering operation of the language switching control in the display interface, generating the language switching instruction;
[0013] Based on the selected language type, determining a language identifier carried in the language switching instruction;
[0014] Wherein, at least one function display area corresponding to the target service is displayed in the display interface, and the function display area is used to display each sub-service in the target service.
[0015] Furthermore, the method further comprises:
[0016] Acquire, based on a reflection mechanism, a marked object in the target program that is first preset annotation information;
[0017] Acquire at least one to-be-translated object of the second preset annotation information and / or the third preset annotation information based on the marked object;
[0018] The at least one object to be translated is encapsulated into a target structure type to obtain the target encapsulated object.
[0019] Furthermore, the method further comprises:
[0020] Based on the fourth preset annotation information in the annotation information, the operation type is determined; if the operation type is a query operation type, the corresponding data to be encapsulated is obtained to update the target encapsulation object.
[0021] Furthermore, the method further comprises:
[0022] Obtaining translation object identifiers corresponding to each to-be-translated object in the target encapsulated object;
[0023] Searching the multi-language storage table for a translation object identifier to be matched corresponding to the translation object identifier;
[0024] Retrieving a target translation value corresponding to the identifier of the object to be translated in the target language type;
[0025] The target language type is encapsulated in the target encapsulation object.
[0026] Furthermore, the method further comprises:
[0027] Retrieve the target program corresponding to the target business;
[0028] marking first preset annotation information for at least one object to be translated in the target program, so as to determine that multi-language processing is required based on the first preset annotation information;
[0029] marking the at least one object to be translated with second preset annotation information;
[0030] Marking the at least one object to be translated with third preset annotation information; wherein the third preset annotation information corresponds to the identifier of the object to be matched in the multi-language storage table;
[0031] marking the at least one object to be translated with fourth preset annotation information, wherein the fourth preset annotation information corresponds to an operation type;
[0032] The multi-language storage table is determined based on the first preset annotation information, the second preset annotation information, the third preset annotation information and the fourth preset annotation information, and the corresponding translation values to be used under the corresponding language types.
[0033] Furthermore, the method further comprises:
[0034] Determine the identification of the translation object to be matched in the multi-language storage table based on the first preset annotation information, the second preset annotation information, the third preset annotation information, the fourth preset annotation information and the language type identification corresponding to each language type;
[0035] The multi-language storage table is determined based on the to-be-matched translation object identifier and the corresponding to-be-used translation value.
[0036] In a second aspect, an embodiment of the present invention further provides a multi-language processing device, the device comprising:
[0037] A language identification determination module, configured to determine the language identification carried by the language switching instruction based on the received language switching instruction;
[0038] A target encapsulated object determination module, for traversing the annotation information in the target program if the language identifier is inconsistent with the preset language identifier, so as to encapsulate at least one object to be translated based on the annotation information to obtain a target encapsulated object; wherein the annotation information includes objects to be translated that need to be processed in multiple languages in the target business;
[0039] a target translation value determination module, configured to determine a target translation value corresponding to the at least one object to be translated based on the target encapsulated object and a pre-created multi-language storage table; wherein the multi-language storage table includes a to-be-matched translation object identifier and a to-be-used translation value corresponding to the to-be-translated object in each language type, and the target translation value is one of the to-be-used translation values;
[0040] The conversion processing module is used to perform language type conversion processing on the target service based on the target translation value.
[0041] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0042] one or more processors;
[0043] a storage device for storing one or more programs,
[0044] When one or more programs are executed by one or more processors, the one or more processors implement a multi-language processing method as described in any one of the embodiments of the present invention.
[0045] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to perform a multi-language processing method as described in any one of the embodiments of the present invention.
[0046] The technical solution of the embodiment of the present invention determines the language identifier carried by the language switching instruction based on the received language switching instruction; if the language identifier is inconsistent with the preset language identifier, the annotation information in the target program is traversed to encapsulate at least one object to be translated based on the annotation information to obtain a target encapsulated object; based on the target encapsulated object and a pre-created multi-language storage table, a target translation value corresponding to at least one object to be translated is determined; based on the target translation value, a language type conversion process is performed on the target business. The technical solution of the embodiment of the present invention solves the problem of data redundancy and poor data scalability caused by pre-building multiple data tables or databases based on different language types for multi-language processing in the prior art, and realizes the determination of whether the language identifier carried by the language switching instruction is inconsistent with the preset language identifier, and whether language switching is required, thereby improving the accuracy of language switching. If so, the annotation information in the target program is traversed, and only the object to be translated marked in the annotation information needs to be determined for encapsulation to obtain the target encapsulated object. Furthermore, before implementing multi-language processing, a multi-language storage table is pre-configured, and the target translation value corresponding to at least one object to be translated is found from the multi-language storage table through the encapsulated target encapsulation object, thereby improving the efficiency of data search, reducing data storage redundancy, and reducing resource usage. When the target business is converted to a language type based on the target translation value, only the object to be translated needs to be translated, and there is no need to perform multi-language processing on all fields in the target business, thereby improving the efficiency of multi-language processing. At the same time, when there is a need to add a certain language type, it is only necessary to update the records of the multi-language storage table, or update some field annotations of the target program, thereby achieving the technical effect of improving data scalability. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following briefly introduces the drawings required to describe the embodiments. Obviously, the drawings introduced are only drawings of a part of the embodiments to be described in the present invention, rather than all the drawings. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0048] Figure 1 A flowchart of a multi-language processing method provided by an embodiment of the present invention;
[0049] Figure 2 A schematic diagram of a multi-language processing method provided by an embodiment of the present invention;
[0050] Figure 3 A schematic diagram of a multi-language processing method provided by an embodiment of the present invention;
[0051] Figure 4A flowchart of a multi-language processing method provided by an embodiment of the present invention;
[0052] Figure 5 A flowchart of a multi-language processing method provided by an embodiment of the present invention;
[0053] Figure 6 A schematic diagram of the structure of a multi-language processing device provided by an embodiment of the present invention;
[0054] Figure 7 The present invention is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0056] Before introducing the technical solution, the application scenario can be described first. For example, when implementing in multiple languages, multiple data tables or databases are usually constructed based on different language types. This method has the problems of data storage redundancy and poor data scalability. In order to solve this problem, a multilingual storage table can be used to store some information, and the fields that need to be translated can be translated based on this information, thereby achieving the technical effect of reducing data storage redundancy, reducing resource usage and improving data scalability. Next, the technical solution provided by the embodiment of the present invention is introduced by specifically implementing a certain business.
[0057] Figure 1 This is a flow chart of a multi-language processing method provided in an embodiment of the present invention. This embodiment is applicable to multi-language processing situations. The method can be executed by a multi-language processing device. The device can be implemented in the form of software and / or hardware. The hardware can be an electronic device, such as a mobile terminal, a PC or a server.
[0058] like Figure 1 As shown, the method includes:
[0059] S110: Determine a language identifier carried by the language switching instruction based on the received language switching instruction.
[0060] The language switching instruction may refer to a program or code for instructing the execution of converting one language type into another language type. For example, the language type may be English, Chinese, or other language types, without limitation. The language identifier may be used to characterize the uniqueness of the language type. For example, the language identifier ch may be used to represent Chinese, and the language identifier en may be used to represent English.
[0061] In this embodiment, the user can submit a language switching request to the system using an input device according to his or her needs for switching the business language type. The system can intercept the request using an interceptor (such as Spring AOP aspect interceptor), that is, it is considered that a language switching instruction has been received; or when the language used by the server site used by the user is detected to be inconsistent with the language used by the site of the server where the business is deployed when processing the business in multiple languages, a language switching instruction for switching the language type of the business is generated. Furthermore, the language switching instruction can be parsed to obtain the language identifier carried on the language switching instruction, so as to determine which language type the business is to be switched to based on the language identifier.
[0062] It should be noted that in order to improve the user's language switching experience, corresponding language type selection controls can be developed and displayed based on the language types that each business can switch to, so that the user can determine the language type based on the displayed language type to generate the corresponding language switching instructions.
[0063] In this embodiment, based on the received language switching instruction, the language identifier carried by the language switching instruction is determined, including: generating a language switching instruction based on a triggering operation of a language switching control in a display interface; and determining the language identifier carried in the language switching instruction based on the selected language type.
[0064] Among them, at least one function display area corresponding to the target business is displayed in the display interface, and the function display area is used to display each sub-business in the target business. The target business may refer to a transaction that performs or processes a certain function, such as a training business, an education business, a recommendation business, a transportation business, etc., and its display form may be a page, a video or an article, etc. The sub-business may refer to a business after the target business is subdivided. For example, for a transportation business, it may include a registration sub-business, a learning sub-business, a management sub-business, a service sub-business, etc. Different content can be displayed in each sub-business area, for example, it can be text, a picture, a video, a link, etc. The language switching control can be a touchable component for requesting a language switch. The trigger operation can be one of clicking, touching, sliding or dragging. The language type can be understood as a language version, such as a Chinese version, an English version, a Cantonese version, a Japanese version, a Korean version, etc. It should be noted that the language switching control can be set in any area in the display interface, and can be displayed in any form, and the embodiment of the present disclosure does not specifically limit this.
[0065] Specifically, a control for requesting language type conversion can be developed in advance and deployed in the display interface. If it is detected that the user triggers the language switching function corresponding to the control by clicking the control or entering the shortcut key of the control using the keyboard, it is confirmed that the issued language switching instruction has been received. Among them, when the language switching control is triggered, a language type display list will be displayed on the interface. The language type display list may include a plurality of preset language types, such as Chinese, English, Chinese, Japanese, Spanish, Thai, French, etc. The language type selected by the user in the language type display list can be encapsulated as an attribute information into the language switching instruction. When parsing the language switching instruction, the language type carried in the language switching instruction can be parsed, and the language type can be used as a language identifier.
[0066] It should be noted that after the language identifier is parsed, the language identifier can also be saved so that the thread context can obtain the language identifier at any time to determine which language type the business should be switched to based on the language identifier. For example, the thread local variable (ThreadLocal) can be used to store the language identifier by customizing the MultiContextHolder class. Exemplarily, the language identifier in the language switching instruction can be parsed and stored in the variable multiLangContextHolder. Furthermore, after the language switching request is completed, the saved language identifier can be removed from the multiLangContextHolder to prevent memory leaks and improve data security.
[0067] S120: If the language identifier is inconsistent with the preset language identifier, traverse the annotation information in the target program to encapsulate at least one object to be translated based on the annotation information to obtain a target encapsulated object.
[0068] Among them, the preset language identifier can represent the language type used by the application server deployment site, for example, it can be Chinese or English. The target program is related to the business, and the business can be a certain page or a certain course. The target program can contain all the source data for executing the business, such as annotation information, return values, parameters and other basic data. It can be understood that each business has a corresponding target program to provide logical support when processing the business. The annotation information includes the objects to be translated in the target business that need to be processed in multiple languages. The objects to be translated can be understood as objects that need to be translated, such as certain fields or records in the program that need to be translated.
[0069] In this embodiment, after determining the language identifier, the language identifier can be compared with the preset language identifier. If the language identifier is consistent with the preset language identifier, it means that the language type selected by the user is the same as the language type used by the server deployment site corresponding to the target business, and no multi-language processing is required. At this time, the target program can be directly called to process the target business normally. If the language identifier is inconsistent with the preset language identifier, it means that the language type selected by the user is inconsistent with the language type used by the server deployment site, and the target business needs to be converted into a language type consistent with the selected language identifier. Under the condition of inconsistent identifiers, the target program can be executed, the annotation information in the target program can be traversed, and the objects to be translated that are pre-annotated in the annotation information and need to be processed in multiple languages in the target business can be found. For example, the target business can be article A, and the objects to be translated can be attribute information such as title, content, and comments in article A. Further, at least one object to be translated can be encapsulated by the annotation information (for example, operation type, encapsulation type, encapsulation method, etc.) in the annotation information to obtain the target encapsulated object. For example, at least one object to be translated may be encapsulated in a data table in the form of a list, or the object to be translated may be stored in a document in the form of a key-value pair, and the position corresponding to the value may be left empty so that it can be filled in later after the translation value of the object to be translated is obtained.
[0070] For example, see Figure 2 When receiving a language switching instruction, the aspect interceptor is used to intercept the instruction, and then the stored language identifier is obtained from the thread local variable to determine whether the language identifier is consistent with the preset language identifier. If the language identifier is consistent with the preset language identifier, it means that the language type to be converted is consistent with the language type used by the application server deployment site, and the target program can be directly executed by proxy, otherwise multi-language processing is performed.
[0071] S130: Determine a target translation value corresponding to at least one object to be translated based on the target encapsulated object and a pre-created multi-language storage table.
[0072] The multi-language storage table includes the identification of the translation object to be matched and the translation value to be used corresponding to the translation object to be matched in each language type, and the target translation value is a translation value in the translation value to be used. The identification of the translation object to be matched is used to characterize the uniqueness of the translation object to be matched. For example, the translation object to be matched is teaching course 1, and its identification can be represented as course t1. The translation value can be represented as the translation content. For example, the translation value of the title in the English type can be title, and the translation value of the time in the English type can be time. The title and time are two objects to be translated.
[0073] In this embodiment, it is possible to search from the multi-language storage table whether there is a to-be-translated object identifier that matches the to-be-translated object in the target encapsulated object, and if so, the to-be-used translation value corresponding to the matching to-be-translated object identifier can be used as the target translation value of the to-be-translated object. Accordingly, the target translation value corresponding to each to-be-translated object can be obtained.
[0074] It should be noted that when operating the target business based on the user's trigger operation, there may be multiple operation modes, such as query operation, update operation, etc. Different operation modes may have different corresponding language switching modes. For example, if the content of the business is updated, only the objects that need to be translated in the update part need to be translated. If the business is queried, it is necessary to detect whether the system has the business data of the corresponding language identification version, so as to perform business query if it exists.
[0075] In this embodiment, before determining the target translation value corresponding to at least one object to be translated based on the target encapsulation object and a pre-created multilingual storage table, it also includes: determining the operation type based on the fourth preset annotation information in the annotation information; if the operation type is a query operation type, obtaining the corresponding data to be encapsulated to update the target encapsulation object.
[0076] The fourth preset annotation information may refer to annotation information for marking an operation type. For example, @MultiLangMethod may be used to mark the fourth preset annotation information in the target program, and the value of the attribute operationType of the annotation is used as the operation type. The operation type refers to the form of business processing, such as query, delete, add, modify, etc.
[0077] Specifically, in the process of traversing the target program, if it is parsed that the fourth preset annotation information contains the fourth preset annotation information, the attribute value of the annotation information is obtained as the operation type. Further, it is determined which operation type it is. If the operation type is a query operation type, it means that it is necessary to query whether the target business exists in the system, so as to obtain the target business under the preset language identification version while ensuring its existence. When obtaining the target business, the objects that need to be translated in the target business can be extracted as the data to be encapsulated, and these data to be encapsulated can be encapsulated and updated to the target encapsulated object. If the operation type is an operation type such as deletion, addition, deletion, etc., it means that the target business needs to be updated. At this time, it means that the target business exists in the system, and the parameters that need to be translated in the target program can be directly obtained as the objects to be translated for encapsulation to obtain the target encapsulated object.
[0078] For example, see Figure 3 , when performing multi-language processing, first obtain the annotation @MultiLangMethod (i.e., the fourth preset annotation information) of the target program, and obtain the attribute operationType of the annotation @MultiLangMethod. Further, corresponding processing can be performed according to the value of operationType, and the value of this attribute represents the operation type. If the operation type is not specified, the default is MultiLangOperationTypeEnum.SELECT. If the operation type is an update operation type (such as INSERT, UPDATE, and DELETE), it means that this is an update process. First, obtain the parameters of the target program (i.e., the object to be translated) to perform multi-language processing on the object to be translated. If the operation type is a query operation type (SELECT), it means that this is a query process. First, the target program will be executed through the proxy to query the business data of the primary language version and return it. Then, it can be determined whether the return data type is a collection (List). If so, it means that the returned data contains multiple data. In order to improve the accuracy of data processing, it can be further determined whether the collection is empty. If it is empty, it means that the returned data is empty and no language switching is required, and the operation ends. If it is not empty, it means that there are objects that need to be translated in the returned data. You can encapsulate the fields that need multi-language processing to perform multi-language mapping based on the encapsulated data. If the return data type is not a collection (List), it means that there is only one piece of data in the returned data, so you can directly perform multi-language mapping based on this field that needs multi-language processing.
[0079] In this embodiment, based on the target encapsulated object and the pre-created multilingual storage table, the implementation method of determining the target translation value corresponding to at least one object to be translated may be: obtaining the translation object identifier corresponding to each object to be translated in the target encapsulated object; searching the multilingual storage table for the translation object identifier to be matched corresponding to the translation object identifier; and retrieving the target translation value corresponding to the object identifier to be translated under the target language type.
[0080] The translation object identifier can be used to characterize the uniqueness of the translation object. The target language type is encapsulated in the target encapsulation object.
[0081] Specifically, after obtaining the target encapsulated object, the target encapsulated object can be parsed to parse out the translation object identifier of each object to be translated in the target encapsulated object, and then the translation object identifier can be matched with the translation object identifier to be matched stored in the multi-language storage table to find out the translation object identifier to be matched that is consistent with the translation object identifier, and further, the value corresponding to the object identifier to be translated in the multi-language storage table can be retrieved as the target translation value of the object to be translated under the target language type.
[0082] S140: Perform language type conversion processing on the target service based on the target translation value.
[0083] Specifically, the target translation value can be used to replace the value of the corresponding object to be translated in the target business, so as to achieve content conversion, that is, language type conversion, so that the field that needs to be translated in the target business is replaced with content that matches the language type. For example, after operating the multi-language storage table, the field that needs multi-language processing can be updated based on the target translation value, and the updated return data can be assembled and fed back to the user.
[0084] The technical solution of the embodiment of the present invention determines the language identifier carried by the language switching instruction based on the received language switching instruction; if the language identifier is inconsistent with the preset language identifier, the annotation information in the target program is traversed to encapsulate at least one object to be translated based on the annotation information to obtain a target encapsulated object; based on the target encapsulated object and a pre-created multi-language storage table, a target translation value corresponding to at least one object to be translated is determined; based on the target translation value, a language type conversion process is performed on the target business. The technical solution of the embodiment of the present invention solves the problem of data redundancy and poor data scalability caused by pre-building multiple data tables or databases based on different language types for multi-language processing in the prior art, and realizes the determination of whether the language identifier carried by the language switching instruction is inconsistent with the preset language identifier, and whether language switching is required, thereby improving the accuracy of language switching. If so, the annotation information in the target program is traversed, and only the object to be translated marked in the annotation information needs to be determined for encapsulation to obtain the target encapsulated object. Furthermore, before implementing multi-language processing, a multi-language storage table is pre-configured, and the target translation value corresponding to at least one object to be translated is found from the multi-language storage table through the encapsulated target encapsulation object, thereby improving the efficiency of data search, reducing data storage redundancy, and reducing resource usage. When the target business is converted to a language type based on the target translation value, only the object to be translated needs to be translated, and there is no need to perform multi-language processing on all fields in the target business, thereby improving the efficiency of multi-language processing. At the same time, when there is a need to add a certain language type, it is only necessary to update the records of the multi-language storage table, or update some field annotations of the target program, thereby achieving the technical effect of improving data scalability.
[0085] Figure 4 This is a flowchart of a multi-language processing method provided by an embodiment of the present invention. Based on the above embodiment, the content corresponding to step S120 is further refined. The specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same or corresponding to the above embodiment are not repeated here.
[0086] like Figure 4 As shown, the method specifically comprises the following steps:
[0087] S210: Determine a language identifier carried by the language switching instruction based on the received language switching instruction.
[0088] S220: Determine that the language identifier is inconsistent with the preset language identifier.
[0089] S230: Acquire a marked object with first preset annotation information in the target program based on a reflection mechanism.
[0090] The reflection mechanism allows a running code program (such as a Java program) to check itself. When the reflection mechanism is running, all information of a class (including member variables, member methods, constructors, etc.) can be obtained, and the fields, methods, constructors, etc. of the class can be manipulated. The first preset annotation information can refer to annotation information that indicates whether the service needs language translation. For example,
[0091] @MultiLangContent is used to mark the first preset annotation information. The marked object may correspond to a business, indicating that the business can be processed in multiple languages.
[0092] In this embodiment, the reflection mechanism can be used to traverse the target program. When the target program contains the first preset annotation information, it is considered that the target service can be processed in multiple languages, and the object marked with the first preset annotation information can be used as the annotation object.
[0093] @MultiLangContent annotated object, and then the object's attributes can be encapsulated into a map structure, so that the translation object can be further encapsulated based on this structure.
[0094] S240: Acquire at least one object to be translated of the second preset annotation information and / or the third preset annotation information based on the marked object.
[0095] Among them, the second preset annotation information may refer to annotation information for marking language translation attributes required in the business. For example, @MultiLangAttr may be used to mark the second preset annotation information, which may be marked on the attributes of the class to mark that the attributes of this annotation will be processed in multiple languages. The third preset annotation information corresponds to the identifier of the object to be matched in the multilingual storage table, which may be used to identify the only piece of data in the table, corresponding to the primary key column in the table. For example, @MultiLangPrimaryKey may be used to mark the attributes of the class to mark the attributes of this annotation.
[0096] Specifically, after obtaining the marked object, objects marked with the second preset annotation information and / or the third preset annotation information under the marked object may be obtained as objects to be translated.
[0097] For example, you can search for attributes annotated with @MultiLangPrimaryKey and / or @MultiLangAttr. If the attribute is annotated with @MultiLangPrimaryKey, it means that the attribute is the only attribute in the data, and the key in the map is "primaryKey", which can be used as an object to be translated; if the attribute is annotated with MultiLangAttr, it means that the attribute needs to be processed in multiple languages, and the key in the map is the attribute name attrName, which can also be used as an object to be translated.
[0098] S250: Encapsulate at least one to-be-translated object into a target structure type to obtain a target encapsulated object.
[0099] Among them, the target structure type can be a map structure.
[0100] Specifically, the object to be translated can be encapsulated into a key-value pair, that is, the object to be translated is encapsulated into a target structure type, and the encapsulated object can be used as a target encapsulated object. At this time, the value in the target encapsulated object may be empty, so that the corresponding translation value can be obtained from the multi-language storage table later.
[0101] For example, if the first preset annotation information of the object A to be translated is className, the second preset annotation information is attrName, and the second preset annotation information is primaryKey, then it can be encapsulated as ${className}-${primaryKey}-${attrName} as the target encapsulation object. It should be noted that the target encapsulation object can also be updated based on the fourth preset annotation information of the object A to be translated. For example, if the fourth preset annotation information is lang, the updated target encapsulation object can be expressed as:
[0102] ${className}-${primaryKey}-${attrName}-${lang}.
[0103] S260: Determine a target translation value corresponding to at least one object to be translated based on the target encapsulated object and a pre-created multi-language storage table.
[0104] For example, the encapsulated map (i.e., the target encapsulated object) can be traversed. If there is a key-value pair with the key "primaryKey" in the map, the map is traversed using an iterator, and the data is assembled to operate the multi-language storage table multi_lang_content. The multi-lang-key field in the multi-language storage table can be expressed as:
[0105] ${className}-${primaryKey}-${attrName}-${lang}; the multi-lang-value field (i.e. the translation value) can be expressed as: attrValue. attrName is the identifier of the object to be translated. The attrValue corresponding to attrName can be found as the target translation value.
[0106] S270: Perform language type conversion processing on the target service based on the target translation value.
[0107] The technical solution of the embodiment of the present invention obtains the translation object identifier corresponding to each to-be-translated object in the target encapsulation object, and then searches for the to-be-translated object identifier corresponding to the translation object identifier from the multi-language storage table, retrieves the target translation value corresponding to the to-be-translated object identifier under the target language type, and searches for the target translation value corresponding to the to-be-translated object identifier by a key-value pair search method to improve the search efficiency.
[0108] Figure 5 This is a flow chart of a multi-language processing method provided by an embodiment of the present invention. On the basis of the above-mentioned embodiment, a multi-language storage table can also be pre-configured. The specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same or corresponding to the above-mentioned embodiment are not repeated here.
[0109] like Figure 5 As shown, the method includes:
[0110] S310: Retrieve a target program corresponding to the target business.
[0111] S320: Annotate at least one object to be translated in the target program with first preset annotation information, so as to determine that multi-language processing is required based on the first preset annotation information.
[0112] In this embodiment, @MultiLangContent can be used to annotate at least one to-be-translated object in the target program with first preset annotation information. For example, @MultiLangContent can be annotated on a class that requires multi-language (i.e., target business), indicating that only objects annotated with this annotation will be processed in multiple languages.
[0113] Exemplarily, the marking method may be:
[0114]
[0115] Among them, name is used to specify the name of the class. If it is not configured, the class name is used by default.
[0116] S330: Mark at least one object to be translated with second preset annotation information.
[0117] In this embodiment, @MultiLangAttr can be used to annotate at least one object to be translated with second preset annotation information. For example, @MultiLangAttr can be annotated on a class attribute (i.e., an object that needs to be processed in multiple languages), indicating that the attribute annotated with this annotation will be processed in multiple languages.
[0118] Exemplarily, the marking method may be:
[0119] pubLic@interface MultilangAttr{
[0120] Property name
[0121] String name();}
[0122] S340: Mark at least one object to be translated with third preset annotation information.
[0123] In this embodiment, @MultiLangPrimaryKey can be used to annotate at least one object to be translated with third preset annotation information. For example, @MultiLangPrimaryKey can be annotated on a class attribute, indicating that the attribute annotated with this annotation can identify a unique piece of data, corresponding to the primary key column in the multi-language storage table.
[0124] Exemplarily, the marking method may be:
[0125] public@interface MutilangPrimarykey{
[0126] Primary key name
[0127] String name();}
[0128] S350: Mark at least one object to be translated with fourth preset annotation information.
[0129] In this embodiment, @MultiLangMethod can be used to annotate at least one to-be-translated object with fourth preset annotation information. For example, @MultiLangMethod can be annotated on a method to indicate the operation type corresponding to the processing method annotated with the annotation.
[0130] Exemplarily, the marking method may be:
[0131] |public@interface MultiLangMethod{
[0132] Operation type, default value MuLtiLangOperationTypeEnum SELECT
[0133] MuLtilangOperationTypeEnum operationType()
[0134] defauLt MultilangOperationTypeEnum.SELECT;
[0135] The operationType() method indicates the type of database operation performed by the intercepted method. For example, there may be four operation types (see enumeration MultiLangOperationTypeEnum). If not specified, the default is MultiLangOperationTypeEnum.SELECT.
[0136] The enumeration MultiLangOperationTypeEnum is represented as:
[0137]
[0138]
[0139] S360: Determine a multi-language storage table based on the first preset annotation information, the second preset annotation information, the third preset annotation information, and the fourth preset annotation information, and the corresponding translation values to be used under the corresponding language types.
[0140] In this embodiment, the first preset annotation information, the second preset annotation information, the third preset annotation information and the fourth preset annotation information corresponding to an object to be translated and the corresponding translation value to be used under a language type can be taken as a data record, and a plurality of data records can be obtained accordingly. For example, course 1-A-title-query-attrValue can be taken as a record in a multi-language storage table, representing the value of the object title to be translated in course 1 during the query operation as attrValue, and A is the keyword. Furthermore, a multi-language storage table can be constructed based on a plurality of data records, such as storing all fields in the business system that require multi-language storage in a multi-language table (multi_lang_content).
[0141] It should be noted that in order to improve the scalability of data and improve data query efficiency, when generating the translation value record corresponding to each object to be translated, the translation value under the corresponding language type can be marked with a language identifier so that the language identifier can find the translation value corresponding to the object to be translated under the corresponding language type.
[0142] In this embodiment, based on the first preset annotation information, the second preset annotation information, the third preset annotation information and the fourth preset annotation information, and the corresponding translation values to be used under the corresponding language types, a multilingual storage table is determined, including: based on the first preset annotation information, the second preset annotation information, the third preset annotation information, the fourth preset annotation information and the language type identifiers corresponding to each language type, determining the to-be-matched translation object identifier in the multilingual storage table; based on the to-be-matched translation object identifier and the corresponding to-be-used translation value, determining the multilingual storage table.
[0143] Specifically, a unique language type identifier can be set in advance for each language type. When determining the multi-language storage table, the identification of the translation object to be matched under each language type can be generated based on the first preset annotation information, the second preset annotation information, the third preset annotation information, the fourth preset annotation information corresponding to the object to be translated, and the language type identifier corresponding to each language type. For example, the first preset annotation information, the second preset annotation information, the third preset annotation information, the fourth preset annotation information, and the language type identifier of the current language type of the object to be translated can be spliced to obtain the identification of the translation object to be matched under the current language type. Exemplarily, the splicing rule of the identification of the translation object to be matched can be: ${className}-${primaryKey}-${attrName}-${lang}. Among them, className indicates the abbreviation of the multilingual class (i.e. the first preset annotation information), and its value is the name attribute value of the annotation @MultiLangContent. If name is empty, the abbreviation of the class name is taken: primaryKey indicates the primary key index of the multilingual class (i.e. the third preset annotation information), and its value is the value of the attribute annotated @MultiLangPrimaryKey. If name is empty, the attribute name is taken; attrName indicates the attribute name that requires multilingual (i.e. the second preset annotation information), and its value is the name of the attribute annotated @MultiLangAttr. If name is empty, the attribute name is taken; lang indicates the language type identifier, and its value is the local variable of the current thread. Furthermore, the identifier of the translation object to be matched can be used as the key key, and based on the key and attrValue (i.e. the translation value to be used), a key-value pair can be constructed as a record in the multilingual storage table. It should be noted that when each record is generated, a self-incrementing identifier id is generated. The id, multi-lang-key and multi-lang-value, and all fields that require multi-language can be stored in the multi-language storage table, which is associated with the main language table through the id. The multi-language content is in the form of key-value pairs, and the target translation value of the object to be translated is accurately found through the hash index, thereby improving the search efficiency.
[0144] The technical solution of the embodiment of the present invention is to call the target program corresponding to the target business; mark the first preset annotation information for at least one object to be translated in the target program, determine the need for multi-language processing based on the first preset annotation information; mark the second preset annotation information for at least one object to be translated; mark the third preset annotation information for at least one object to be translated; mark the fourth preset annotation information for at least one object to be translated; determine the multi-language storage table based on the first preset annotation information, the second preset annotation information, the third preset annotation information and the fourth preset annotation information, and the corresponding translation value to be used under the corresponding language type, so as to realize the multi-language processing and marking of different levels of the objects to be translated in the target business, improve the logic of the target program, and then generate a multi-language storage table based on the multi-level annotation information, improve the availability of data, reduce data redundancy, and reduce memory consumption. At the same time, when configuring the multi-language storage table, only the objects to be translated need to be configured, and there is no need to configure the entire target business, thereby reducing data redundancy and reducing resource memory consumption. At the same time, when there is a change requirement to add a new language type, it is only necessary to update the records in the multi-language storage table, or update certain field annotations of the target program, without rebuilding the data table or database corresponding to the language type, thereby improving data scalability.
[0145] Figure 6 A schematic diagram of the structure of a multi-language processing device provided by an embodiment of the present invention is shown in FIG. Figure 6 As shown, the device includes: a language identification determination module 410 , a target encapsulation object determination module 420 , a target translation value determination module 430 and a conversion processing module 440 .
[0146] Among them, the language identifier determination module 410 is used to determine the language identifier carried by the language switching instruction based on the received language switching instruction; the target encapsulation object determination module 420 is used to traverse the annotation information in the target program if the language identifier is inconsistent with the preset language identifier, so as to encapsulate at least one object to be translated based on the annotation information to obtain a target encapsulation object; wherein the annotation information includes the object to be translated that needs to be processed in multiple languages in the target business; the target translation value determination module 430 is used to determine the target translation value corresponding to the at least one object to be translated based on the target encapsulation object and a pre-created multilingual storage table; wherein the multilingual storage table includes the translation object identifier to be matched and the translation value to be used corresponding to the object to be translated under each language type, and the target translation value is one of the translation values to be used; the conversion processing module 440 is used to perform language type conversion processing on the target business based on the target translation value.
[0147] Based on the above device, the language identification determination module 410 includes a language switching instruction generation unit and a language identification determination unit.
[0148] A language switching instruction generating unit, configured to generate the language switching instruction based on a triggering operation on a language switching control in a display interface;
[0149] A language identification determination unit, configured to determine the language identification carried in the language switching instruction based on the selected language type;
[0150] Wherein, at least one function display area corresponding to the target service is displayed in the display interface, and the function display area is used to display each sub-service in the target service.
[0151] On the basis of the above-mentioned device, the target encapsulation object determination module 420 includes a marked object determination unit, a to-be-translated object determination unit and a target encapsulation object determination unit.
[0152] A marked object determining unit, configured to obtain a marked object of first preset annotation information in the target program based on a reflection mechanism;
[0153] a to-be-translated object determining unit, configured to obtain at least one to-be-translated object of the second preset annotation information and / or the third preset annotation information based on the marked object;
[0154] The target encapsulated object determining unit is used to encapsulate the at least one to-be-translated object into a target structure type to obtain the target encapsulated object.
[0155] On the basis of the above device, the device preferably includes a target encapsulated object updating module, and the target encapsulated object updating module includes an operation type determining unit and a target encapsulated object updating unit.
[0156] an operation type determining unit, configured to determine an operation type based on fourth preset annotation information in the annotation information;
[0157] The target encapsulated object updating unit is used for obtaining corresponding data to be encapsulated to update the target encapsulated object if the operation type is a query operation type.
[0158] Based on the above device, the target translation value determination module 430 includes a translation object identification determination unit, a to-be-matched translation object identification determination unit and a target translation value determination unit.
[0159] A translation object identifier determination unit, used to obtain the translation object identifier corresponding to each to-be-translated object in the target encapsulated object;
[0160] a to-be-matched translation object identifier determining unit, configured to search the to-be-matched translation object identifier corresponding to the translation object identifier from the multi-language storage table;
[0161] A target translation value determination unit, used to retrieve a target translation value corresponding to the identifier of the object to be translated in a target language type;
[0162] The target language type is encapsulated in the target encapsulation object.
[0163] Based on the above device, the device also includes a multi-language storage table determination module, which includes a target program determination unit, a first marking unit, a second marking unit, a third marking unit, a fourth marking unit and a multi-language storage table determination unit.
[0164] A target program determination unit, used to call a target program corresponding to a target business;
[0165] A first marking unit, configured to mark at least one object to be translated in the target program with first preset annotation information, so as to determine that multi-language processing is required based on the first preset annotation information;
[0166] A second marking unit, used for marking second preset annotation information for the at least one object to be translated;
[0167] A third marking unit, configured to mark the at least one object to be translated with third preset annotation information; wherein the third preset annotation information corresponds to the identifier of the object to be matched in the multi-language storage table;
[0168] a fourth marking unit, configured to mark the at least one object to be translated with fourth preset annotation information, wherein the fourth preset annotation information corresponds to an operation type;
[0169] The multi-language storage table determining unit is used to determine the multi-language storage table based on the first preset annotation information, the second preset annotation information, the third preset annotation information and the fourth preset annotation information, and the corresponding translation values to be used under the corresponding language types.
[0170] Based on the above device, the multi-language storage table determination unit includes a to-be-matched translation object identifier determination sub-unit and a multi-language storage table determination sub-unit.
[0171] a to-be-matched translation object identifier determination subunit, configured to determine the to-be-matched translation object identifier in the multi-language storage table based on the first preset annotation information, the second preset annotation information, the third preset annotation information, the fourth preset annotation information, and the language type identifier corresponding to each language type;
[0172] The multi-language storage table determination subunit is used to determine the multi-language storage table based on the to-be-matched translation object identifier and the corresponding to-be-used translation value.
[0173] The technical solution of the embodiment of the present invention determines the language identifier carried by the language switching instruction based on the received language switching instruction; if the language identifier is inconsistent with the preset language identifier, the annotation information in the target program is traversed to encapsulate at least one object to be translated based on the annotation information to obtain a target encapsulated object; based on the target encapsulated object and a pre-created multi-language storage table, a target translation value corresponding to at least one object to be translated is determined; based on the target translation value, a language type conversion process is performed on the target business. The technical solution of the embodiment of the present invention solves the problem of data redundancy and poor data scalability caused by pre-building multiple data tables or databases based on different language types for multi-language processing in the prior art, and realizes the determination of whether the language identifier carried by the language switching instruction is inconsistent with the preset language identifier, and whether language switching is required, thereby improving the accuracy of language switching. If so, the annotation information in the target program is traversed, and only the object to be translated marked in the annotation information needs to be determined for encapsulation to obtain the target encapsulated object. Furthermore, before implementing multi-language processing, a multi-language storage table is pre-configured, and the target translation value corresponding to at least one object to be translated is found from the multi-language storage table through the encapsulated target encapsulation object, thereby improving the efficiency of data search, reducing data storage redundancy, and reducing resource usage. When the target business is converted to a language type based on the target translation value, only the object to be translated needs to be translated, and there is no need to perform multi-language processing on all fields in the target business, thereby improving the efficiency of multi-language processing. At the same time, when there is a need to add a certain language type, it is only necessary to update the records of the multi-language storage table, or update some field annotations of the target program, thereby achieving the technical effect of improving data scalability.
[0174] The multi-language processing device provided in the embodiment of the present invention can execute the multi-language processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0175] It is worth noting that the various units and modules included in the above system are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present invention.
[0176] Figure 7 The present invention is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 7 A block diagram of an exemplary electronic device 50 suitable for implementing exemplary embodiments of the present invention is shown. Figure 7The electronic device 50 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0177] like Figure 7 As shown, the electronic device 50 is in the form of a general computing device. The components of the electronic device 50 may include but are not limited to: one or more processors or processing units 501, a system memory 502, and a bus 503 connecting different system components (including the system memory 502 and the processing unit 501).
[0178] Bus 503 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
[0179] The electronic device 50 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 50, including volatile and non-volatile media, removable and non-removable media.
[0180] System memory 502 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 504 and / or cache memory 505. Electronic device 50 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 506 may be used to read and write non-removable, non-volatile magnetic media ( Figure 7 not shown, usually called a "hard drive"). Although Figure 7 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 503 via one or more data medium interfaces. The memory 502 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the embodiments of the present invention.
[0181] A program / utility 508 having a set (at least one) of program modules 507 may be stored, for example, in the memory 502, such program modules 507 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 507 generally perform the functions and / or methods of the embodiments described herein.
[0182] The electronic device 50 may also communicate with one or more external devices 509 (e.g., keyboards, pointing devices, displays 810, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 50, and / or may communicate with any device that enables the electronic device 50 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed through an input / output (I / O) interface 511. Furthermore, the electronic device 50 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 512. As shown, the network adapter 512 communicates with other modules of the electronic device 50 through the bus 503. It should be understood that although Figure 7 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 50, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0183] The processing unit 501 executes various functional applications and data processing by running the programs stored in the system memory 502, for example, implementing the multi-language processing method provided by the embodiment of the present invention.
[0184] An embodiment of the present invention further provides a storage medium containing computer executable instructions, which are used to execute a multi-language processing method when executed by a computer processor. The method includes:
[0185] Based on the received language switching instruction, determining the language identifier carried by the language switching instruction;
[0186] If the language identifier is inconsistent with the preset language identifier, traversing the annotation information in the target program to encapsulate at least one object to be translated based on the annotation information to obtain a target encapsulated object; wherein the annotation information includes the object to be translated that needs to be processed in multiple languages in the target business;
[0187] Based on the target encapsulated object and a pre-created multi-language storage table, a target translation value corresponding to the at least one object to be translated is determined; wherein the multi-language storage table includes an identifier of a translation object to be matched and a translation value to be used corresponding to the object to be translated in each language type, and the target translation value is one of the translation values to be used;
[0188] A language type conversion process is performed on the target service based on the target translation value.
[0189] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, 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 above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0190] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0191] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0192] Computer program code for performing the operation of embodiments of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent 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 may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0193] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A multi-language processing method, characterized in that: include: Based on the received language switching instruction, determining the language identifier carried by the language switching instruction; If the language identifier is inconsistent with the preset language identifier, traversing the annotation information in the target program to encapsulate at least one object to be translated based on the annotation information to obtain a target encapsulated object; wherein the annotation information includes the object to be translated that needs to be processed in multiple languages in the target business; Based on the target encapsulated object and a pre-created multi-language storage table, a target translation value corresponding to the at least one object to be translated is determined; wherein the multi-language storage table includes an identifier of a translation object to be matched and a translation value to be used corresponding to the object to be translated in each language type, and the target translation value is one of the translation values to be used; A language type conversion process is performed on the target service based on the target translation value.
2. The method according to claim 1, characterized in that The determining, based on the received language switching instruction, a language identifier carried by the language switching instruction includes: Generate the language switching instruction based on the triggering operation of the language switching control in the display interface; Based on the selected language type, determining a language identifier carried in the language switching instruction; Wherein, at least one function display area corresponding to the target service is displayed in the display interface, and the function display area is used to display each sub-service in the target service.
3. The method according to claim 1, characterized in that The traversing the annotation information in the target program to encapsulate at least one to-be-translated object based on the annotation information to obtain a target encapsulated object includes: Acquire, based on a reflection mechanism, a marked object in the target program that is first preset annotation information; Acquire at least one to-be-translated object of the second preset annotation information and / or the third preset annotation information based on the marked object; The at least one object to be translated is encapsulated into a target structure type to obtain the target encapsulated object.
4. The method according to claim 1, characterized in that: Before determining the target translation value corresponding to the at least one object to be translated based on the target encapsulated object and the pre-created multi-language storage table, the method further includes: Determining an operation type based on fourth preset annotation information in the annotation information; If the operation type is a query operation type, the corresponding data to be encapsulated is obtained to update the target encapsulation object.
5. The method according to claim 1, characterized in that The determining, based on the target encapsulated object and the pre-created multi-language storage table, a target translation value corresponding to the at least one object to be translated comprises: Obtaining translation object identifiers corresponding to each to-be-translated object in the target encapsulated object; Searching the multi-language storage table for a translation object identifier to be matched corresponding to the translation object identifier; Retrieving a target translation value corresponding to the identifier of the object to be translated in the target language type; The target language type is encapsulated in the target encapsulation object.
6. The method according to claim 1, characterized in that Also includes: Retrieve the target program corresponding to the target business; marking at least one object to be translated in the target program with first preset annotation information, so as to determine that multi-language processing is required based on the first preset annotation information; marking the at least one object to be translated with second preset annotation information; Marking the at least one object to be translated with third preset annotation information; wherein the third preset annotation information corresponds to the identifier of the object to be matched in the multi-language storage table; marking the at least one object to be translated with fourth preset annotation information, wherein the fourth preset annotation information corresponds to an operation type; The multi-language storage table is determined based on the first preset annotation information, the second preset annotation information, the third preset annotation information and the fourth preset annotation information, and the corresponding translation values to be used under the corresponding language types.
7. The method according to claim 6, characterized in that The determining the multi-language storage table based on the first preset annotation information, the second preset annotation information, the third preset annotation information and the fourth preset annotation information, and the corresponding translation values to be used under the corresponding language types, includes: Determine the identification of the translation object to be matched in the multi-language storage table based on the first preset annotation information, the second preset annotation information, the third preset annotation information, the fourth preset annotation information and the language type identification corresponding to each language type; The multi-language storage table is determined based on the to-be-matched translation object identifier and the corresponding to-be-used translation value.
8. A multi-language processing device, characterized in that: include: A language identification determination module, configured to determine the language identification carried by the language switching instruction based on the received language switching instruction; A target encapsulated object determination module, for traversing the annotation information in the target program if the language identifier is inconsistent with the preset language identifier, so as to encapsulate at least one object to be translated based on the annotation information to obtain a target encapsulated object; wherein the annotation information includes objects to be translated that need to be processed in multiple languages in the target business; a target translation value determination module, configured to determine a target translation value corresponding to the at least one object to be translated based on the target encapsulated object and a pre-created multi-language storage table; wherein the multi-language storage table includes a to-be-matched translation object identifier and a to-be-used translation value corresponding to the to-be-translated object in each language type, and the target translation value is one of the to-be-used translation values; The conversion processing module is used to perform language type conversion processing on the target service based on the target translation value.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the multi-language processing method according to any one of claims 1 to 7.
10. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to perform the multi-language processing method according to any one of claims 1 to 7 when executed by a computer processor.