A page translation method based on multiple languages

By introducing translation aspects and multilingual libraries into the page translation solution for the rail transit sector, the problem of high program coupling was solved, non-intrusive translation was achieved, dynamic vocabulary management was supported, and the flexibility and efficiency of translation were improved.

CN112559106BActive Publication Date: 2025-01-10GUANGXI JIAOKONG ZHIWEI TECH DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011550040.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-24
Publication Date
2025-01-10
Estimated Expiration
2040-12-24

AI Technical Summary

Technical Problem

In existing technologies, page translation solutions in the rail transit field are highly coupled with the program, requiring developers to prepare all dictionaries in advance, and to re-code when the translation is inaccurate or omits words, resulting in long-term maintenance difficulties.

Method used

This paper provides a multilingual page translation method. By receiving requests from the front-end page to the back-end business interface, it uses translation aspects and multilingual library tables to achieve dynamic translation. It supports the non-intrusive addition and modification of vocabulary without requiring any changes to the program.

Benefits of technology

It enables the dynamic addition or modification of translation vocabulary without modifying the program, supports multilingual translation, reduces development and maintenance difficulty, and improves translation flexibility and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112559106B_ABST
    Figure CN112559106B_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure provide a multi-language-based page translation method, apparatus, device, and computer-readable storage medium. The method includes receiving request background business interface information sent by a front-end page; wherein the request background business interface information is received by the business interface from the front-end page and forwarded to the translation aspect; matching is performed according to the business interface url in the request background business interface information; if the match is successful, the corresponding business interface method is called to query the data in the database; the return value generated by the database according to the query is intercepted, and the entries in the return value are translated; the translated return value is returned to the front-end page for display. In this way, the entries in the front-end page can be converted into the target language and displayed, allowing people from different countries to use various rail transit monitoring systems smoothly.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure generally relate to the field of rail transportation, and more specifically, to a multi-language-based page translation method, apparatus, device, and computer-readable storage medium. Background Art

[0002] Currently, the more popular web (World Wide Web) internationalization solution is i18n (internationalization), which requires writing a properties file for each language and specifying the key and value. The program dynamically obtains the dictionary in which properties file by judging the current system language environment. This method is highly coupled with the program and requires developers to prepare all the dictionaries to be translated in advance, and the program needs to read the specified key to obtain the corresponding value.

[0003] In the field of rail transit, due to the large amount of vocabulary that needs to be translated and the high degree of professionalism, when users feel that a certain word is not translated accurately or that they did not consider all aspects when developing the software and missed some words, they need to re-encode when making modifications, which is not conducive to long-term maintenance. Summary of the invention

[0004] According to an embodiment of the present disclosure, a multi-language based page translation solution is provided.

[0005] In a first aspect of the present disclosure, a multi-language page translation method is provided. The method comprises:

[0006] Receive the request background business interface information sent by the front-end page; wherein the request background business interface information is received by the business interface from the front-end page and forwarded to the translation aspect;

[0007] Matching is performed according to the service interface URL in the request background service interface information;

[0008] If the match is successful, the corresponding business interface method is called to query the data in the database;

[0009] Intercepting the return value generated by the database according to the query, and translating the terms in the return value;

[0010] The translated return value is returned to the front-end page for display.

[0011] Further, matching according to the service interface url in the request background service interface information includes:

[0012] If the match is unsuccessful, the corresponding business interface method is called to query the data in the database; the database directly sends the return value generated by the query to the front-end page.

[0013] Furthermore, the calling of the corresponding business interface method to query the data in the database includes:

[0014] The corresponding business interface method is called through reflection technology to query the data in the database.

[0015] Furthermore, intercepting the return value generated by the database according to the query and translating the terms in the return value includes:

[0016] Intercepting a return value generated by the database according to the query, and determining a type of the return value;

[0017] According to the type of the return value, the terms in the return value are translated into a target language.

[0018] Furthermore, translating the entry in the return value into a target language according to the type of the return value includes:

[0019] If the type of the return value is a string, the target language corresponding to the entry in the return value is directly queried from the multi-language library table in the multi-language library and replaced;

