Page display method, device, computer equipment and storage medium
By identifying and reading text tags during page loading, obtaining translation identifiers and replacing them with translated text, the high cost of multilingual display is solved, and low-cost multilingual support and rapid expansion is achieved.
Patent Information
- Application Number
- CN202111274454.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2041-10-29
AI Technical Summary
When developing application software that supports multilinguals, the existing technology needs to develop a set of pages for each language, which leads to high development and maintenance costs and is difficult to quickly expand the language.
By identifying and reading text tags during page loading, obtaining target translation identifiers, obtaining target translation text from pre-stored translation records, and replacing the original text tags, realizing multilingual display, only one set of pages needs to be developed and maintained.
It significantly reduces development and maintenance costs, supports rapid language expansion, improves software update efficiency, and reduces the need for multiple sets of pages.
Smart Images

Figure CN113900762B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a page display method, apparatus, computer device, and storage medium. Background Art
[0002] With the deepening of international exchanges, application software has gradually become internationalized. Therefore, when developing application software, it is necessary to consider the function of supporting multi-language display, that is, to be able to display the text content in the corresponding language in the page according to the user's language selection, so as to meet the needs of users with different language requirements.
[0003] In the related art, the implementation method for application software to support multi-language display is to develop multiple sets of software pages for different languages during the software development stage. When the user switches languages, the corresponding pre-developed page in the corresponding language is called for display.
[0004] However, the above implementation method for supporting multi-language display requires developing a corresponding set of pages for each supported language, and the upfront development and subsequent maintenance costs are relatively high. Summary of the Invention
[0005] Based on this, it is necessary to provide a page display method, apparatus, computer device, and storage medium for the above technical problems.
[0006] A page display method, the method includes:
[0007] Determine the target language for displaying the target page;
[0008] During the process of loading the target page, identify and read the text markers included in the target page; wherein, one of the text markers corresponds to a target text in the target page;
[0009] Obtain the target translation identifier corresponding to the target text based on the text marker;
[0010] According to the target language and the target translation identifier, obtain the target translation text corresponding to the target language and the target translation identifier from the pre-stored translation records;
[0011] Replace the text marker with the target translation text, and display the target page based on the target translation text.
[0012] In one embodiment, the obtaining the target translation identifier corresponding to the target text based on the text marker includes:
[0013] When the text marker contains a target translation identifier, obtain the target translation identifier included in the text marker.
[0014] In one embodiment, obtaining the target translation identifier corresponding to the target text based on the text mark includes:
[0015] When the text mark contains a target common field, obtaining the target common field included in the text mark; the target common field is used to reflect the content information of the target text;
[0016] Based on the target common field, obtaining the target translation identifier corresponding to the target common field from a pre-stored correspondence table between common fields and translation identifiers as the target translation identifier corresponding to the target text.
[0017] In one embodiment, the text mark contains a translation tag; identifying and reading the text mark included in the target page includes:
[0018] Identifying the translation tag included in the target page;
[0019] Based on the translation tag, reading the text mark including the translation tag.
[0020] In one embodiment, the text mark contains default text; wherein, the default text is the text in a preset default language corresponding to the target text; the method further includes:
[0021] Judging whether the target language is the default language;
[0022] If the target language is the default language, obtaining the default text included in the text mark; replacing the text mark with the default text, and displaying the target page based on the default text;
[0023] If the target language is not the default language, performing the step of obtaining the target translation identifier corresponding to the target text based on the text mark.
[0024] In one embodiment, the method further includes:
[0025] In response to a translation record adding instruction, obtaining the identity information of the current user, and generating a target translation identifier corresponding to the identity information;
[0026] In response to a language setting instruction, determining the target language to be added;
[0027] In response to a language setting instruction, obtaining the target translation text corresponding to the target language;
[0028] Store the target translation identifier, the target language, and the target translation text correspondingly to obtain a translation record.
[0029] In one embodiment, the text mark includes default text; the method further includes:
[0030] In the case where the target translation identifier corresponding to the target common field is not obtained, replace the text mark with the default text, and display the target page based on the default text; or,
[0031] In the case where the target translation text corresponding to the target language and the target translation identifier is not obtained, replace the text mark with the default text, and display the target page based on the default text.
[0032] In one embodiment, the target page is a Java server page; the translation label is a label in the Java server page.
[0033] A page display device, the device includes:
[0034] A determination module, configured to determine the target language for displaying the target page;
[0035] An identification module, configured to identify and read the text marks included in the target page during the process of loading the target page; wherein, one text mark corresponds to one target text in the target page;
[0036] A first acquisition module, configured to acquire the target translation identifier corresponding to the target text based on the text mark;
[0037] A second acquisition module, configured to acquire the target translation text corresponding to the target language and the target translation identifier from the pre-stored translation record according to the target language and the target translation identifier;
[0038] A display module, configured to replace the text mark with the target translation text, and display the target page based on the target translation text.
[0039] In one embodiment, the first acquisition module is specifically configured to:
[0040] In the case where the text mark includes a target translation identifier, acquire the target translation identifier included in the text mark.
[0041] In one embodiment, the first acquisition module is specifically configured to:
[0042] When the target common field is included in the text tag, obtain the target common field included in the text tag; the target common field is used to reflect the content information of the target text; based on the target common field, obtain the target translation identifier corresponding to the target common field from a pre-stored correspondence table between common fields and translation identifiers as the target translation identifier corresponding to the target text.
[0043] In one embodiment, the text tag includes a translation tag; the recognition module is specifically configured to:
[0044] Recognize the translation tag included in the target page; based on the translation tag, read the text tag including the translation tag.
[0045] In one embodiment, the text tag includes default text; wherein the default text is the text in a preset default language corresponding to the target text. The apparatus further includes:
[0046] A default language judgment module, configured to judge whether the target language is the default language.
[0047] A first replacement module, configured to, if the target language is the default language, obtain the default text included in the text tag; replace the text tag with the default text, and display the target page based on the default text;
[0048] A first trigger module, configured to, if the target language is not the default language, trigger the first obtaining module to execute the step of obtaining the target translation identifier corresponding to the target text based on the text tag.
[0049] In one embodiment, the apparatus further includes:
[0050] A translation identifier generation module, configured to, in response to a translation record addition instruction, obtain the identity information of the current user, and generate a target translation identifier corresponding to the identity information;
[0051] A target language addition module, configured to, in response to a language setting instruction, determine the target language to be added;
[0052] A translated text addition module, configured to, in response to a translated text setting instruction, obtain the target translated text corresponding to the target language;
[0053] A translation record storage module, configured to store the target translation identifier, the target language, and the target translated text in a corresponding manner to obtain a translation record.
[0054] In one embodiment, the apparatus further includes:
[0055] A second replacement module, configured to replace the text tag with the default text when the target translation identifier corresponding to the target common field is not obtained, and display the target page based on the default text; or, when the target translation text corresponding to the target language and the target translation identifier is not obtained, replace the text tag with the default text and display the target page based on the default text.
[0056] In one embodiment, the target page is a Java server page; and the translation tag is a tag in the Java server page.
[0057] A computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the following steps are implemented:
[0058] Determine the target language for displaying the target page;
[0059] During the process of loading the target page, identify and read the text tags included in the target page; wherein, one text tag corresponds to one target text in the target page;
[0060] Obtain the target translation identifier corresponding to the target text based on the text tag;
[0061] According to the target language and the target translation identifier, obtain the target translation text corresponding to the target language and the target translation identifier from the pre-stored translation records;
[0062] Replace the text tag with the target translation text, and display the target page based on the target translation text.
[0063] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the following steps are implemented:
[0064] Determine the target language for displaying the target page;
[0065] During the process of loading the target page, identify and read the text tags included in the target page; wherein, one text tag corresponds to one target text in the target page;
[0066] Obtain the target translation identifier corresponding to the target text based on the text tag;
[0067] Obtain a target translation text corresponding to the target language and the target translation identifier from pre-stored translation records according to the target language and the target translation identifier;
[0068] Replace the text tag with the target translation text, and display the target page based on the target translation text.
[0069] The above page display method, device, computer device and storage medium identify and read text tags included in the page during page loading, obtain a target translation identifier based on the text tags, and then obtain a target translation text corresponding to the target translation identifier and a pre-determined target language from pre-stored translation records. Then, replace the text tag with the target translation text and display based on the target translation text, thus enabling the display of the target page in the corresponding target language. This method only requires developing and maintaining a set of pages containing text tags, and then replacing the text tags by obtaining translation texts in corresponding languages from the translation records to achieve the function of supporting multiple languages. Therefore, this method does not require developing and maintaining multiple sets of pages, significantly reducing the development and maintenance costs. In addition, when expanding languages subsequently, this method can be achieved by adding translation records for the corresponding languages, without the need to re-develop a corresponding set of pages, enabling rapid language expansion, improving the software update efficiency, and further reducing the software update costs. Description of the Drawings
[0070] Figure 1 It is a schematic flowchart of a page display method in an embodiment;
[0071] Figure 2 It is a schematic flowchart of obtaining a target translation identifier in an embodiment;
[0072] Figure 3 It is a schematic flowchart of a page display method in a specific example;
[0073] Figure 4 It is a structural block diagram of a page display device in an embodiment;
[0074] Figure 5 It is an internal structure diagram of a computer device in an embodiment. Detailed Description of the Embodiment
[0075] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0076] First, before specifically introducing the technical solutions of the embodiments of the present application, the technical background or the evolution context based on which the embodiments of the present application are described will be introduced first. With the deepening of international exchanges, application software has gradually become internationalized. In order to meet the needs of users in different languages, when developing application software, it is necessary to consider its function of supporting multiple languages, that is, allowing users to switch languages as needed when using the application software, and the text content in the corresponding language will be displayed on the software page. In the related art, the implementation method for an application software to support multi-language display is to develop multiple sets of software pages for different languages during the software development stage. When the user switches languages, the corresponding pre-developed page of the language is called for display. However, this method requires developing a set of corresponding pages for each supported language, and during later maintenance, each set of pages needs to be maintained, resulting in relatively high development and maintenance costs. Based on this background, through long-term research and development and experimental verification, the applicant proposes the page display method of the present application, which not only reduces the development and maintenance costs, but also supports the rapid expansion of new languages and improves the software update efficiency. In addition, it should be noted that the applicant has put in a lot of creative labor in discovering the technical problems of the present application and the technical solutions introduced in the following embodiments.
[0077] The page display method provided by the present application can be applied to a terminal to implement WEB (World Wide Web) page display or APP (Application) page display. The terminal can be but is not limited to various personal computers, laptop computers, smart phones, tablet computers, and portable wearable devices.
[0078] In one embodiment, as Figure 1 shown, a page display method is provided. Taking the application of the method to a terminal for application software page display as an example, the method includes the following steps:
[0079] Step 101, determine the target language for displaying the target page.
[0080] Among them, the target language is one of the languages supported by the application software. For example, it can be Chinese (denoted as CN), English (denoted as EN), Japanese (denoted as JPN), etc. The application software may include multiple pages. The target page refers to the page to be loaded and displayed currently, and the target language refers to the language corresponding to the text in the page when the target page is displayed.
[0081] In implementation, the terminal can determine the target language for displaying the target page. For example, the terminal can, in response to a language selection instruction triggered by the user, determine the language selected by the user and determine it as the target language for displaying the target page; the terminal can also store the language pre-selected by the user and determine the pre-stored language as the target language; the terminal can also, when the user does not make a language selection, determine the current system language or the preset default language of the terminal as the target language.
[0082] Step 102, during the process of loading the target page, identify and read the text markers included in the target page.
[0083] Wherein, one text marker corresponds to one target text in the target page.
[0084] In implementation, when the terminal loads the target page, it can identify and read the text markers included in the program code of the page. The text marker is special information that has been pre-coded and can be identified and read by the terminal, and one text marker corresponds to one target text in the target page. In the embodiments of the present application, the program code of the target page may only include text markers and not include the target text corresponding to the text markers.
[0085] Step 103, obtain the target translation identifier corresponding to the target text based on the text marker.
[0086] In implementation, after the terminal reads the text marker, it can further obtain the target translation identifier based on the text marker. Among them, the target translation identifier corresponds one-to-one with the target text, and the target translation identifier can be used to indicate that the target text corresponding to it needs to be translated. For example, the target translation identifier can be CommonTag1, TranTag1, etc. The target page may include one or more texts, and the target text may be part or all of the texts in the target page, which can be set as needed.
[0087] Step 104, according to the target language and the target translation identifier, obtain the target translation text corresponding to the target language and the target translation identifier from the pre-stored translation records.
[0088] In implementation, the terminal can obtain the target translation text corresponding to the target language and the target translation identifier from the pre-stored translation records according to the target language determined in step 101 and the target translation identifier obtained in step 103. In an example, as shown in Table 1, the translation record can be a correspondence table including translation identifiers, languages, and translation texts corresponding to the languages. In this example, the terminal can obtain the corresponding translation text "Confirm" as the target translation text from the pre-stored Table 1 according to the determined target language (English in this example) and the target translation identifier (CommonTag1 in this example).
[0089] Table 1
[0090]
[0091] Step 105, replace the text tag with the target translation text and display the target page based on the target translation text.
[0092] In implementation, after the terminal obtains the target translation text, it can replace the text tag recognized in step 102 with the target translation text obtained in step 104 and display it based on the target translation text, that is, realize the page display in the corresponding target language.
[0093] In the above method of page display, by recognizing and reading the text tags included in the page during the page loading process, obtaining the target translation identifier based on the text tags, and then obtaining the target translation text corresponding to the target translation identifier and the pre-determined target language from the pre-stored translation records, and then replacing the text tags with the target translation text and displaying it based on the target translation text, the target page in the corresponding target language can be displayed. This method only needs to develop and maintain a set of pages including text tags, and then replace the text tags by obtaining the translation texts of the corresponding languages from the translation records to realize the function of supporting multiple languages. Therefore, this method does not need to develop and maintain multiple sets of pages, significantly reducing the development and maintenance costs. In addition, when expanding languages subsequently, this method can be realized by adding translation records for the corresponding languages, without having to develop a corresponding set of pages again, enabling rapid language expansion, improving the software update efficiency, and further reducing the software update cost.
[0094] In one embodiment, step 103 specifically includes the following steps: when the text tag contains the target translation identifier, obtain the target translation identifier contained in the text tag.
[0095] In implementation, when the terminal reads the text tag in step 102, it can further determine whether the text tag contains the target translation identifier. If the text tag contains the target translation identifier, the terminal can parse the text tag to extract the target translation identifier from the text tag.
[0096] In this embodiment, the pre-encoded text tag can contain a translation identifier. During the process of loading the page, the terminal can directly obtain the target translation identifier from the text tag, with high efficiency in obtaining the target translation identifier, and thus can quickly display the page.
[0097] In one embodiment, as Figure 2 shown, the process of obtaining the target translation identifier in step 103 specifically includes the following steps:
[0098] Step 201, when the text tag contains the target common field, obtain the target common field contained in the text tag; the target common field is used to reflect the content information of the target text.
[0099] In implementation, when the terminal reads the text tag in step 102, it can further determine whether the text tag contains a common field. If the text tag contains the target common field, the terminal can parse the text tag to extract the target common field from the text tag. The target common field is used to reflect the content information of the target text in the target page. For example, it can be the target text itself in a certain language. For example, for the target text "Confirm", the Chinese "Confirm" familiar to developers can be used as the target common field and pre-encoded in the text tag; it can also be part of the target text or an abbreviated text. For example, for the target text "Credit account balance (the corresponding English text is Credit account balance)", part of the text "loan balance" or the English abbreviation "CAB" can be used as the target common field and pre-encoded in the text tag.
[0100] Step 202, based on the target common field, obtain the target translation identifier corresponding to the target common field from the pre-stored correspondence table of common fields and translation identifiers as the target translation identifier corresponding to the target text.
[0101] In implementation, the terminal queries the translation identifier corresponding to the target common field in the pre-stored correspondence table of common fields and translation identifiers according to the target common field obtained in step 201 to obtain the target translation identifier. In one example, the correspondence table of common fields and translation identifiers is shown in Table 2.
[0102] Table 2
[0103] Common fields Translation identifier Confirm CommonTag1 Cancel CommonTag2 CAB TranTag1
[0104] In this embodiment, the text tag can include commonly used field information. When the developer writes the text tag in the target page, he can directly write the corresponding target commonly used field according to the content of the target text. There is no need to search for the corresponding target translation identifier through the target text, which can improve the page development efficiency and reduce the development cost.
[0105] In one embodiment, the text tag includes a translation tag; the process of identifying and reading the text tag included in the target page in step 102 includes the following steps: identifying the translation tag included in the target page; and reading the text tag including the translation tag based on the translation tag.
[0106] In implementation, the text tag may include a translation tag. During the process of loading the target page, the terminal may identify the translation tag included in the target page, thereby identifying the text tag including the translation tag, and then read the text tag. By setting the tag as an identifier for identifying the text tag, the text tag may be accurately identified.
[0107] In one embodiment, the target page is a Java server page, and the translation tag is a tag in the Java server page.
[0108] In implementation, the target page can be a page developed using JSP (Java Server Pages), and the translation tag contained in the text tag can be a tag in JSP (i.e., a JSP tag), and the JSP tag is a tag defined by Taglib (JSP tag definition instruction). In one example, "icbc: translate" is pre-defined as a translation tag, and the tag is defined to have two available attributes, namely, a translation identifier attribute (marked as translate Tag) and a common field attribute (marked as des), and different attributes correspond to different types of tags. Specifically, a tag containing a translation identifier is a tag of a translation identifier attribute, and a tag containing a common field is a tag of a common field attribute. In this example, the terminal recognizes two text tags contained in the target page, which are:
[0109] Text Tag 1 (label for the translation identifier attribute):
[0110] <icbc:translate translate Tag=“TranTag1” / >
[0111] Text tag 2 (label for common field attributes):
[0112] <icbc:translate des=“确认” / >
[0113] When the terminal recognizes text marker 1 by identifying the translation tag, it can further determine that the text marker contains the target translation identifier according to the "translate Tag" information in the text marker, and obtain "TranTag1" as the target translation identifier; when the terminal recognizes text marker 2 by identifying the translation tag, it can further determine that the text marker contains the target common field according to the "des" information in the text marker, and obtain "confirmed" as the target common field.
[0114] In this embodiment, the terminal can identify the JSP translation tags in the target page while gradually loading the JSP target page, that is, it can identify the text markers containing the translation tags, avoiding the need to separately use other page scanning tools to scan and identify the text markers on the target page, which can significantly improve the efficiency of identifying text markers and thus improve the page display efficiency.
[0115] In one embodiment, the text marker contains default text, where the default text is the text in the preset default language corresponding to the target text; the method further includes the following steps: determining whether the target language is the default language. If the target language is the default language, obtain the default text contained in the text marker; replace the text marker with the default text, and display the target page based on the default text; if the target language is not the default language, perform the step of obtaining the target translation identifier corresponding to the target text based on the text marker.
[0116] In implementation, after determining the target language in step 101, the terminal can further determine whether the target language is the preset default language. This step can be before step 102 or after step 102, which is not limited in this embodiment. The text markers included in the target page can contain default text, that is, the text in the default language corresponding to the target text. If the target language is the default language, the terminal can obtain the default text contained in the text marker after step 102, then replace the text marker with the default text, and display the target page based on the default text; if the target language is not the default language, perform the step of obtaining the target translation identifier corresponding to the target text based on the text marker (i.e., step 103). For example, it can be defined that the JSP tag also has a default text (marked as Message) attribute, the preset default language is Chinese, and a text marker in an example is:
[0117] <icbc:translate translate Tag="TranTag1" Message="Credit account balance" / >
[0118] Among them, "Credit account balance" is the default text.
[0119] In this embodiment, the text tag may include default text corresponding to the default language. When the target language is the default language, the default text can be directly obtained from the text tag for display. Compared with obtaining text from the translation record according to the target translation identifier, the efficiency of obtaining text in this embodiment is higher, thereby improving the page display efficiency.
[0120] In one embodiment, the method further includes the following steps: in response to a translation record addition instruction, obtain the identity information of the current user and generate a target translation identifier corresponding to the identity information; in response to a language setting instruction, determine the target language to be added; in response to a language setting instruction, obtain the target translation text corresponding to the target language; store the target translation identifier, the target language, and the target translation text correspondingly to obtain a translation record.
[0121] In implementation, the user can perform a translation record addition operation on the terminal. Correspondingly, the terminal can receive a translation record addition instruction. Among them, the user can be a developer or maintainer of the application software, and users with different identity information can correspond to different types of translation identifiers. For example, users in different business departments can use translation identifiers with different prefixes. After the terminal receives the translation record addition instruction, it can obtain the identity information of the current user, and determine the target translation identifier prefix corresponding to the identity information of the current user according to the correspondence between the identity information and the translation identifier prefix, and generate a target translation identifier based on the target translation identifier prefix.
[0122] The terminal can also determine the target language to be added in response to a language setting instruction triggered by the current user, and obtain the target translation text entered by the current user in response to a translation text setting instruction. Then, the terminal can store the target translation identifier, the target language, and the target translation text correspondingly, that is, obtain a translation record.
[0123] In this embodiment, different types of translation identifiers are generated according to users with different identity information. When maintaining the page, if problems such as inaccurate text translation are found in the page display, the responsible business department can be quickly located through the translation identifier type in the text tag, and a translation identifier corresponding to the identity information of the current user can be automatically generated, which can improve the efficiency of adding translation records.
[0124] In one embodiment, the text tag includes default text; the method further includes the following steps: in the case where the target translation identifier corresponding to the target common field is not obtained, replace the text tag with the default text and display the target page based on the default text. Or, in the case where the target translation text corresponding to the target language and the target translation identifier is not obtained, replace the text tag with the default text and display the target page based on the default text.
[0125] In implementation, the text tag may contain default text. If the terminal fails to obtain the target translation identifier corresponding to the target common field in step 202, the terminal may replace the text tag with the default text and display the target page based on the default text. If the terminal fails to obtain the target translation text corresponding to the target language and the target translation identifier in step 104, the terminal may replace the text tag with the default text and display the target page based on the default text.
[0126] In this embodiment, when the terminal fails to obtain the target translation identifier or the target translation text (i.e., translation fails), the terminal can obtain the default text in the text tag for display, which can avoid the situation of displaying a blank page.
[0127] In a specific example, as Figure 3 shown, a method for page display is provided. In this example, the text tag includes at least one of a translation identifier and a common field, and the text tag also includes the default text for the corresponding default language. The method includes the following steps:
[0128] Step 301, determine the target language for displaying the target page.
[0129] Step 302, during the process of loading the target page, identify and read the text tags included in the target page.
[0130] Step 303, determine whether the target language is the preset default language.
[0131] If so, execute step 309; otherwise, execute step 304.
[0132] Step 304, determine whether the text tag contains the target translation identifier.
[0133] If so, execute step 305; otherwise, execute step 308.
[0134] Step 305, obtain the target translation identifier included in the text tag.
[0135] Step 306, according to the target language and the target translation identifier, obtain the target translation text corresponding to the target language and the target translation identifier from the pre-stored translation records.
[0136] If the target translation text is obtained, execute step 307; otherwise, execute step 309.
[0137] Step 307, when the target translation text is obtained, replace the text tag with the target translation text and display the target page based on the target translation text.
[0138] Step 308: Obtain the target common fields included in the text tag, and in the pre-stored correspondence table between common fields and translation identifiers, obtain the target translation identifier corresponding to the target common field.
[0139] If the target translation identifier is obtained, execute Step 306; otherwise, execute Step 309.
[0140] Step 309: Obtain the default text in the text tag, replace the text tag with the default text, and display the target page based on the default text.
[0141] This application also provides three application scenarios when using the above specific examples for page display.
[0142] Scenario 1:
[0143] The target language is the default language. During the process of loading the page, the terminal sequentially recognizes text tag 1 and text tag 2 included in the target page. The execution path of this page display includes two stages:
[0144] Stage 1 (recognizing text tag 1):
[0145] Step 301 → Step 302 → Step 303 → Step 309
[0146] Stage 2 (recognizing text tag 2):
[0147] Following Stage 1 → Step 302 → Step 303 → Step 309
[0148] Scenario 2:
[0149] The target language is not the default language. During the process of loading the page, the terminal sequentially recognizes three text tags included in the target page. Among them, text tag 1 contains the target translation identifier, text tag 2 contains the target common field and does not contain the target translation identifier, text tag 3 contains the target translation identifier, and the target translation identifier can be obtained based on the target common field, and the target translation text can be obtained. The execution path of this page display includes three stages:
[0150] Stage 1 (recognizing text tag 1):
[0151] Step 301 → Step 302 → Step 303 → Step 304 → Step 305 → Step 306 → Step 307
[0152] Stage 2 (recognizing text tag 2):
[0153] Following Stage 1 → Step 302 → Step 303 → Step 308 → Step 306 → Step 307
[0154] Phase 3 (Text Marker 3 recognized):
[0155] Following Phase 2 → Step 302 → Step 303 → Step 304 → Step 305 → Step 306 → Step 307
[0156] Scenario Three:
[0157] The target language is not the default language. During the process of loading the page, the terminal sequentially recognizes 2 text markers included in the target page. Among them, Text Marker 1 contains the target translation identifier, Text Marker 2 contains the target common fields and does not contain the target translation identifier. The target translation identifier is not obtained based on the target common fields, and the target translation text is not obtained. The execution path displayed on this page includes 2 phases:
[0158] Phase 1 (Text Marker 1 recognized):
[0159] Step 301 → Step 302 → Step 303 → Step 304 → Step 305 → Step 306 → Step 309
[0160] Phase 2 (Text Marker 2 recognized):
[0161] Following Phase 1 → Step 302 → Step 303 → Step 308 → Step 306 → Step 309
[0162] It should be understood that although Figures 1 - 3 the steps in the flowchart are sequentially shown according to the indication of the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise clearly stated in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, Figures 1 - 3 at least a part of the steps in
[0163] In one embodiment, as Figure 4 shown, a page display device is provided, including: a determination module 401, an identification module 402, a first acquisition module 403, a second acquisition module 404, and a display module 405, where:
[0164] The determination module 401 is used to determine the target language for displaying the target page.
[0165] An identification module 402, configured to identify and read text markers included in a target page during the process of loading the target page; wherein, one text marker corresponds to one target text in the target page.
[0166] A first acquisition module 403, configured to acquire a target translation identifier corresponding to the target text based on the text marker.
[0167] A second acquisition module 404, configured to acquire a target translation text corresponding to the target language and the target translation identifier from pre-stored translation records according to the target language and the target translation identifier.
[0168] A display module 405, configured to replace the text marker with the target translation text and display the target page based on the target translation text.
[0169] In one embodiment, the first acquisition module 403 is specifically configured to:
[0170] When the text marker includes the target translation identifier, acquire the target translation identifier included in the text marker.
[0171] In one embodiment, the first acquisition module 403 is specifically configured to:
[0172] When the text marker includes a target common field, acquire the target common field included in the text marker; the target common field is used to reflect the content information of the target text; based on the target common field, acquire the target translation identifier corresponding to the target common field from a pre-stored correspondence table between common fields and translation identifiers as the target translation identifier corresponding to the target text.
[0173] In one embodiment, the text marker includes a translation label; the identification module 402 is specifically configured to:
[0174] Identify the translation label included in the target page; based on the translation label, read the text marker including the translation label.
[0175] In one embodiment, the text marker includes default text; wherein, the default text is the text in a preset default language corresponding to the target text. The apparatus further includes:
[0176] A default language judgment module, configured to judge whether the target language is the default language.
[0177] A first replacement module, configured to, if the target language is the default language, acquire the default text included in the text marker; replace the text marker with the default text and display the target page based on the default text.
[0178] A trigger module, configured to trigger the first acquisition module 403 to execute the step of acquiring a target translation identifier corresponding to the target text based on the text tag if the target language is not the default language.
[0179] In one embodiment, the apparatus further includes:
[0180] A translation identifier generation module, configured to acquire the identity information of the current user in response to a translation record addition instruction, and generate a target translation identifier corresponding to the identity information.
[0181] A target language addition module, configured to determine a target language to be added in response to a language setting instruction.
[0182] A translated text addition module, configured to acquire a target translated text corresponding to the target language in response to a translated text setting instruction.
[0183] A translation record storage module, configured to store the target translation identifier, the target language, and the target translated text correspondingly to obtain a translation record.
[0184] In one embodiment, the apparatus further includes:
[0185] A second replacement module, configured to replace the text tag with a default text and display the target page based on the default text if a target translation identifier corresponding to the target common field is not acquired; or, replace the text tag with a default text and display the target page based on the default text if a target translated text corresponding to the target language and the target translation identifier is not acquired.
[0186] In one embodiment, the target page is a Java server page; the translation tag is a tag in the Java server page.
[0187] For the specific limitations of the page display apparatus, reference may be made to the limitations on the page display method in the foregoing text, which will not be elaborated herein. Each module in the foregoing page display apparatus may be implemented in whole or in part by software, hardware, and their combination. The foregoing modules may be embedded in or independent of a processor in a computer device in the form of hardware, or stored in a memory in the computer device in the form of software, so as to facilitate the processor to call and execute the operations corresponding to the foregoing modules.
[0188] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as Figure 5As shown in the figure. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner, and the wireless manner can be achieved through WIFI, carrier network, NFC (Near Field Communication) or other technologies. When the computer program is executed by the processor, it realizes a page display method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0189] Those skilled in the art can understand that Figure 5 the structure shown in the figure is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0190] In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are realized.
[0191] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, the steps in the above method embodiments are realized.
[0192] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0193] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0194] The above-described embodiments merely represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the appended claims.
Claims
1. A page display method, characterized in that, The method includes: Determine the target language for displaying the target page; During the process of loading the target page, identify and read the text markers included in the target page; wherein, one of the text markers corresponds to one target text in the target page; wherein, the text marker is pre-encoded special information; When the target common field is included in the text marker, obtain the target common field included in the text marker; the target common field is used to reflect the content information of the target text in the target page; the target common field is pre-encoded in the text marker; the target common field includes partial text or abbreviated text in the target text; Based on the target common field, obtain the target translation identifier corresponding to the target common field from the pre-stored correspondence table between common fields and translation identifiers as the target translation identifier corresponding to the target text; According to the target language and the target translation identifier, obtain the target translation text corresponding to the target language and the target translation identifier from the pre-stored translation records; wherein, the translation record is a correspondence table including translation identifiers, languages, and translation texts corresponding to the languages; Replace the text marker with the target translation text, and display the target page based on the target translation text; In response to the translation record addition instruction, obtain the identity information of the current user, determine the target translation identifier prefix corresponding to the identity information of the current user according to the correspondence between the identity information and the translation identifier prefix, and generate a target translation identifier based on the target translation identifier prefix; users in different business departments use translation identifiers with different prefixes; In response to the language setting instruction, determine the target language to be added; In response to the translation text setting instruction, obtain the target translation text corresponding to the target language; Store the target translation identifier, the target language, and the target translation text correspondingly to obtain a translation record.
2. The method according to claim 1, wherein The method further includes: When the target translation identifier is included in the text marker, obtain the target translation identifier included in the text marker.
3. The method according to claim 1, characterized in that The text marker includes a translation label; The identifying and reading the text markers included in the target page includes: Identify the translation label included in the target page; Based on the translation label, read the text marker including the translation label.
4. The method according to claim 1, characterized in that, The text marker includes default text; wherein, the default text is the text in the preset default language corresponding to the target text; The method further includes: Judge whether the target language is the default language; If the target language is the default language, obtain the default text included in the text marker; replace the text marker with the default text, and display the target page based on the default text; If the target language is not the default language, perform the step of obtaining the target translation identifier corresponding to the target text based on the text marker.
5. The method according to any one of claims 1, characterized in that, The text marker includes default text; The method further includes: In the case where the target translation identifier corresponding to the target common field is not obtained, replace the text mark with the default text, and display the target page based on the default text; or, In the case where the target translation text corresponding to the target language and the target translation identifier is not obtained, replace the text mark with the default text, and display the target page based on the default text.
6. The method according to claim 3, wherein The target page is a Java server page; the translation tag is a tag in the Java server page.
7. A page display device, characterized in that, The device includes: A determination module, configured to determine the target language for displaying the target page; An identification module, configured to identify and read the text marks included in the target page during the process of loading the target page; wherein, one text mark corresponds to one target text in the target page; wherein, the text mark is pre-coded special information; A first acquisition module, configured to, when the text mark includes a target common field, acquire the target common field included in the text mark; the target common field is used to reflect the content information of the target text in the target page; the target common field is pre-coded in the text mark; the target common field includes part of the text or an abbreviated text in the target text; based on the target common field, obtain the target translation identifier corresponding to the target common field from a pre-stored correspondence table between common fields and translation identifiers, as the target translation identifier corresponding to the target text; A second acquisition module, configured to, according to the target language and the target translation identifier, acquire the target translation text corresponding to the target language and the target translation identifier from pre-stored translation records; wherein, the translation record is a correspondence table including translation identifiers, languages, and translation texts corresponding to the languages; A display module, configured to replace the text mark with the target translation text, and display the target page based on the target translation text; A translation identifier generation module, configured to, in response to a translation record addition instruction, acquire the identity information of the current user, and determine the target translation identifier prefix corresponding to the identity information of the current user according to the correspondence between the identity information and the translation identifier prefix, and generate a target translation identifier based on the target translation identifier prefix; users in different business departments use translation identifiers with different prefixes; A target language addition module, configured to, in response to a language setting instruction, determine the target language to be added; a translation text addition module, configured to, in response to a translation text setting instruction, acquire the target translation text corresponding to the target language; A translation record storage module, configured to store the target translation identifier, the target language, and the target translation text in a corresponding manner to obtain a translation record.
8. The device according to claim 7, characterized in that, The text mark includes a translation tag; the identification module is specifically configured to: identify the translation tags included in the target page; based on the translation tags, read the text marks including the translation tags.
9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Display page processing method, device and equipment and storage medium
CN111857903A
Page loading method and device, electronic equipment and storage medium
CN111857934A