Multi-language conversion method, device and equipment for service system
By introducing a multilingual conversion method in the business system and storing converted data using cached databases, the problems of large workload of multilingual display and reduced system stability in the prior art are solved, and the rapid support of multilingual resource package access is achieved, which reduces the workload of developers.
Patent Information
- Application Number
- CN202411657177.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-07
AI Technical Summary
When implementing multilingual display of business systems, the prior art has a large workload and requires in-depth code adjustments, resulting in a decrease in system stability or crash, and there is a great risk for multilingual migration of in-use business systems.
Provide a multilingual conversion method for business systems. By obtaining front-end data update requests, judging language types and converting them, using cached database to store converted data, so as to support multilingual resource package access without a large amount of manual adjustment of code.
It realizes rapid expansion and upgrading of existing business systems, allowing them to quickly support multilingual resource package access, reduces developer workload, reduces system stability risks, and improves the efficiency of multilingual support.
Smart Images

Figure CN119576334A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of language conversion, and in particular to a multi-language conversion method, device and equipment for a business system. Background Art
[0002] There are two main methods for realizing multi-language display of business systems. One is to install multi-language resource packages during the development phase, and the second is to expand the multi-language function of the already developed software.
[0003] The first method requires the formulation of various constraints and specifications. By requiring specific developers to work in accordance with the development specifications, it can be ensured that all text information used in the development code can be uniformly accessed from the resource package, thereby achieving multi-language support.
[0004] The second method requires a relatively large transformation of the existing system. It requires manual conversion of all information in the program code, such as static variable declarations, string references, warning messages, etc., which is a huge workload. At the same time, since this method involves the adjustment of all program codes of the application system, it requires modification of each module and the participation of many developers. Moreover, since the modification of the program will inevitably lead to various defects in the system, it will seriously affect the daily iteration and upgrade of the existing system. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a multi-language conversion method, device and equipment for a business system, so as to solve the problems existing in the prior art, such as large workload, the need for agent-level intrusion leading to system stability degradation or crash, and the need for comprehensive and careful debugging and testing, and the high risk of multi-language migration of the business system in use. The existing business system can be expanded and upgraded quickly to enable it to quickly support access to multi-language resource packages without the need for developers to adjust the code through a large amount of manual input.
[0006] In a first aspect, a multi-language conversion method for a business system is provided, and the method may include:
[0007] Acquire a data update request sent by the business system front end; wherein the data update request includes a data update instruction, a target data combination and attribute information of the target data combination; the target data combination includes target conversion data and target non-conversion data; the attribute information includes: an attribute identifier of the target data combination and a real-time language type of the target conversion data;
[0008] When the real-time language type is different from the configured original language type, if the attribute identifier is not stored in the configured cache database, the real-time language type of the target conversion data is converted into the original language type;
[0009] Sending the converted target conversion data, the attribute identifier, the target non-conversion data and the data update instruction to the business system backend;
[0010] Receiving the converted target conversion data, the attribute identifier and the updated target non-conversion data returned by the business system backend;
[0011] extracting target conversion data from the cache database according to the attribute identifier;
[0012] The target conversion data and the updated target non-conversion data are sent to the business system front end.
[0013] In an optional implementation, any target data in the target data combination corresponds to a unique attribute type; the attribute information further includes: the attribute type of each target data;
[0014] The method for acquiring the target conversion data and the target non-conversion data includes:
[0015] For target data of any attribute type, match the target language conversion rule corresponding to the attribute type from the configured comparison table of different attribute types and language conversion rules; wherein the target language conversion rule includes conversion and non-conversion;
[0016] If the target language conversion rule corresponding to the attribute type is conversion, the target data of the attribute type is used as target conversion data;
[0017] If the target language conversion rule corresponding to the attribute type is no conversion, the target data of the attribute type is used as target non-conversion data.
[0018] In an optional implementation, before obtaining the data update request sent by the business system front end, the method further includes:
[0019] Obtaining a language conversion request sent by the business system front end; wherein the language conversion request includes a target language type, data to be processed, an attribute identifier of the data to be processed, and an attribute type of the data to be processed;
[0020] Extract the attribute type converted by the language conversion rule from the configured comparison table of different attribute types and language conversion rules as the first target attribute type;
[0021] Extracting data whose attribute type is the first target attribute type from the data to be processed to obtain data to be converted;
[0022] Converting the language type of the data to be converted into the target language type to obtain converted data to be converted;
[0023] Sending the converted data to be converted and other data in the data to be processed except the data to be converted to the business system front end, so that the business system front end displays the converted data to be converted in the target language type;
[0024] The data to be converted, the target language type and the converted data to be converted are stored in the cache database using the attribute identifier as an index.
[0025] In an optional implementation, before storing the target conversion data and the attribute identifier in a configured cache database, the method further includes:
[0026] If the attribute identifier is stored in the cache database, the data to be converted corresponding to the attribute identifier is extracted as the converted target conversion data.
[0027] In an optional implementation, after sending the converted target conversion data, the attribute identifier, the target non-conversion data and the data update instruction to the business system backend, the method further includes:
[0028] Extract the attribute type for which the data update rule is to be updated from the configured comparison table of different attribute types and data update rules as the second target attribute type;
[0029] Extracting data whose attribute type is the second target attribute type from the target non-converted data to obtain target update data;
[0030] Based on the data corresponding to the second target attribute type stored in the back end of the business system, the target update data is updated to obtain updated target update data;
[0031] Based on the updated target update data and other data in the target non-converted data except the target update data, updated target non-converted data are obtained.
[0032] In an optional implementation, the cache database also stores the call time and call count of the data corresponding to any attribute identifier;
[0033] When the remaining memory capacity of the cache database is less than the configured memory threshold, the data corresponding to the different attribute identifiers stored in the cache database are processed based on the call time and the call times corresponding to the different attribute identifiers.
[0034] In an optional implementation, based on the call time and the call count corresponding to the different attribute identifiers, the data corresponding to the different attribute identifiers stored in the cache database is processed, including:
[0035] For the data corresponding to any attribute identifier, match the weight corresponding to the call time and call number corresponding to the attribute identifier from the configured comparison table of different call times, different call numbers and weights;
[0036] Calculate the weight of the data corresponding to the attribute identifier according to the weight corresponding to the call time and the number of calls;
[0037] Sort the data corresponding to different attribute identifiers in descending order of weight values;
[0038] Extracting target cleanup data from the sorted data according to the difference between the remaining memory capacity and the memory threshold;
[0039] The target cleaning data is deleted from the cache database.
[0040] In a second aspect, a multi-language conversion device for a business system is provided, and the device may include:
[0041] An acquisition unit is used to acquire a data update request sent by a business system front end; wherein the data update request includes a data update instruction, a target data combination and attribute information of the target data combination; wherein the target data combination includes target conversion data and target non-conversion data; the attribute information includes: a real-time language type and an attribute identifier of the target data combination;
[0042] a conversion unit, configured to, when the real-time language type is different from the configured original language type, store the target conversion data and the attribute identifier in the configured cache database if the attribute identifier is not stored in the configured cache database, and convert the real-time language type of the target conversion data into the original language type;
[0043] A sending unit, used for sending the converted target conversion data, the attribute identifier, the target non-conversion data and the data update instruction to the business system backend;
[0044] A receiving unit, configured to receive the converted target conversion data, the attribute identifier and the updated target non-conversion data returned by the business system backend;
[0045] The feedback unit is used to extract the target conversion data from the cache database according to the attribute identifier; and send the target conversion data and the updated target non-conversion data to the business system front end.
[0046] In a third aspect, an electronic device is provided, the electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0047] Memory, used to store computer programs;
[0048] The processor is used to implement any method step described in the first aspect when executing the program stored in the memory.
[0049] In a fourth aspect, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any method step described in the first aspect is implemented.
[0050] This application can quickly expand and upgrade the existing business system so that it can quickly support access to multi-language resource packages without the need for developers to adjust the code through a large amount of manual input; instead, it automatically matches the code with the resource package so that the existing application system can support multi-language functions; this application has high practicality and promotion value, and can provide the medical industry with more convenient and efficient multi-language support capabilities.
[0051] This application can uniformly intercept and convert the output results of business services, and can realize the conversion output from source text to target text. In order to cope with various types of texts, the conversion component can realize text classification and recognition through rule definition; in addition, in order to speed up the text conversion process, the conversion component pre-caches the resource package to improve its index positioning speed; at the same time, in order to improve the efficiency of conversion, the pattern matching algorithm can realize fast and large-scale result conversion to meet the efficient conversion output requirements when the service is called.
[0052] This application can quickly realize multi-language presentation; at the same time, there is no need to completely replace or change the code, only the conversion component needs to be referenced. The specific conversion work is all automatically implemented by the conversion component, so there will be no code-level human errors, ensuring the stability of the business system. Moreover, because the conversion component will comprehensively intercept and process all output results of the system, there will be no omissions or errors, and there will be no problems of partial failure to convert. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0054] Figure 1 A flowchart of a multi-language conversion method for a business system provided in an embodiment of the present application;
[0055] Figure 2 A schematic diagram of multi-language conversion of a business system provided in an embodiment of the present application;
[0056] Figure 3 An architectural diagram of a multi-language conversion method for a business system provided in an embodiment of the present application;
[0057] Figure 4 A schematic diagram of a maximum recent cache algorithm provided in an embodiment of the present application;
[0058] Figure 5 A matching schematic diagram provided for an embodiment of the present application;
[0059] Figure 6 A schematic diagram of the structure of a multi-language conversion device for a business system provided in an embodiment of the present application;
[0060] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0062] Business system multilingualism means that the business system can support user interface displays in multiple languages and regions. Through multilingualism, users can choose the language they are familiar with when using the business system, thereby improving user experience and software usability. To achieve multilingualism of business systems, it is usually necessary to extract all texts, labels, buttons and other content in the software interface, and then translate and localize them for different languages and regions, and finally realize the display of multilingual interfaces in the business system.
[0063] The current business system is a microservice system with B / S architecture. Its front-end application system obtains relevant information by calling back-end services. The current business system only supports single-language output. At present, by introducing a multi-language conversion component between the server and the front-end application, all application applications and service outputs are converted in real time through the multi-language conversion component, and the multi-language output of the final result can be achieved.
[0064] The multi-language conversion method of the business system provided in the embodiment of the present application is applied to the business system for multi-language conversion; by deploying a conversion component between the front-end and back-end of the business system, the present application can continue to implement the backward transparent call of the business system on the one hand, and on the other hand, the multi-language conversion component intercepts and converts the result set returned by the back-end; when the conversion component receives the corresponding result set returned from the back-end, it will parse and convert it, and continue to return the final result to the front-end application in accordance with the original format specification for normal use and processing; thereby, the front-end and back-end of the business system use different language types to display or store data, and there is no need to extend the language package of the back-end of the business system.
[0065] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.
[0066] Figure 1 The following is a flow chart of a multi-language conversion method for a business system provided in an embodiment of the present application. Figure 1 As shown, the method may include:
[0067] Step S110, obtaining a data update request sent by the business system front end; when the real-time language type is different from the configured original language type, if the attribute identifier is not stored in the configured cache database, the target conversion data and the attribute identifier are stored in the configured cache database, and the real-time language type of the target conversion data is converted into the original language type.
[0068] In the embodiment of the present application, the business system will display the data or display interface in the original language type when it is initially opened; at this time, if the user wants to switch the language type, a language conversion request needs to be sent to the multi-language conversion component.
[0069] In the embodiment of the present application, the language conversion request includes the target language type, the data to be processed, the attribute identifier of the data to be processed, and the attribute type of the data to be processed.
[0070] In an embodiment of the present application, after receiving a language conversion request, the multi-language conversion component extracts the attribute type for which the language conversion rule is to be converted from the configured comparison table of different attribute types and language conversion rules as the first target attribute type; extracts data whose attribute type is the first target attribute type from the data to be processed to obtain the data to be converted; converts the language type of the data to be converted into the target language type to obtain the converted data to be converted; sends the converted data to be converted and other data in the data to be processed except the data to be converted to the front end of the business system, so that the front end of the business system displays the converted data to be converted in the target language type; and stores the data to be converted, the target language type and the converted data to be converted in a cache database using the attribute identifier as an index.
[0071] In an embodiment of the present application, the data to be processed may be the names of various controls or charts in the display interface, etc.; each row or column of data in each control name or chart, that is, each piece or each data corresponds to a unique attribute type, and different conversion rules and update rules are pre-configured for data of different attribute types. For example, the usenum attribute type is defined as not requiring language conversion.
[0072] like Figure 2 As shown, the multi-language conversion component classifies the data to be processed according to the conversion rules corresponding to the attribute type. First, the data corresponding to each attribute type that needs to be converted into a language type is extracted and converted into a target language type. Secondly, the data corresponding to each attribute type that does not need to be converted into a language type is combined with the data after the language type is converted according to the original format and fed back to the front end of the business system, so that the front end of the business system displays the corresponding data in the same format or the same style. Except that the language type of some data has been converted, the rest of the content remains unchanged.
[0073] For example, the format and content of the data to be processed are as follows:
[0074] <drugname> Amoxicillin< / drugname>
[0075] <standard> 100ml< / standard>
[0076] <usenum> 10< / usenum>
[0077] <unit> box< / unit>
[0078] <frequency> Three times a day< / frequency>
[0079] <productadd> Shijiazhuang Pharmaceutical Factory< / productadd> ;
[0080] It is predefined that drugname, standard, unit, frequency or productadd need to be converted to a language, but the usenum attribute does not need to be converted. The target language type is English. The data fed back to the front end is as follows:
[0081] <drugname> penicillin< / drugname>
[0082] <standard> 100ml< / standard>
[0083] <usenum> 10< / usenum>
[0084] <unit> box< / unit>
[0085] <frequency> BID< / frequency>
[0086] <productadd> Shijiazhuang Pharmaceutical Factory< / productadd> .
[0087] In actual applications, if the original language type of the business system is Simplified Chinese, and the backend database is stored in Simplified Chinese style, when the front end of the business system expects the display language to be Traditional Chinese, a language conversion is required for the content displayed on the front end, but the Arabic numerals do not need to be converted, only the text part needs to be converted. Therefore, this application configures an attribute type for each different target data, so as to distinguish whether language conversion is required according to the attribute type.
[0088] In an embodiment of the present application, the attribute identifier of the data to be processed, the data before and after the conversion, and the target language type of English are stored in the cache database in the above format or style; when the data corresponding to the attribute identifier needs to call data or update data to the back end, it is directly converted into the data before the language type is changed, thereby completing the data matching in the back-end database without causing the back-end database to store in the original language format, resulting in the problem that the keyword cannot be matched successfully.
[0089] In another embodiment of the present application, since the data that does not require language conversion is a fixed value that will not change, or is a dynamic value that will change at any time, only the data with an attribute type that requires language conversion may be stored in the cache database to reduce the data capacity in the cache database.
[0090] In the embodiment of the present application, the configured original language type is the display language when the business system is developed, and is also the language type for storing data in the back-end database of the business system.
[0091] In an embodiment of the present application, when the business system front end is in normal use and needs to call the data of the business system back end, it is necessary to send a data update request to the business system back end. Specifically, the data update request includes a data update instruction, a target data combination, and attribute information of the target data combination; the target data combination includes multiple target data; any target data is one of target conversion data and target non-conversion data; the attribute information includes: an attribute identifier of the target data combination, the real-time language type of the target conversion data, and the attribute type of each target data.
[0092] In the embodiment of the present application, the display language type of the target conversion data of the business system front end is used as the real-time language type of the target conversion data.
[0093] In an embodiment of the present application, a method for acquiring target conversion data and target non-conversion data includes:
[0094] For the target data of any attribute type, the target language conversion rule corresponding to the attribute type is matched from the configured comparison table of different attribute types and language conversion rules; if the target language conversion rule corresponding to the attribute type is conversion, the target data of the attribute type is used as the target conversion data; if the target language conversion rule corresponding to the attribute type is no conversion, the target data of the attribute type is used as the target non-conversion data.
[0095] In the embodiment of the present application, the target language conversion rule includes conversion and non-conversion; when it is conversion, it means that the corresponding data needs to be converted into a language type; when it is non-conversion, it means that the part of the data can be skipped when the language type is converted.
[0096] In an embodiment of the present application, when a data update request is received from a business system front end, it is necessary to first determine whether the language type of the target conversion data has changed. If not, the data can be directly called from the business system back end. When a change occurs, since the language type of the content stored in the business system back end still maintains the original language type, if the data is called directly, the back end may not be able to recognize it, so it is necessary to restore the target conversion data to the original language.
[0097] In the embodiment of the present application, since the business system front end has performed language conversion in advance and the corresponding content is stored in the cache database each time the data is updated, the cache database is first searched for a match based on the attribute identifier of the target data combination. If there is a match, it means that the target data combination has been called before. At this time, it is only necessary to obtain the data corresponding to the attribute identifier corresponding to the target data combination to obtain the target converted data stored in the original language type; if there is no matching result in the cache database, it means that the target data combination has not been called before. At this time, it is necessary to convert the language type of each target converted data in the target data combination into the original language type one by one, so as to call the corresponding data in the database.
[0098] For example, the business system uses Chinese as the interface language and backend storage language; however, the business system is used in an English scenario, and the user changes the interface display language from Chinese to English according to their own needs; if the language type of the backend database and all other data is modified accordingly, it will take a long time and require the expansion of the language pack, which will occupy a lot of resources; secondly, some business systems or software do not support language changes or require the entire code to be modified to complete the language change, which is not only time-consuming and labor-intensive, but may also cause the business system to crash.
[0099] The present application adds a conversion component between the front-end and the back-end so that the display languages of the front-end and the back-end are different. The business front-end is displayed in an English interface, but the business system back-end still stores data in Chinese. When the front-end needs to call data, the conversion component intercepts the data from the front-end, converts the English part into Chinese, and then calls the data from the back-end, so that the back-end can recognize and output the corresponding call data; when the back-end returns the call data, the conversion component intercepts it again, converts the corresponding data into English, and sends it to the front-end for display, so that the front-end and the back-end can be displayed or stored in different languages, realizing multi-language output, which can not only meet the needs of users, but also does not require the expansion of language packs or comprehensive modification of development codes.
[0100] In the embodiment of the present application, when the corresponding attribute identifier is not stored in the cache database and the target conversion data needs to be converted into a language, a plug-in or software implementation for language conversion may be called.
[0101] Step S120, sending the converted target conversion data, attribute identifier, target non-conversion data and data update instruction to the business system backend; receiving the converted target conversion data, attribute identifier and updated target non-conversion data returned by the business system backend.
[0102] In an embodiment of the present application, the converted target conversion data, attribute identifier, target non-conversion data and data update instruction are sent to the business system backend, thereby controlling the business system backend to update the data therein.
[0103] In an embodiment of the present application, the target non-conversion data can also be divided into target update data and target non-update data; among which, the target update data is the data that needs to be dynamically updated; and the target non-update data is the data that does not need to be dynamically updated in real time. The target non-update data can set a separate update rule for conditional update.
[0104] In an embodiment of the present application, after receiving the data, the business system backend needs to extract the attribute type whose data update rule is updated from the configured comparison table of different attribute types and data update rules as the second target attribute type; extract data whose attribute type is the second target attribute type from the target non-conversion data to obtain the target update data; update the target update data based on the data corresponding to the second target attribute type stored in the business system backend to obtain the updated target update data; obtain the updated target non-conversion data based on the updated target update data and other data in the target non-conversion data except the target update data.
[0105] For example, for a business settlement form, the quantity, unit price and other data are displayed in Arabic numerals, so there is no need to convert the language type. However, specifically, the quantity needs to be updated in real time, and the unit price may be fixed for a period of time and does not need to be updated in real time. When the unit price has not changed (that is, when the update condition is not triggered), only the quantity needs to be updated. Based on this, the present application configures different update rules for data of different attribute types, and only updates the quantity, thereby reducing problems such as resource waste caused by meaningless updates and improving the efficiency of updates.
[0106] Step S130: extract the target conversion data from the cache database according to the attribute identifier; and send the target conversion data and the updated target non-conversion data to the business system front end.
[0107] In an embodiment of the present application, after the business system backend returns the corresponding updated data, since the current display language type of the frontend is different from the language type contained in the database return data, the corresponding data needs to be converted back into the display language type of the frontend, and the display language type of the frontend is stored in the cache database. Therefore, the target conversion data stored in the cache database is directly called based on the attribute identifier, and then merged with the updated target non-converted data into the style when the business system frontend applies for data update. In this way, except for some data updates, the language type and overall layout style of other data are displayed intact on the frontend of the business system; thereby completing an intermediate language conversion, but the business system language conversion in which the language is not actually changed on the frontend and the backend.
[0108] In the embodiments of the present application, since most of the content displayed on the display interface of the business system is fixed, and the content of the image table called by the business system is also basically fixed, the present application takes a display interface or a chart as a target data combination, assigns an attribute identifier to different target data combinations, performs batch conversion during conversion, and directly performs associated storage during storage, so that the overall processing of an interface or a chart can be completed directly.
[0109] In another embodiment of the present application, a unique identification ID is configured for each target data. After conversion, the identification ID of each target data and the data before and after the conversion are stored. Therefore, when other target data combinations contain target data with the same identification ID, the data before or after the conversion corresponding to the identification ID in the cache database can be directly called, thereby improving the efficiency of the conversion.
[0110] In an embodiment of the present application, the identification ID of any target data can be obtained by hashing the standardized string of the corresponding target data; the length of the identification ID of any target data is fixed and the value is unique; the identification ID of any target data can be directly used as the index value of the text string of this target data.
[0111] In an embodiment of the present application, the cache database also stores the call time and call count of the data corresponding to any attribute identifier; when the remaining memory capacity of the cache database is less than the configured memory threshold, the data corresponding to different attribute identifiers stored in the cache database are processed based on the call time and call count corresponding to different attribute identifiers.
[0112] In an embodiment of the present application, based on the call time and call count corresponding to the different attribute identifiers, the data corresponding to the different attribute identifiers stored in the cache database are processed, including:
[0113] For the data corresponding to any attribute identifier, match the call time and the weight corresponding to the call number corresponding to the attribute identifier from the configured comparison table of different call times, different call counts and weights; calculate the weight of the data corresponding to the attribute identifier according to the weight corresponding to the call time and call count; sort the data corresponding to different attribute identifiers in order from large to small weight values; extract the target cleanup data from the sorted data according to the difference between the remaining memory capacity and the memory threshold; delete the target cleanup data from the cache database.
[0114] In the embodiment of the present application, since the cache database is not a backend server or a large cloud database, if the cache database stores too much content, it will affect the operation of the business system, so it is necessary to regularly clear the content stored in the cache database. The present application uses the maximum recent cache algorithm to clean up the data in the cache database, that is, to retain the data that has been called recently and frequently, and to clean up the data that has not been called for a long time or is called infrequently, thereby avoiding the need to re-convert frequently used data and wasting time, and also clearing a certain amount of space for the cache database to store new data.
[0115] In an embodiment of the present application, each time data is called from the cache database, the corresponding counter is incremented by one, based on which the number of calls for each data is obtained; and according to the call time, the time difference between the most recent call time and the current time can be determined, and the weights of the corresponding time differences and call times are pre-defined in a comparison table of different call times, different call times and weights. For example, if there is a call within half an hour, the weight is increased by 1, if the call number is 5-10 times, the weight value is increased by 2, and if the call number exceeds 3 times within half an hour, the weight value is increased by 3. According to the corresponding call time and call number, the comprehensive weight of each target data combination or target data can be calculated, and the data with a larger comprehensive weight is retained, so that the data with the smallest comprehensive weight is cleaned up until the cache database is less than the memory threshold.
[0116] In one embodiment of the present application, in order to avoid the need to frequently clean up the cache database, the standard for cleaning up the cache database may also be set to be that the real-time remaining memory capacity should be greater than the configured idle threshold.
[0117] In the embodiment of the present application, based on the call time and the call count corresponding to the different attribute identifiers, the data corresponding to the different attribute identifiers stored in the cache database are processed, and further includes:
[0118] For the data corresponding to any attribute identifier, obtain the heat prediction value of the data corresponding to the attribute identifier; match the weight corresponding to the call time and call number corresponding to the attribute identifier from the configured comparison table of different call times, different call counts and weights; calculate the weight of the data corresponding to the attribute identifier according to the weight corresponding to the call time and call number and the heat prediction value; sort the data corresponding to different attribute identifiers in order from large to small weight values; extract the target cleanup data from the sorted data according to the difference between the remaining memory capacity and the memory threshold; delete the target cleanup data from the cache database.
[0119] In an embodiment of the present application, the heat prediction value of the data corresponding to the attribute identifier is obtained by selecting a certain time period in the future as the future time period, and analyzing the number of calls and call times of the data corresponding to different attribute identifiers in the historical time period corresponding to the future time period in the historical data of the business system.
[0120] In another embodiment of the present application, the cleaning of the cache database of the business system can also be achieved in combination with the calling of the historical target data combination of the business system. For example, the next 3 hours or the next 1 day is set as the target period, and the number of calls and calling times of the historical target data combination of the business system in a certain time period in the past are analyzed. It is found that the business system used target data combination B more in the corresponding target period in the past time period. Although the target data combination was not called many times in the past time period of the day, the target data combination B is still retained.
[0121] In an example, although the target data combination A is frequently called in a certain period of time in the past, the target time periods in the past few days show that the target data combination A will not be called for a long time in the future, so the target combination A can be deleted from the cache database.
[0122] In another embodiment of the present application, Figure 3 As shown, the multi-language conversion method of the business system of the embodiment of the present application includes:
[0123] 1. Application analysis:
[0124] Normal business systems obtain corresponding data results by calling backend services. By deploying an additional conversion component between the frontend application and the backend service, on the one hand, the backward transparent call of the original application can be continued, and on the other hand, the multilingual conversion component intercepts and converts the result set returned by the backend. When the conversion component receives the corresponding result set returned from the backend, it will parse and convert it, and return the final result to the frontend application in the original format specification for normal use and processing.
[0125] 2. Category matching
[0126] (1) Manually customized rule matching
[0127] The rule engine needs to predefine a list of rules, which can be customized manually. It needs to define the corresponding conversion mode for each service application, and define which attributes need to be converted and which attributes need to be retained; as shown in the following example:
[0128] <drugname> Amoxicillin< / drugname>
[0129] <standard> 100ml< / standard>
[0130] <usenum> 10< / usenum>
[0131] <unit> box< / unit>
[0132] <frequency> Three times a day< / frequency>
[0133] <productadd> Shijiazhuang Pharmaceutical Factory< / productadd>
[0134] Need to be clearly defined manually: drugname, standard, unit, frequency, productadd and other attributes need to be converted, but the usenum attribute does not need to be converted, it is a reserved attribute. At the same time, the format of the attribute is also defined, such as: XML format: <drugname> Amoxicillin< / drugname> ; JSON format: drugname: amoxicillin; to facilitate the system to parse according to the format and obtain the value of its attributes.
[0135] (2) Intelligent classification rules
[0136] The rule list can also be automatically identified by the system through automatic matching based on the predefined list of convertible attributes, and the corresponding attributes can be converted as needed. This requires pre-defining the contents of the list of converted and retained attributes in advance, so that the system can match and determine whether the corresponding attributes need to be retained based on the predefined reserved fields, and perform the retention process.
[0137] By default, the smart conversion component extracts and converts attributes and data items according to the general style of XML or JSON, as follows:
[0138] <record>
[0139] <drugname> Amoxicillin< / drugname>
[0140] <standard> 100ml< / standard>
[0141] <usenum> 10< / usenum>
[0142] <unit> box< / unit>
[0143] <frequency> Three times a day< / frequency>
[0144] <productadd> Shijiazhuang Pharmaceutical Factory< / productadd>
[0145] < / record>
[0146] It will first obtain the list of retained attributes previously defined by the rule engine, and adopt corresponding processing strategies to convert or retain the extracted attribute content to be parsed.
[0147] 3. Subcontracting
[0148] The conversion component will convert the content to be parsed in sequence according to the rules defined by the rule engine. First, the content to be returned will be parsed line by line;
[0149] 4. Pre-cache processing
[0150] The conversion engine will read the resource packages related to multilingual conversion in advance and pre-cache them to facilitate the rapid indexing and positioning of resource content in the later stage. Considering that the size of the resource package may be relatively large, caching all of it into memory may cause server memory overflow. Therefore, in order to ensure the availability of the server in the minimum memory scenario, it is necessary to clean up regularly and release the available memory in time; however, the real-time positioning and loading of resource data will consume a certain amount of system response time, and frequent loading will cause the system to be slow, seriously affecting the user experience. Therefore, this application will optimize the cleaning and loading of its memory through the most recent maximum cache algorithm, such as Figure 4 shown.
[0151] First, a cacheable list is established, including: cache items, item contents, counters, and last used time; the conversion component will encode and register the result of each conversion in groups according to the output and register it in the list; if the item already exists in the list, the counter will be updated by one, and its last used time will be updated; when the cached amount reaches the threshold of the system-specified memory, the system will make a comprehensive judgment on how to clean it up based on the count of each cached item and its recent use; the cleaning algorithm is as follows: sort by counter, and clean up cached items with fewer reuses first; simultaneously determine whether the usage time of the cleaned items is within one day. If it is less than one day, they can be temporarily retained, otherwise they will be cleaned up directly; if the system's minimum memory is not enough to retain cached data within one day, it can be adjusted to the cache amount of the last X hours through configuration.
[0152] Finally, the system will retain cache data in memory based on the principle of recent and maximum usage times, which is more in line with the current business system's time-sharing access to data during peak hours. By establishing a corresponding timed cache recommendation list and cleaning it up in time according to the plan, the consumption of invalid memory can be reduced and the hit rate of cache data can be improved.
[0153] 5. Pattern matching algorithm
[0154] In order to achieve rapid conversion of large quantities of protocol text content, this application optimizes it through a pattern matching algorithm. The workflow is as follows: Figure 5 shown.
[0155] The matching algorithm performs batch recognition according to the corresponding patterns for different types of text protocols, and can achieve batch conversion with the help of the memory cache library, which can greatly improve the efficiency of text conversion to meet the performance requirements of fast returns required by high-frequency service interfaces.
[0156] The specific workflow is as follows:
[0157] (1) Retention substitution
[0158] The matching algorithm will convert the format of each line of data in the incoming content, mainly retaining the keyword [convertible content] and replacing the reserved items [non-convertible content, usually numbers] with special characters;
[0159] The conversion component distinguishes which content needs to be converted or retained based on the list of retained attributes defined in the previous rule list;
[0160] As in the example above: the conversion component will obtain usenum as a reserved attribute from the reserved attribute list.
[0161] <usenum> 10< / usenum> ; Replace with: <usenum> @#@< / usenum> ;
[0162] In this way, in the next conversion stage, the conversion component will automatically ignore these attributes and not convert them, but retain the original attribute results as direct output.
[0163] Other attributes will be converted because they are not reserved attributes, so the existing content needs to be kept unchanged. Finally, after the above conversion, the reserved content of various fixed-format protocol texts can be removed and finally unified into a standard text string to be converted.
[0164] (2) Unique Index
[0165] The matching algorithm will perform hash calculation on each standardized string to be converted to obtain a fixed-length, unique identification value, which will be used as the index value of this text string.
[0166] (3) Content positioning
[0167] The matching algorithm searches and locates the converted content from the cache based on the calculated unique index value. If so, the result can be directly returned. If not, the new generation algorithm is called to generate the result.
[0168] (4) New generation algorithm
[0169] The newly generated algorithm will first parse the text string to be converted, convert it into each keyword to be converted, and generate a corresponding unique index for each keyword according to a unified algorithm. Then, it will get the corresponding conversion result from the cache through the unique index value. If it exists, it will be returned directly. If it does not exist, its value needs to be registered in the list to be converted. Later, it can be put into use after automatic translation and manual improvement through special tools.
[0170] (5) Content caching
[0171] The result of the conversion by the newly generated algorithm is directly returned to the positioning service and is cached in the corresponding cache library so that it can be directly used the next time it is called.
[0172] (6) Content return
[0173] Regardless of whether it is directly obtained through a unique index or directly generated with a new generation algorithm, the result will be converted from the original format to the following:
[0174] <record>
[0175] <drugname> Amoxicillin< / drugname>
[0176] <standard> 100ml< / standard>
[0177] <usenum> @#@< / usenum>
[0178] <unit> box< / unit>
[0179] <frequency> Three times a day< / frequency>
[0180] <productadd> Shijiazhuang Pharmaceutical Factory< / productadd>
[0181] < / record>
[0182] Convert to
[0183] <record>
[0184] <drugname> penicillin< / drugname>
[0185] <standard> 100ml< / standard>
[0186] <usenum> @#@< / usenum>
[0187] <unit> box< / unit>
[0188] <frequency> BID< / frequency>
[0189] <productadd> Shijiazhuang Pharmaceutical Factory< / productadd>
[0190] < / record>
[0191] (7) Reverse Matching
[0192] At this time, the unified standard result of the conversion needs to be re-completed according to the individual content of the application. Here, the rule matching algorithm will be reused, and the original reserved items [non-converted content, generally numbers] will be restored to their original values using regular expressions;
[0193] The final result is as follows:
[0194] <record>
[0195] <drugname> penicillin< / drugname>
[0196] <standard> 100ml< / standard>
[0197] <usenum> 10< / usenum>
[0198] <unit> box< / unit>
[0199] <frequency> BID< / frequency>
[0200] <productadd> Shijiazhuang Pharmaceutical Factory< / productadd>
[0201] < / record>
[0202] (8) Results returned
[0203] At this point, the matching algorithm will complete the overall batch conversion process and return the final result to the conversion component for the next step of calculation and processing.
[0204] 6. Batch return
[0205] The conversion component will reverse merge the conversion results according to the parsing application, and finally form a converted full-volume protocol text set, which will be returned to the application caller.
[0206] The multi-language conversion method of the business system of the present application can greatly improve the efficiency of its positioning by indexing the content to be converted; batch-level text conversion can be achieved through pattern matching sub-packaging and packaging algorithms, greatly improving the conversion efficiency of large strings of text; dynamic text conversion results can be reused through innovative parsing and separation of keywords and reserved words; with the support of the most recent maximum cache algorithm, service resources are used to the maximum extent to speed up the efficiency of algorithm output;
[0207] The multi-language conversion method of the business system of the present application can realize the definition of conversion rules for various output contents, and can define the format conversion rules of corresponding target results according to words, sentences, paragraphs and specific templates; it can also refer to various types of protocol texts that appear in the service call process, combined with the rule management of the rule engine, and combine to implement the definition of conversion rules of different levels and granularities; it supports various communication formats, such as json, xml and other formats, and various open formats can be expanded and implemented.
[0208] The multi-language conversion method of the business system of the present application sets the conversion component to directly intercept all service applications through service proxy, and realizes multi-language output of conversion results through efficient conversion; the conversion component as a whole can be referenced to realize the expansion of the multi-language conversion capability of the current system. It does not need to invade the code of the original application, the current business system does not need to change the internal code implementation and the corresponding code logic, and all business-level codes do not need to be changed. It only needs to be deployed in the system, and the proxy conversion of the current multi-language conversion component can realize the expansion of the multi-language conversion capability through the final output result.
[0209] The conversion component provided by this application is implemented by the JAVA development language, so it can be deployed across systems; and it can be converted and connected with various application systems, and it can support the conversion of various communication protocols, such as the conversion processing of general format content such as json and XML;
[0210] Corresponding to the above method, the embodiment of the present application also provides a multi-language conversion device for a business system, such as Figure 6 As shown, the multi-language conversion device of the business system includes:
[0211] The acquisition unit 610 is used to acquire the data update request sent by the business system front end; wherein the data update request includes a data update instruction, a target data combination and attribute information of the target data combination; wherein the target data combination includes target conversion data and target non-conversion data; the attribute information includes: a real-time language type and an attribute identifier of the target data combination;
[0212] a conversion unit 620, configured to store the target conversion data and the attribute identifier in a configured cache database if the real-time language type is different from the configured original language type, and to convert the real-time language type of the target conversion data into the original language type;
[0213] The sending unit 630 is used to send the converted target conversion data, attribute identifier, target non-conversion data and data update instruction to the business system backend;
[0214] The receiving unit 640 is used to receive the converted target conversion data, attribute identifier and updated target non-conversion data returned by the business system backend;
[0215] The feedback unit 650 is used to extract the target conversion data from the cache database according to the attribute identifier; and send the target conversion data and the updated target non-conversion data to the business system front end.
[0216] The functions of the various functional units of the multi-language conversion device of the business system provided in the above-mentioned embodiments of the present application can be realized through the above-mentioned method steps. Therefore, the specific working process and beneficial effects of each unit in the multi-language conversion device of the business system provided in the embodiments of the present application are not repeated here.
[0217] The present application also provides an electronic device, such as Figure 7 As shown, it includes a processor 710 , a communication interface 720 , a memory 730 and a communication bus 740 , wherein the processor 710 , the communication interface 720 , and the memory 730 communicate with each other via the communication bus 740 .
[0218] Memory 730, for storing computer programs;
[0219] The processor 710 is used to implement the following steps when executing the program stored in the memory 730:
[0220] Acquire a data update request sent by the business system front end; wherein the data update request includes a data update instruction, a target data combination and attribute information of the target data combination; wherein the target data combination includes target conversion data and target non-conversion data; the attribute information includes: a real-time language type and an attribute identifier of the target data combination;
[0221] If the real-time language type is different from the configured original language type, storing the target conversion data and the attribute identifier in the configured cache database, and converting the real-time language type of the target conversion data into the original language type;
[0222] Send the converted target conversion data, attribute identifier, target non-conversion data and data update instruction to the business system backend;
[0223] Receive the converted target conversion data, attribute identifier and updated target non-conversion data returned by the business system backend;
[0224] According to the attribute identifier, the target conversion data is extracted from the cache database; the target conversion data and the updated target non-conversion data are sent to the business system front end.
[0225] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0226] The communication interface is used for communication between the above electronic device and other devices.
[0227] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0228] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0229] The implementation methods and beneficial effects of the components of the electronic device in the above embodiments to solve the problems can be seen in Figure 1 The various steps in the illustrated embodiment are implemented, therefore, the specific working process and beneficial effects of the electronic device provided by the embodiment of the present application are not repeated here.
[0230] In another embodiment provided by the present application, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is executed on a computer, the computer executes the multi-language conversion method of the business system in any one of the above embodiments.
[0231] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the multi-language conversion method of the business system in any one of the above embodiments.
[0232] Those skilled in the art will appreciate that the embodiments in the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt a complete hardware embodiment, a complete software embodiment, or a form of an embodiment combining software and hardware. Moreover, the present application may adopt a form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0233] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0234] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0235] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0236] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present application.
[0237] Obviously, those skilled in the art can make various changes and modifications to the embodiments in the present application without departing from the spirit and scope of the embodiments in the present application. Thus, if these modifications and variations of the embodiments in the present application fall within the scope of the claims and their equivalents in the embodiments of the present application, the embodiments of the present application are also intended to include these modifications and variations.
Claims
1. A multi-language conversion method for a business system, characterized in that: The method comprises: Acquire a data update request sent by the business system front end; wherein the data update request includes a data update instruction, a target data combination and attribute information of the target data combination; the target data combination includes target conversion data and target non-conversion data; the attribute information includes: an attribute identifier of the target data combination and a real-time language type of the target conversion data; When the real-time language type is different from the configured original language type, if the attribute identifier is not stored in the configured cache database, storing the target conversion data and the attribute identifier in the configured cache database, and converting the real-time language type of the target conversion data into the original language type; Sending the converted target conversion data, the attribute identifier, the target non-conversion data and the data update instruction to the business system backend; Receiving the converted target conversion data, the attribute identifier and the updated target non-conversion data returned by the business system backend; extracting target conversion data from the cache database according to the attribute identifier; The target conversion data and the updated target non-conversion data are sent to the business system front end.
2. The method according to claim 1, characterized in that Any target data in the target data combination corresponds to a unique attribute type; The attribute information also includes: the attribute type of each target data; The method for acquiring the target conversion data and the target non-conversion data includes: For target data of any attribute type, match the target language conversion rule corresponding to the attribute type from the configured comparison table of different attribute types and language conversion rules; wherein the target language conversion rule includes conversion and non-conversion; If the target language conversion rule corresponding to the attribute type is conversion, the target data of the attribute type is used as target conversion data; If the target language conversion rule corresponding to the attribute type is no conversion, the target data of the attribute type is used as target non-conversion data.
3. The method according to claim 2, characterized in that Before obtaining the data update request sent by the business system front end, the method further includes: Obtaining a language conversion request sent by the business system front end; wherein the language conversion request includes a target language type, data to be processed, an attribute identifier of the data to be processed, and an attribute type of the data to be processed; Extract the attribute type converted by the language conversion rule from the configured comparison table of different attribute types and language conversion rules as the first target attribute type; Extracting data whose attribute type is the first target attribute type from the data to be processed to obtain data to be converted; Converting the language type of the data to be converted into the target language type to obtain converted data to be converted; Sending the converted data to be converted and other data in the data to be processed except the data to be converted to the business system front end, so that the business system front end displays the converted data to be converted in the target language type; The data to be converted, the target language type and the converted data to be converted are stored in the cache database using the attribute identifier as an index.
4. The method according to claim 3, characterized in that The method further comprises: If the attribute identifier is stored in the cache database, the data to be converted corresponding to the attribute identifier is extracted as the converted target conversion data.
5. The method according to claim 3, characterized in that After sending the converted target conversion data, the attribute identifier, the target non-conversion data and the data update instruction to the business system backend, the method further includes: Extract the attribute type for which the data update rule is to be updated from the configured comparison table of different attribute types and data update rules as the second target attribute type; Extracting data whose attribute type is the second target attribute type from the target non-converted data to obtain target update data; Based on the data corresponding to the second target attribute type stored in the back end of the business system, the target update data is updated to obtain updated target update data; Based on the updated target update data and other data in the target non-converted data except the target update data, updated target non-converted data are obtained.
6. The method according to claim 1, characterized in that The cache database also stores the call time and call count of the data corresponding to any attribute identifier; When the remaining memory capacity of the cache database is less than the configured memory threshold, the data corresponding to the different attribute identifiers stored in the cache database are processed based on the call time and the call times corresponding to the different attribute identifiers.
7. The method according to claim 6, characterized in that Based on the call time and the call count corresponding to the different attribute identifiers, the data corresponding to the different attribute identifiers stored in the cache database are processed, including: For the data corresponding to any attribute identifier, match the weight corresponding to the call time and call number corresponding to the attribute identifier from the configured comparison table of different call times, different call numbers and weights; Calculate the weight of the data corresponding to the attribute identifier according to the weight corresponding to the call time and the number of calls; Sort the data corresponding to different attribute identifiers in descending order of weight values; Extracting target cleanup data from the sorted data according to the difference between the remaining memory capacity and the memory threshold; The target cleaning data is deleted from the cache database.
8. A multi-language conversion device for a business system, characterized in that: The device comprises: An acquisition unit is used to acquire a data update request sent by a business system front end; wherein the data update request includes a data update instruction, a target data combination and attribute information of the target data combination; the target data combination includes target conversion data and target non-conversion data; the attribute information includes: an attribute identifier of the target data combination and a real-time language type of the target conversion data; a conversion unit, configured to, when the real-time language type is different from the configured original language type, store the target conversion data and the attribute identifier in the configured cache database if the attribute identifier is not stored in the configured cache database, and convert the real-time language type of the target conversion data into the original language type; A sending unit, used for sending the converted target conversion data, the attribute identifier, the target non-conversion data and the data update instruction to the business system backend; A receiving unit, configured to receive the converted target conversion data, the attribute identifier and the updated target non-conversion data returned by the business system backend; The feedback unit is used to extract the target conversion data from the cache database according to the attribute identifier; and send the target conversion data and the updated target non-conversion data to the business system front end.
9. An electronic device, characterized in that: The electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-7 when executing a program stored in a memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.