[0020] If the type of the return value contains nested attributes, the return value is recursively processed, and each attribute value in the return value is recursively traversed until the traversed attribute values ​​do not contain nested attributes, and then the target language corresponding to the entry in the return value is queried from the multi-language library table in the multi-language library and replaced; the multi-language library table contains all target languages ​​corresponding to the entry in the return value.

[0021] Furthermore, the request background business interface information is received by the business interface from the front-end page and forwarded to the translation aspect, including:

[0022] The business interface receives the request background business interface information sent by the front-end page through the http request, and forwards it to the translation aspect.

[0023] Furthermore, it also includes:

[0024] According to user operations, entries in the multi-language library table are added, deleted, searched, modified, batch imported and / or batch exported.

[0025] In a second aspect of the present disclosure, a multi-language page translation device is provided. The device comprises:

[0026] A receiving module, used to receive the request background business interface information sent by the front-end page; wherein the request background business interface information is received by the business interface from the front-end page and forwarded to the translation aspect;

[0027] A matching module, used to match the service interface URL in the request background service interface information;

[0028] The query module is used to call the corresponding business interface method to query the data in the database if the match is successful;

[0029] A translation module, used to intercept the return value generated by the database according to the query, and translate the entries in the return value;

[0030] The processing module is used to return the translated return value to the front-end page for display.

[0031] In a third aspect of the present disclosure, an electronic device is provided, which includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the program, the method described above is implemented.

[0032] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method according to the first aspect of the present disclosure is implemented.

[0033] The multi-language page translation method provided in the embodiment of the present application receives request background business interface information sent by the front-end page; wherein the request background business interface information is received from the front-end page by the business interface and forwarded to the translation aspect; matching is performed according to the business interface URL in the request background business interface information; if the match is successful, the corresponding business interface method is called to query the data in the database; the return value generated by the database according to the query is intercepted, and the entries in the return value are translated; the translated return value is returned to the front-end page for display, thereby realizing the function of adding and modifying vocabulary at any time according to one's own needs while translating the page without changing the program (no need to re-encode).

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

[0035] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:

[0036] Figure 1 A flowchart of a multi-language rail transit comprehensive monitoring method according to an embodiment of the present disclosure is shown;

[0037] Figure 2 ab shows a data processing logic diagram of a multi-language page translation method according to an embodiment of the present disclosure;

[0038] Figure 3 A translation effect diagram of a multi-language page translation method according to an embodiment of the present disclosure is shown;

[0039] Figure 4 A schematic diagram of a translation management interface of a multi-language page translation method according to an embodiment of the present disclosure is shown.

[0040] Figure 5 A logic diagram of a specific embodiment of a multi-language page translation method according to an embodiment of the present disclosure is shown;

[0041] Figure 6 A block diagram of a multi-language page translation device according to an embodiment of the present disclosure is shown;

[0042] Figure 7 A block diagram of an exemplary electronic device capable of implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0044] In addition, the term "and / or" in this article is only a description of the association relationship between the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0045] Figure 1 A flowchart of a multi-language page translation method 100 according to an embodiment of the present disclosure is shown. The method 100 includes:

[0046] S110, receiving the request background business interface information sent by the front-end page.

[0047] The request background business interface information is received by the business interface from the front-end page and forwarded to the translation aspect.

[0048] Furthermore, the business interface can receive the request background business interface information sent by the front-end page through the http request, and forward it to the translation aspect.

[0049] Optionally, the front-end page may be an H5 interface, etc. That is, a page implemented in accordance with the HTML5 standard.

[0050] Optionally, the translation aspect can be written using AOP technology. The translation aspect contains the URL of the business interface to be intercepted, that is, the URL of the business interface that needs to operate the multi-language library. For example, adding a business data (entry) interface, deleting a business data (entry) interface, etc.

[0051] Optionally, the request background business interface information includes the corresponding business interface url.

[0052] S120: Matching is performed according to the service interface URL in the request background service interface information.

[0053] The business interface url in the request background business interface information is matched with the url pre-stored in the translation aspect.

[0054] S130: If the match is successful, the corresponding business interface method is called to query the data in the database.

[0055] If the match is successful, that is, the translation aspect contains the URL of the business interface, the corresponding business interface method is called through reflection technology (an important mechanism in .NET) to query the data in the database.

[0056] S140, intercepting the return value generated by the database according to the query, and translating the terms in the return value.

