Data multi-language storage and query method and system, medium and equipment
By pre-building multilingual data views for database tables and automatically translating untranslated records, the storage space and query efficiency issues in multilingual data storage are resolved, achieving non-intrusive and efficient multilingual data management and improving the system's versatility and flexibility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-04-07
AI Technical Summary
Existing technologies for multilingual data storage result in excessive storage space consumption, low query efficiency, and difficulty in porting to other systems. They are also highly invasive and negatively impact system performance.
By pre-building multilingual data views for physical tables in the database, configuring target fields that need to be translated, generating translation records and storing them in the translation target table, automatically translating untranslated records, and mapping them to the corresponding data view during queries to return translation results, a manual correction interface is provided to ensure translation quality.
It achieves non-intrusive data translation, saves storage space, improves query efficiency, enhances the system's versatility and flexibility, reduces maintenance costs, and ensures data consistency and ease of querying.
Smart Images

Figure CN121807879A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a data multilingual storage and query method, system, medium and device, and belongs to the technical field of data processing. BACKGROUND
[0002] Computer software needs to adapt to different languages in different countries due to internationalization. Current solutions mostly add a field for each language for each field or add a table for each language for each table. The method is relatively invasive, and each language occupies a storage space even if the field does not need to be translated, which leads to excessive storage space occupation. Since the table structure of each system may be different, it is difficult to transplant to other systems, and the universality is poor. When multilingual data is needed, the query statement needs to associate multiple columns or tables, which affects the performance of the system and leads to low query efficiency. SUMMARY
[0003] The purpose of the present application is to provide a data multilingual storage and query method, system, medium and device, which can complete data translation without code invasion, and when the data physical model changes, the business system does not need to make more operations, but can be directly completed by the translation system, has a certain universality, improves the convenience of query and user experience.
[0004] To achieve the above purpose, the present application adopts the following technical scheme.
[0005] In one aspect, the present application provides a data multilingual storage and query method, comprising:
[0006] Prebuilding data views corresponding to multiple languages for physical tables in a database;
[0007] Configuring target fields that need to be translated in the physical tables;
[0008] In response to data changes in the physical tables, generating translation records for the target fields that are configured to change and need to be translated and storing the translation records in a translation target table;
[0009] Automatically translating untranslated records in the translation target table and updating the translation results;
[0010] In response to a data query request, mapping a query for a physical table to a corresponding data view according to a target language in the query request to return a translated result.
[0011] Optionally, the data view is configured to:
[0012] When the target field has a translation result in the corresponding language in the translation target table, the translation result is preferentially returned;
[0013] When the translation result does not exist, the original value of the field in the physical table is returned.
[0014] Optionally, the generating and storing of the translation record into the translation target table comprises:
[0015] In response to an adding or editing operation of the physical table, a field that has been changed is identified;
[0016] When the changed field is configured to require translation, and the values before and after the change are changed, a translation record in an atomized manner is generated and stored into the translation target table, and a translation state thereof is marked as untranslated.
[0017] Optionally, the automatic translation of the untranslated record comprises:
[0018] The translation target table is scanned at a fixed time, and records with a translation state of untranslated are screened out;
[0019] A system translation service is called to translate the original value in the screened record into a value in a target language;
[0020] The translation result is updated into the atomized record, and the translation state thereof is marked as translated.
[0021] Optionally, the method further comprises:
[0022] A manual correction interface is provided, a correction operation of a user on a translation result in the translation target table is received, and the corrected result is updated into the translation target table.
[0023] Optionally, the mapping of the query for the physical table to the corresponding data view comprises:
[0024] A query request is intercepted in an aspect of a data persistence layer;
[0025] A target language parameter in the query request is parsed;
[0026] According to the target language parameter, a physical table identifier in the query request is replaced with a data view identifier in a corresponding language.
[0027] Optionally, when the target language parameter is not included in the query request, the original query request is directly executed, and the identifier replacement operation is not performed.
[0028] In a second aspect, the application provides a data multilingual storage and query system, comprising:
[0029] A view management module is configured to pre-build data views corresponding to multiple languages for physical tables in a database;
[0030] A field configuration module is configured to configure target fields in the physical tables that require translation;
[0031] The change response module is configured to generate a translation record for a target field configured to be changed and requiring translation and store the translation record in a translation target table in response to a data change in the physical table;
[0032] The automatic translation module is configured to automatically translate an untranslated record in the translation target table and update a translation result.
[0033] The query mapping module is configured to map a query for the physical table to a corresponding data view to return a translated result in response to a data query request according to a target language in the query request.
[0034] In a third aspect, the present application provides a computer readable storage medium having a computer program / instruction stored thereon, the computer program / instruction being executed by a processor to implement the steps of the data multilingual storage and query method according to any one of the first aspect.
[0035] In a fourth aspect, the present application provides a computer device, comprising:
[0036] A memory configured to store a computer program.
[0037] A processor configured to execute the computer program to implement the data multilingual storage and query method according to any one of the first aspect.
[0038] Compared with the prior art, the present application has the following beneficial effects:
[0039] The present application combines database view, translation field configuration, automatic translation and query statement interception technologies, and builds a high-performance and easy-to-expand data multilingual solution. All translations are managed through a translation target table to ensure the consistency of system data. The translation field can be configured without changing the physical model of the database, which saves the database storage space compared with copying all fields. The database view is uniformly used to improve the query efficiency. The target language only needs to be added when configuring, and the system automatically generates a new view without modifying the existing physical table structure or core code, which is easy to expand and has high flexibility. The aspect tool is provided in the query link, which has no invasiveness to the code, high portability and replicability. In addition, the combination of manual correction mechanism and automatic translation ensures the translation quality and reduces the maintenance cost, so it has certain popularization value in the industry. BRIEF DESCRIPTION OF DRAWINGS
[0040] Figure 1 A data multilingual storage and query method flowchart is provided for the embodiment of the present application.
[0041] Figure 2 A translation step flowchart is provided for the embodiment of the present application.
[0042] Figure 3 A query step flowchart provided for the embodiment of the present application;
[0043] Figure 4 A data multilingual storage and query system structure schematic diagram provided for the embodiment of the present application. DETAILED DESCRIPTION
[0044] The technical solutions of the present application will be described in detail below with the aid of the accompanying drawings and specific embodiments. It should be understood that the specific features of the embodiments of the present application and the specific features in the embodiments are detailed descriptions of the technical solutions of the present application, and are not limitations of the technical solutions of the present application. In the case of no conflict, the technical features of the embodiments of the present application and the embodiments can be combined with each other.
[0045] It should be noted that the term "and / or" is only a description of the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent the three cases of A alone, A and B together, and B alone. In addition, the character " / " generally represents a "or" relationship between the associated objects before and after it.
[0046] Embodiment 1
[0047] The embodiment provides a data multilingual storage and query method, as shown in Figure 1 , specifically comprising the following steps:
[0048] According to the preset translation language configuration, a data view corresponding to each language is generated for each physical table. When the target field has a corresponding language translation result in the translation target table, the translation result corresponding to the language is preferentially returned. When the translation result does not exist, the original value of the field in the physical table is returned, that is, whether to translate will have a query result, and the translated result is preferentially displayed.
[0049] According to the requirement, the target field that needs to be translated in the physical table is configured;
[0050] In response to the data change in the physical table, for the target field that is configured to be changed and needs to be translated, a translation record is generated and stored to the translation target table;
[0051] The above data change includes an addition or editing operation, as shown in Figure 2 When the data change is monitored, it is identified and judged whether the field that has changed is configured as a target field that needs to be translated;
[0052] The field that is configured to need translation and whose values before and after the change are changed is translated and a translation record in an atomized manner is generated, and its translation state is marked as untranslated.
[0053] The untranslated translation record in the translation target table is automatically translated and the translation result is updated through a timing task, and the automatic translation comprises: timing scanning the translation target table, screening out the atomized record whose translation state is untranslated; calling a system translation service to translate the original value in the atomized record into a target value in a corresponding language; updating the target value obtained by translation to the atomized record, and marking the translation state as translated.
[0054] In response to a data query request, the query for the physical table is mapped to the corresponding data view according to the target language in the query request to return the translated result. As shown in Figure 3 The specific steps comprise:
[0055] Intercepting the query statement in the aspect of the data persistence layer;
[0056] Analyzing the query parameter to determine whether the target language parameter is contained in the query parameter;
[0057] When the target language parameter exists, the physical table name in the query statement is analyzed and replaced with the view name corresponding to the target language.
[0058] When the target language parameter is not contained in the query parameter, the query statement is released, the original query request is directly executed, and the table name replacement operation is not performed.
[0059] In the method mentioned in the embodiment, when the old translation result does not meet the requirement, the user can correct the translation result stored in the atomized manner through the artificial correction interface.
[0060] The embodiment provides an e-commerce scenario to specifically show the specific application of the data multilingual storage and query method.
[0061] Translation configuration and view generation:
[0062] Target field configuration: in the product (product) physical table, the administrator configures the product_name (product name) and description (description) as "need translation" and "allow correction".
[0063] Generating a data view: the system automatically generates corresponding data views for the product table according to the preset language, for example:
[0064] English view: product_view_en_us;
[0065] German view: product_view_de_de;
[0066] Japanese view: product_view_ja_ja;
[0067] The Chinese administrator adds a new product in the background, and the original information entered is:
[0068] product_name: Smart Thermos Cup.
[0069] description: An advanced mug that supports APP temperature control and 24-hour long-lasting insulation.
[0070] At this time, the data addition operation is captured by the system, and since the three fields are marked as "need translation", the system creates an atomic translation record in the target translation table for each target field of the new data record for each language (English, German, Japanese) in the "untranslated" state. At this time, the translation results of these records are empty or temporarily the original Chinese value. Taking the English translation atomic record as an example, as shown in Table 1.
[0071] Table 1 English translation atomic record
[0072]
[0073] The German and Japanese translation atomic records are in the same form as the English translation atomic record and are not described in detail. In this embodiment, the German and Japanese translations are correct, and taking the English translation as an example, the automatic translation and manual correction are explained.
[0074] The system's background timing task scans the translation target table every minute and finds these "untranslated" records, calls the system translation service (such as Google API), and translates the original Chinese into the target language in batches.
[0075] After translation, the system updates the translation results to the corresponding atomic record and marks the status as "translated".
[0076] The translation results are:
[0077] product_name: Smart Thermos Cup.
[0078] description: An advanced mug that supports APP temperature control and 24-hour long-lasting insulation.
[0079] The English operator found that the "Smart Thermos Cup" should be corrected to "Smart Vacuum Flask" in the e-commerce field, and the translation of the description should be corrected to "A high-tech vacuum flask featuring app-controlled temperature settings and 24-hour heat retention."
[0080] The English operator logs in to the e-commerce management background and enters the translation correction interface. Through screening, the physical table product is located, and the target language is selected as English (en_us);
[0081] The system presents all the atomized translation records of the configured fields under this record, that is, the English translation records of product_name and description.
[0082] The operator corrects the translation results, and the system immediately updates the translation results of the atomized records in the translation target table.
[0083] The translated records for other languages remain unchanged and are not affected. When the English user queries the product information, the system accesses the product_view_en_us view, and the view accurately obtains the corrected product name and description from the translation table.
[0084] When the English user accesses the system to query the product information, the application issues a standard SQL query statement:
[0085] sql
[0086] SELECT product_name,description FROM product WHERE id=736521106903007616;
[0087] In the data persistence layer, through the MyBatis plug-in, the system aspect automatically intercepts this query statement, parses the parameters of the query request, and identifies the user language environment as English (en_us);
[0088] The system parses the physical table name in the original query statement as product, and according to the identified target language en_us, the system automatically replaces the table name with the corresponding English data view product_view_en_us.
[0089] The query statement is replaced by:
[0090] sql
[0091] SELECT product_name,description FROM product_view_en_us WHERE id=736521106903007616;
[0092] Finally, the corrected English translation is returned: "Smart Vacuum Flask" and its detailed description "A high-tech vacuum flask featuring app-controlled temperature settings and 24-hour heat retention."
[0093] The English user sees accurate product information on his terminal, and the entire translation and query process is completely transparent to the front-end application, without the need to write additional code, achieving non-intrusive multilingual data query.
[0094] Embodiment 2
[0095] Based on the same inventive concept as Embodiment 1, this embodiment introduces a data multilingual storage and query system, as shown in Figure 4 , comprising:
[0096] a view management module for pre-building data views corresponding to multiple languages for physical tables in the database;
[0097] a field configuration module for configuring target fields in the physical tables that need to be translated;
[0098] a change response module for responding to data changes in the physical tables, generating translation records for target fields configured to change and needing translation and storing them in the translation target table;
[0099] an automatic translation module for automatically translating untranslated records in the translation target table and updating the translation results;
[0100] a query mapping module for responding to data query requests, mapping queries for physical tables to corresponding data views according to the target language in the query request to return translated results.
[0101] Among them, the change response module is configured with a new edit trigger unit for listening to data addition or editing operations in the physical table; the automatic translation module is configured with a translation result correction unit to provide a manual correction interface to receive corrections to the automatic translation results;
[0102] The system implements the method of any one of Embodiment 1, and is not described again.
[0103] Embodiment 3
[0104] Based on the same inventive concept as other embodiments, this embodiment introduces a computer readable storage medium, which stores computer programs / instructions, and the computer programs / instructions are executed by a processor to implement the steps of the data multi-language storage and query method in any one of Embodiment 1.
[0105] Embodiment 4
[0106] Based on the same inventive concept as other embodiments, this embodiment introduces a computer device, which includes a memory for storing computer programs;
[0107] A processor for executing the computer programs to implement the data multi-language storage and query method in any one of Embodiment 1.
[0108] The present application combines database view, translation field configuration, timing task and query statement interception, and builds a high-performance and easy-to-expand data multi-language solution. All translations are managed by translating target tables, ensuring the consistency of system data; the translation field can be configured without changing the physical model of the database, saving database storage space compared with copying all fields. Unified use of database view improves query efficiency; the target language only needs to add a language when configuring, and the system automatically generates a new view without modifying the existing physical table structure or core code, which is easy to expand and has high flexibility. The aspect tool is provided in the query link, which has no code invasion, high portability and replicability. In addition, the combination of manual correction mechanism and automatic translation ensures the translation quality and reduces the maintenance cost, so it has certain popularization value in the industry.
[0109] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the 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.
[0110] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks
[0111] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks
[0112] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks
[0113] The embodiments of the present application described above are merely intended to illustrate the present application, but not to limit the present application. The above-described embodiments are merely illustrative, and not restrictive, and those skilled in the art can make many modifications without departing from the spirit and scope of the present application, and these modifications are also within the scope of the present application.
Claims
1. A method for multilingual data storage and retrieval, characterized in that, include: Pre-build data views for physical tables in the database that correspond to multiple languages; Configure the target fields in the physical table that need to be translated; In response to data changes in the physical table, translation records are generated for the target fields that are configured to change and require translation, and stored in the translation target table. The untranslated records in the translation target table are automatically translated, and the translation results are updated. In response to a data query request, the query targeting the physical table is mapped to the corresponding data view based on the target language in the query request, so as to return the translated result.
2. The multilingual data storage and retrieval method according to claim 1, characterized in that, The data view is configured as follows: When the target field has a corresponding language translation result in the translation target table, the translation result is returned first. If the translation result does not exist, return the original value of the field in the physical table.
3. The multilingual data storage and retrieval method according to claim 1, characterized in that, The process of generating translation records and storing them in the translation target table includes: In response to add or edit operations on physical tables, identify the fields that have changed; When a field is configured to require translation and its value changes before and after the change, an atomic translation record is generated and stored in the translation target table, and its translation status is marked as untranslated.
4. The multilingual data storage and retrieval method according to claim 3, characterized in that, Automatic translation of untranslated records, including: The translation target table is scanned periodically to filter out records whose translation status is "not translated". Call the system translation service to translate the original values in the filtered records into values in the target language; The translation results are updated in the atomic record, and its translation status is marked as translated.
5. The multilingual data storage and retrieval method according to claim 1, characterized in that, The method further includes: It provides a manual correction interface, which receives corrections from users for the translation results in the translation target table, and updates the translation target table with the corrected results.
6. The multilingual data storage and retrieval method according to claim 1, characterized in that, The process of mapping queries against physical tables to corresponding data views includes: Intercept query requests at the aspect ratio of the data persistence layer; Parse the target language parameters in the query request; Based on the target language parameters, the physical table identifier in the query request is replaced with the data view identifier in the corresponding language.
7. The multilingual data storage and retrieval method according to claim 6, characterized in that, When the query request does not contain the target language parameter, the original query request is executed directly without performing the identifier replacement operation.
8. A multilingual data storage and retrieval system, characterized in that, include: The view management module is used to pre-build data views corresponding to multiple languages for physical tables in the database; The field configuration module is used to configure the target fields in the physical table that need to be translated; The change response module is used to respond to data changes in the physical table, generate translation records for target fields that are configured to change and need to be translated, and store them in the translation target table; An automatic translation module is used to automatically translate untranslated records in the translation target table and update the translation results; The query mapping module is used to respond to data query requests by mapping queries against physical tables to corresponding data views based on the target language in the query request, so as to return translated results.
9. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the data multilingual storage and retrieval method according to any one of claims 1 to 7.
10. A computer device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the data multilingual storage and retrieval method according to any one of claims 1-7.