[0057] Alternatively, if Figure 2 As shown in a:

[0058] Intercepting a return value (business data) generated by the database according to the query, and determining the type of the return value;

[0059] If the type of the return value is a string, the target language corresponding to the entry in the return value is directly queried from the multi-language library table in the multi-language library and replaced;

[0060] If the type of the return value contains nested attributes, such as JsonArray, JsonObject type, etc., the return value is recursively processed, and each attribute value in the return value is recursively traversed until the traversed attribute value does not contain nested attributes. Then, the target language corresponding to the entry in the return value is queried from the multilingual library table in the multilingual library and replaced. That is, the data containing nested attributes (json format data) is recursively replaced.

[0061] S150, returning the translated return value to the front-end page for display.

[0062] Optionally, the translated return value is returned to the front-end page for display. That is, all business data is translated into the target language and then returned to the front-end page for display, such as Figure 3 as shown (the target language is Vietnamese).

[0063] Embodiments of the present disclosure also include:

[0064] Alternatively, if Figure 2 As shown in b:

[0065] Matching is performed according to the service interface URL in the request background service interface information. If the match fails, that is, the translation aspect does not contain the URL of the service interface (e.g., the login service interface), the corresponding service interface method is called through reflection technology to query the data in the database without intercepting the return value. That is, the return value is directly returned to the front-end page (e.g., login verification) without passing through the translation aspect.

[0066] Optionally, the multi-language database may be a MYSQL relational database. The multi-language database table in the multi-language database includes all target languages ​​corresponding to the fields in the return value.

[0067] Optionally, the structure of the multi-language library table is shown in the following table:

[0068]

[0069] Alternatively, if Figure 4 As shown, according to user operations, the entries in the multilingual library table are added, deleted, searched, modified, batch imported and / or batch exported in the multilingual management interface. The user operations include adding, deleting, searching, modifying, importing (batch importing) and / or exporting (batch exporting).

[0070] Optionally, the multilingual management interface can be produced using Java programming technology (SSM framework and SQL language) and front-end technology (JS, H5, etc.).

[0071] Furthermore, one-time import (batch import) can be performed through Excel spreadsheet template.

[0072] It should be noted that all entries in this disclosure need to be stored in the cache. Adding, modifying, and deleting entries requires synchronization with the cache. When performing a query, the cache can be read directly to increase the query speed.

[0073] The following is a translation method according to a specific embodiment of the present invention. Figure 5 As shown:

[0074] Take the translation of the Chinese field "Trackside Electronic Unit" in the front-end page into Vietnamese (target language) as an example:

[0075] a. The user sends an http request to the business interface through the H5 page to request the background business interface information, and the background business interface receives the information and forwards it to the translation aspect.

[0076] b. The translation section receives the request background business interface information, and matches the business interface URL in the request background business interface information with the URL pre-stored in the translation section.

[0077] c. After the match is successful, that is, the URL of the business interface is stored in the translation section, the translation section calls the business interface method through reflection technology to query the Chinese field "trackside electronic unit" that needs to be converted in the database.

[0078] d. The translation aspect intercepts the return value generated by the database according to the query, and the return value is:

[0079]

[0080] The type of the return value is a string "trackside electronic unit". The Vietnamese corresponding to the entry "trackside electronic unit" in the return value is directly queried from the multi-language library table in the multi-language library and replaced, as shown below:

[0081]

[0082]

[0083] e. The translation section sends the translated return value to the H5 interface, and the H5 interface receives the translated return value and renders it. That is, replace the Chinese field "trackside electronic unit" in the H5 page with Vietnamese and display it.

[0084] Taking the above translation of the Chinese field "Trackside Electronic Unit" as an example, all Chinese fields in the H5 page can be replaced with Vietnamese (target language), refer to Figure 3.

[0085] According to the embodiments of the present disclosure, the following technical effects are achieved:

[0086] The solution disclosed in this disclosure is non-invasive. During use, the translation function of the entire system can be realized without the need for developers to modify the program. At the same time, this disclosure supports dynamic addition of language libraries. Users can modify (add, delete, check, modify) the system multi-language management interface according to their own needs, and display the modification effect in real time.

[0087] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the order of the actions described, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.

[0088] The above is an introduction to the method embodiment. The following is a further explanation of the scheme disclosed in the present invention through an apparatus embodiment.

[0089] Figure 6 FIG. 6 is a block diagram of a multi-language page translation device 600 according to an embodiment of the present disclosure. Figure 6 As shown, the device 600 includes:

[0090] The receiving module 610 is used to receive the request background business interface information sent by the front-end page; wherein the request background business interface information is received by the business interface from the front-end page and forwarded to the translation aspect;

[0091] A matching module 620 is used to match the service interface URL in the request background service interface information;

[0092] The query module 630 is used to call the corresponding business interface method to query the data in the database if the match is successful;

[0093] A translation module 640, configured to intercept the return value generated by the database according to the query and translate the terms in the return value;

[0094] The processing module 650 is used to return the translated return value to the front-end page for display.

[0095] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the described module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0096] Figure 7 A schematic block diagram of an electronic device 700 that can be used to implement an embodiment of the present disclosure is shown. As shown, the device 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 702 or loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The CPU 701, ROM 702, and RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0097] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0098] The processing unit 701 executes the various methods and processes described above. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709 .

[0099] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip systems (SOCs), load programmable logic devices (CPLDs), and the like.

[0100] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

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

[0102] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain desired results. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination mode.

[0103] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A multi-language page translation method, applied to the translation aspect, characterized in that: include: Receive the request background business interface information sent by the front-end page; wherein the request background business interface information is received by the business interface from the front-end page and forwarded to the translation aspect; Matching is performed according to the service interface URL in the request background service interface information; If the match is successful, the corresponding business interface method is called to query the data in the database; Intercepting the return value generated by the database according to the query and translating the terms in the return value, including: Intercepting a return value generated by the database according to the query, and determining a type of the return value; If the type of the return value is a string, the target language corresponding to the entry in the return value is directly queried from the multi-language library table in the multi-language library and replaced; If the type of the return value includes nested attributes, the return value is recursively processed, each attribute value in the return value is recursively traversed until the traversed attribute value does not include nested attributes, and then the target language corresponding to the entry in the return value is queried from the multi-language library table in the multi-language library and replaced; the multi-language library table includes all target languages ​​corresponding to the entry in the return value; Returning the translated return value to the front-end page for display; If the match is unsuccessful, the corresponding business interface method is called to query the data in the database, and the database directly sends the return value generated by the query to the front-end page.

2. The method according to claim 1, characterized in that The calling of the corresponding business interface method to query the data in the database includes: The corresponding business interface method is called through reflection technology to query the data in the database.

3. The method according to claim 1, characterized in that: The request background business interface information is received by the business interface from the front-end page and forwarded to the translation aspect, including: The business interface receives the request background business interface information sent by the front-end page through the http request, and forwards it to the translation aspect.

4. The method according to claim 1, characterized in that Also includes: According to user operations, entries in the multi-language library table are added, deleted, searched, modified, batch imported and / or batch exported.

5. A multi-language page translation device, characterized in that: include: A receiving module, used to receive the request background business interface information sent by the front-end page; wherein the request background business interface information is received by the business interface from the front-end page and forwarded to the translation aspect; A matching module, used to match the service interface URL in the request background service interface information; A query module is used to call the corresponding business interface method to query the data in the database if the match is successful; and is also used to call the corresponding business interface method to query the data in the database if the match is unsuccessful; A translation module, used to intercept the return value generated by the database according to the query and translate the terms in the return value, including: Intercepting a return value generated by the database according to the query, and determining a type of the return value; If the type of the return value is a string, the target language corresponding to the entry in the return value is directly queried from the multi-language library table in the multi-language library and replaced; If the type of the return value includes nested attributes, the return value is recursively processed, each attribute value in the return value is recursively traversed until the traversed attribute value does not include nested attributes, and then the target language corresponding to the entry in the return value is queried from the multi-language library table in the multi-language library and replaced; the multi-language library table includes all target languages ​​corresponding to the entry in the return value; The processing module is used to return the translated return value to the front-end page for display; and is also used for the database to directly send the return value generated according to the query to the front-end page.

6. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the program, the method according to any one of claims 1 to 4 is implemented.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Method and device for translating WEB site

    CN106326213A

  • A WEB management system and method for translating text contents in multiple languages

    CN109828775A