Webpage processing method, device and system and storage medium

By loading translation resources by page and language classification, the existing technology problems of low loading efficiency of multi-language resources on WEB pages and unavailability of the business system during translation adjustment are solved, achieving efficient internationalization processing and improving user experience and response speed. .

CN118690098APending Publication Date: 2024-09-24ZHONGKE YUNGU TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410819285.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

In the existing technology, the multi-language resources of the WEB page are packaged in the form of static resources, which results in the need to load all resources when the user visits for the first time, which causes high network overhead. In addition, the front-end project needs to be repackaged during translation adjustments, resulting in temporary unavailability of the business system and poor user experience. decline.

Method used

By obtaining the target language, calling translation resources to translate and store page tags, and loading translation resources by page and language classification, the internationalization of the front-end interface is achieved, avoiding loading of all translation resources at once, and reducing network traffic consumption.

Benefits of technology

It realizes the internationalization of the front-end interface, reduces the loading time and network overhead of translation resources, improves the loading efficiency of translation resources, improves the user experience, and solves the problem of response speed when translation changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118690098A
    Figure CN118690098A
Patent Text Reader

Abstract

The invention discloses a webpage processing method, device and system and a storage medium. Comprising the steps that a target language for a first webpage is obtained, the first webpage comprises a plurality of first page tags, translation resources corresponding to the target language are called, each first page tag is translated into the target language, and translated page data are stored; loading a second webpage, and obtaining a second page tag included in the second webpage; under the condition that the translation language for the second webpage is the target language, detecting whether a second internationalization key which is the same as the first internationalization key exists or not; reading translation data corresponding to the first internationalization key which is the same as the second internationalization key from the translated page data, and taking the translation data as the translation data of the corresponding second page tag; and calling a translation resource to translate second page tags corresponding to other second internationalization keys into a target language. In this way, all translation resources do not need to be loaded at a time, flow consumption is reduced, and the loading efficiency of the translation resources is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a web page processing method, device, system and storage medium. Background Art

[0002] In a business system that needs to support international B / S structure, multilingual support for WEB pages is a very important task. There are many page tags, and the multilingual resource package covers a huge amount of language information. Moreover, these translations will also be adjusted with business adjustments. In the prior art, the language files of each language are packaged in the front-end project in the form of static resources. With the release of the project, users need to load all resource packages at once when using the system. However, in real situations, users only need to access part of the system interface and only use one language. Moreover, the current implementation method requires the project to be repackaged and launched when the translation is adjusted, resulting in the following problems. One is that users need to load all resources at once when they visit for the first time, which has a large network overhead, and most of the static language files are redundant, and will increase with the increase of resource files, resulting in an increase in loading time and a decrease in user experience. Another is that when the translation of the current page needs to be adjusted, the entire front-end project needs to be repackaged and released, and this process will cause the business system to be temporarily unusable. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a web page processing method, device, system and storage medium to solve the technical problem of loading all translation resources at once and large network overhead in the prior art.

[0004] In order to achieve the above-mentioned purpose, the first aspect of the present application provides a webpage processing method, the processing method comprising:

[0005] Obtaining a target language for a first webpage, the first webpage comprising a plurality of first page tags, wherein each first page tag corresponds to a first internationalization key;

[0006] Calling the translation resource corresponding to the target language, translating each first page tag into the target language, and storing the translated page data;

[0007] Loading a second webpage, and obtaining a second page tag included in the second webpage, wherein each second page tag corresponds to a second internationalization key;

[0008] In the case where the translation language for the second webpage is the target language, detecting whether there is a second internationalization key that is the same as the first internationalization key;

[0009] Reading the translation data of the first page label corresponding to the first internationalization key which is the same as the second internationalization key from the translated page data, and using it as the translation data of the second page label corresponding to the second internationalization key;

[0010] The translation resource is called to translate the second page labels corresponding to other second internationalization keys into the target language.

[0011] In an embodiment of the present application, calling the translation resources corresponding to the target language to translate each first page tag into the target language includes: obtaining the first page identifier and the first version identifier of the first web page, and the language identifier corresponding to the target language; searching the first internationalization key corresponding to each first page tag from the first database according to the first page identifier and the first version identifier, and each page tag in the first list corresponding to the first database corresponds to an internationalization key; for each first page tag, searching the second database for the translation resources corresponding to the first page tag and the target language according to the first internationalization key and the language identifier, and each internationalization key and each language identifier in the second list corresponding to the second database corresponds to a translation resource; for each first page tag, calling the translation resources corresponding to the target language from the second database to translate the first page tag into the target language.

[0012] In an embodiment of the present application, calling translation resources to translate second page labels corresponding to other second internationalization keys into a target language includes: searching a second database for translation resources corresponding to each other internationalization key and the target language according to each other internationalization key and the language identifier; calling the translation resources corresponding to the target language from the second database, and translating the second page labels corresponding to each other internationalization key into the target language.

[0013] In an embodiment of the present application, the processing method further includes: when a translation resource corresponding to any internationalization key in the second database is updated, determining a target page tag corresponding to the internationalization key to update a version identifier of a web page corresponding to the target page tag.

[0014] In an embodiment of the present application, reading the translation data of the first page label corresponding to the first internationalization key that is the same as the second internationalization key from the translated page data, and using it as the translation data of the second page label corresponding to the second internationalization key includes: obtaining the first version identifier of the first web page and the second version identifier of the second web page; detecting whether the first version identifier is the same as the second version identifier; when the first version identifier and the second version identifier are the same, reading the translation data of the first page label corresponding to the first internationalization key that is the same as the second internationalization key from the translated page data, and using it as the translation data of the second page label corresponding to the second internationalization key.

[0015] In an embodiment of the present application, the processing method further includes: when the first version identifier and the second version identifier are different, calling a translation resource to translate the second page label corresponding to each second internationalization key into a target language.

[0016] In an embodiment of the present application, the processing method also includes: after storing the translated page data, determining the number of page loads after the first web page; when the number of page loads is greater than or equal to a preset threshold and there is no second internationalization key that is the same as any first internationalization key, deleting the translated page data from the cache.

[0017] A second aspect of the present application is a web page processing device, comprising:

[0018] a memory configured to store instructions; and

[0019] The processor is configured to call instructions from the memory and implement the web page processing method according to the above when executing the instructions.

[0020] A third aspect of the present application provides a web page processing system, characterized in that it includes the above-mentioned web page processing device.

[0021] In an embodiment of the present application, the system also includes: a first database, the first database includes multiple page tags and multiple internationalization keys, each page tag in the first list corresponding to the first database corresponds to an internationalization key; a second database, the first database includes multiple internationalization keys and translation resources corresponding to multiple target languages, each internationalization key and the language identifier of each target language in the second list corresponding to the second database corresponds to a translation resource; a local database, used to store translated page data.

[0022] A fourth aspect of the present application provides a machine-readable storage medium, characterized in that the machine-readable storage medium stores instructions, which are used to enable a machine to execute the web page processing method described above.

[0023] Through the above technical solution, starting from the perspective of a single WEB page, the backend establishes a set of translation resource management methods by page. By classifying language resources by page and language and loading translation resource files from the server, the internationalization of the front-end interface is realized, and all translation resources do not need to be loaded at once, which reduces traffic consumption and improves the loading efficiency of translation resources.

[0024] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:

[0026] Figure 1 A schematic diagram schematically shows a flow chart of a method for processing a web page according to an embodiment of the present application;

[0027] Figure 2 A schematic diagram of a process of loading webpage translation resources according to an embodiment of the present application is shown;

[0028] Figure 3 A schematic diagram of the internationalization key generation and translation process according to an embodiment of the present application is shown;

[0029] Figure 4 A structural block diagram of a web page processing device according to an embodiment of the present application is schematically shown;

[0030] Figure 5 The structural block diagram of the web page processing system according to the embodiment of the present application is schematically shown;

[0031] Figure 6 The following schematically shows an architecture diagram of a web page processing system according to a specific embodiment of the present application;

[0032] Figure 7 The schematic diagram shows a structure of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0034] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0035] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0036] Figure 1 The following schematically shows a flow chart of a web page processing method according to an embodiment of the present application. Figure 1 As shown, the embodiment of the present application provides a web page processing method, which may include the following steps:

[0037] S102: Obtain a target language for a first webpage, where the first webpage includes a plurality of first page tags, wherein each first page tag corresponds to a first internationalization key.

[0038] The first web page refers to a web page, which is a graphical, easy-to-access, and intuitive interface for viewers to find and browse information on the Internet of Things. The page label refers to a prompt location, a fixed title, or a prompt set in the WEB interface to inform users of the specific meaning of the content. The internationalization key, also known as the internationalization identifier or internationalization label, is usually used to represent a string that needs to be translated. This key is used as a placeholder in the code so that it can be replaced with a corresponding localized string according to the user's language preference at runtime. The target language refers to the language category for the translation of the first web page. For example, the current language of the first web page is Chinese, and the target language into which the first page label of the first web page is translated can be, but is not limited to, English, German, Korean, etc., thereby completing the internationalization of the page label. Internationalization refers to the process of decoupling the software from a specific language and region when the software is ported to different language regions without making internal engineering changes or modifications to the software itself. According to the actual needs of the international cloud platform, web pages in different languages ​​are consistent in structure and business logic, except that the language in which information is displayed on each page is different. That is, the differences between web pages in different languages ​​are concentrated in the user interface (UI) layer. Requests from web pages in different language versions should be processed by a unified Web server and business function module, and a unified database system should be used to manage business data.

[0039] S104, calling the translation resource corresponding to the target language, translating each first page tag into the target language, and storing the translated page data.

[0040] Translation resources refer to various files and tools applicable in the process of internationalization (i18n) and localization (I10n). Specifically, the language resources including multiple first page tags in the first web page are stored in the back-end database by page classification, and all translation resources are managed by the back-end service. The resource classification management service provides basic translation information maintenance, language resource classification information maintenance, and provides interfaces for front-end version verification and resource loading. The front-end page can load language resources on demand, call the translation resources corresponding to the target language, so as to translate each first page tag into the target language, and store the translated page data. The translated page data refers to the language translation of the first page tag after being translated into the target language. That is, after the front-end page server loads the language resources to complete internationalization, the translated language translation is cached in the browser's cache.

[0041] In an embodiment of the present application, calling the translation resources corresponding to the target language to translate each first page tag into the target language includes: obtaining the first page identifier and the first version identifier of the first web page, and the language identifier corresponding to the target language; searching the first internationalization key corresponding to each first page tag from the first database according to the first page identifier and the first version identifier, and each page tag in the first list corresponding to the first database corresponds to an internationalization key; for each first page tag, searching the second database for the translation resources corresponding to the first page tag and the target language according to the first internationalization key and the language identifier, and each internationalization key and each language identifier in the second list corresponding to the second database corresponds to a translation resource; for each first page tag, calling the translation resources corresponding to the target language from the second database to translate the first page tag into the target language.

[0042] The front-end page can load language resources on demand. On demand means that it can be checked and determined whether to load translation resources from the server according to the page identifier and version identifier. If necessary, the corresponding language translation can be loaded through the translation resource. Specifically, by obtaining the first page identifier and the first version identifier of the first webpage, and the language identifier corresponding to the target language, the first internationalization key corresponding to each first page tag is searched from the first database according to the first page identifier and the first version identifier. The page identifier refers to a unique identifier used to refer to the front-end webpage. For example, the page identifier of the first webpage is page A, and the page identifier of the second webpage is page B. The version identifier refers to an identifier used to refer to different translation versions of the front-end webpage. When the language translation corresponding to the internationalization key corresponding to the page tag of the front-end webpage changes, the change of the version identifier of the front-end webpage is triggered. Among them, the first database refers to a database in the backend that stores language resources by page classification. The first database corresponds to a first list, and the first list lists the corresponding relationship between the page tag and the internationalization key of each webpage, and each page tag has an internationalization key corresponding to it. The structural design of the first database stored by page classification uses the first list to establish two one-to-many relationships to record the internationalization keys of all tags in the webpage. Further, according to the first internationalization key and the language identifier, the translation resource corresponding to the first page label and the target language is searched in the second database. The second database refers to a database storing translation resources at the back end. The second list lists the correspondence between the internationalization key, the language identifier, and the language translation.

[0043] Then, the translation resource corresponding to the target language may be called from the second database to translate the first page label into the target language.

[0044] S106, loading the second webpage, and obtaining second page tags included in the second webpage, wherein each second page tag corresponds to a second internationalization key.

[0045] It is understandable that the second webpage is relative to the first webpage. For example, if the current webpage is the first webpage, the second webpage can be loaded after triggering a specific webpage tag of the first webpage. It is understandable that the second page tag is relative to the first page tag, and the second internationalization key is relative to the first nationalization key.

[0046] S108: When the translation language of the second webpage is the target language, detecting whether there is a second internationalization key that is the same as the first internationalization key.

[0047] After the first web page is internationalized, if the user's requirement is to translate the second web page tag of the second web page into the target language, then it is possible to first check whether the second internationalization key is the same as the first internationalization key. Specifically, after the first web page is loaded into the language resource to complete internationalization, the language translations of all the translated first page tags can be cached in the browser's cache. When switching pages, the front end can obtain the second internationalization key of each second page tag under the new page based on the first list of the first database, and can first check whether there is a second internationalization key in the cache that is the same as the first internationalization key.

[0048] The page identifiers are usually designed to be redundant in the translation table corresponding to the translation resources of the backend, so that the same page tags on different pages will have two records in the translation table, and they are translated independently when loading different pages. For example, page A-key1-zh (Chinese)-delivery order, the corresponding language translation is page A-key1-en (English)-shippingbill; page B-key1-zh (Chinese)-delivery order, the corresponding language translation is page B-key1-en (English)-shippingbill. In the embodiment of the present application, the first list records the correspondence between the page identifier and the internationalization key, and the second list records the correspondence between the internationalization key and the language translation. For example, page A-key1, page B-key1 in the first list. In the second list, key1-zh (noon)-delivery order, key1-en (English)-shippingbill. Compared with the traditional form, when there are many repeated tags on different pages, the improved table organization form can save the occupied space of the table as a whole. Therefore, if there is a second internationalization key that is the same as the first internationalization key in the cache, the language translation in the cache can be used directly.

[0049] S110, reading translation data of a first page label corresponding to a first internationalization key identical to a second internationalization key from the translated page data, and using the translation data as translation data of a second page label corresponding to a second internationalization key.

[0050] The translated page data is the language translation corresponding to the internationalization key in the cache. If there is a second internationalization key that is the same as the first internationalization key in the cache, the translation data corresponding to the first internationalization key can be directly read and used as the translation data of the second page label. The translation data refers to the language translation. For those that do not have the same internationalization key in the cache, the backend is requested to obtain it, thereby reducing the front-end and back-end interactions.

[0051] In an embodiment of the present application, reading the translation data of the first page label corresponding to the first internationalization key that is the same as the second internationalization key from the translated page data, and using it as the translation data of the second page label corresponding to the second internationalization key includes: obtaining the first version identifier of the first web page and the second version identifier of the second web page; detecting whether the first version identifier is the same as the second version identifier; when the first version identifier and the second version identifier are the same, reading the translation data of the first page label corresponding to the first internationalization key that is the same as the second internationalization key from the translated page data, and using it as the translation data of the second page label corresponding to the second internationalization key.

[0052] In an embodiment of the present application, the processing method further includes: when the first version identifier and the second version identifier are different, calling a translation resource to translate the second page label corresponding to each second internationalization key into a target language.

[0053] refer to Figure 2 , Figure 2 The loading process of web page translation resources is schematically shown. The first version identifier and the second version identifier are relative. When loading the first web page and when loading the second web page, the corresponding first version identifier and the second version identifier can be obtained. When the repository of translation resources is updated, the page label corresponding to the internationalization key of the language translation change is determined, and then the version identifiers of these pages are synchronously updated in the first database. Specifically, when the front-end interface is developed, the internationalization key and language translation corresponding to the newly added page label can be initialized into the second database of the translation resource, and the second list containing the corresponding relationship between the internationalization key and the language translation can be associated with the second database, and the version information of the page corresponding to the internationalization key in the first database needs to be updated at the same time.

[0054] If the first version identifier is different from the second version identifier, it means that the language translations of the page tags of the first web page and the second web page may be different. Only when the first version identifier and the second version identifier are the same, the second internationalization key that is the same as the first internationalization key has the same language translation as the first internationalization key. Then, when the first version identifier and the second version identifier are the same, the translation data of the first page tag corresponding to the first internationalization key that is the same as the second internationalization key is read from the translated page data cached by the front-end server, and it is used as the translation data of the second page tag corresponding to the second internationalization key, thereby reducing the interaction between the front-end and the back-end.

[0055] When the first version identifier and the second version identifier are different, the second internationalization key that is the same as the first internationalization key may have a different language translation from the first internationalization key. In this case, you can request the backend server to obtain the corresponding translation resources to translate the second page label corresponding to the second internationalization key into the target language to complete page loading.

[0056] In an embodiment of the present application, the processing method also includes: after storing the translated page data, determining the number of page loads after the first web page; when the number of page loads is greater than or equal to a preset threshold and there is no second internationalization key that is the same as any first internationalization key, deleting the translated page data from the cache.

[0057] The number of page loads refers to the number of page switches. For example, the first page switches to the second page, the second page switches to the third page... The number of switches is the number of page loads. A survival time can be set for the cached translation data, that is, a preset threshold for the number of page loads. The preset threshold refers to the preset threshold for the number of page loads. When the number of page loads is greater than or equal to the preset threshold, and there is no second internationalization key that is the same as any of the first internationalization keys, the translated page data will be deleted from the cache. In other words, after switching pages x times, if the language translation of this internationalization key has not been used again, it will be released from the cache.

[0058] S112: calling translation resources to translate the second page labels corresponding to other second internationalization keys into the target language.

[0059] Other second internationalization keys refer to second nationalization keys that are different from the first internationalization key. That is, if the second internationalization key of the corresponding translation resource does not exist in the cache, the backend can be requested to obtain the corresponding translation resource to translate the second page label corresponding to the other second internationalization key into the target language.

[0060] In an embodiment of the present application, calling translation resources to translate second page labels corresponding to other second internationalization keys into a target language includes: searching a second database for translation resources corresponding to each other internationalization key and the target language according to each other internationalization key and the language identifier; calling the translation resources corresponding to the target language from the second database, and translating the second page labels corresponding to each other internationalization key into the target language.

[0061] Specifically, the translation resource of each other internationalization key is stored in the second database, and the corresponding language translation is searched in the second database according to the internationalization key and the language identifier of the target language. The translation resource corresponding to the target language is called from the second database, and the second page label corresponding to each other internationalization key is translated into the target language.

[0062] In an embodiment of the present application, the processing method further includes: when a translation resource corresponding to any internationalization key in the second database is updated, determining a target page tag corresponding to the internationalization key to update a version identifier of a web page corresponding to the target page tag.

[0063] refer to Figure 3 , the first database and the second database can be hot-updated, and when a new page is created or the first database is updated, that is, a new table entry is added or a table entry corresponding to a page identifier is modified, the first list is updated synchronously. For example, if a new web page is added, a new table entry is created. That is, the page tags of existing web pages can be added, modified, and deleted. When the second database is updated, the page tags corresponding to the internationalization keys that have changed (added, modified, deleted) are determined, and the page where the page tags are located are located, and the version identifiers of these web pages are synchronously updated in the first list corresponding to the first database. It can be understood that it is illegal to update internationalization keys that are not defined in the second list in the first list, and it is legal to update internationalization keys that are not included in the first list in the second list. Specifically, the version identifier of the initial version is 0, and it is +1 for each change.

[0064] Through the above technical solution, starting from the perspective of a single WEB page, the backend establishes a set of translation resource management methods by page. By classifying language resources by page and language and loading translation resource files from the server, the internationalization of the front-end interface is realized. There is no need to load all translation resources at once, which reduces user network overhead and improves the efficiency of loading translation resources. By loading internationalized translation resources by page, breaking the whole into parts and loading dynamically, it aims to improve the efficiency of loading translation resources, reduce network resource consumption, and improve the response speed when translation changes.

[0065] Figure 4 The structure block diagram of a web page processing device according to an embodiment of the present application is schematically shown. Figure 4 As shown, an embodiment of the present application provides a web page processing device, which may include:

[0066] Memory 410, configured to store instructions; and

[0067] The processor 420 is configured to call instructions from the memory 410 and implement the above-mentioned web page processing method when executing the instructions.

[0068] Specifically, in the embodiment of the present application, the processor 420 may be configured to:

[0069] Obtaining a target language for a first webpage, the first webpage comprising a plurality of first page tags, wherein each first page tag corresponds to a first internationalization key;

[0070] Calling the translation resource corresponding to the target language, translating each first page tag into the target language, and storing the translated page data;

[0071] Loading a second webpage, and obtaining a second page tag included in the second webpage, wherein each second page tag corresponds to a second internationalization key;

[0072] In the case where the translation language for the second webpage is the target language, detecting whether there is a second internationalization key that is the same as the first internationalization key;

[0073] Reading the translation data of the first page label corresponding to the first internationalization key which is the same as the second internationalization key from the translated page data, and using it as the translation data of the second page label corresponding to the second internationalization key;

[0074] The translation resource is called to translate the second page labels corresponding to other second internationalization keys into the target language.

[0075] In the embodiment of the present application, the processor 420 may also be configured to:

[0076] Calling the translation resources corresponding to the target language to translate each first page tag into the target language includes: obtaining the first page identifier and the first version identifier of the first web page, and the language identifier corresponding to the target language; searching the first internationalization key corresponding to each first page tag from the first database according to the first page identifier and the first version identifier, and each page tag in the first list corresponding to the first database corresponds to an internationalization key; for each first page tag, searching the translation resources corresponding to the first page tag and the target language in the second database according to the first internationalization key and the language identifier, and each internationalization key and each language identifier in the second list corresponding to the second database corresponds to a translation resource; for each first page tag, calling the translation resources corresponding to the target language from the second database to translate the first page tag into the target language.

[0077] In the embodiment of the present application, the processor 420 may also be configured to:

[0078] Calling translation resources to translate the second page labels corresponding to other second internationalization keys into the target language includes: searching for translation resources corresponding to each other internationalization key and the target language in the second database according to each other internationalization key and the language identifier; calling the translation resources corresponding to the target language from the second database, and translating the second page labels corresponding to each other internationalization key into the target language.

[0079] In the embodiment of the present application, the processor 420 may also be configured to:

[0080] When a translation resource corresponding to any internationalization key in the second database is updated, a target page tag corresponding to the internationalization key is determined to update a version identifier of a web page corresponding to the target page tag.

[0081] In the embodiment of the present application, the processor 420 may also be configured to:

[0082] Reading the translation data of the first page tag corresponding to the first internationalization key that is the same as the second internationalization key from the translated page data, and using it as the translation data of the second page tag corresponding to the second internationalization key includes: obtaining the first version identifier of the first web page and the second version identifier of the second web page; detecting whether the first version identifier is the same as the second version identifier; and when the first version identifier and the second version identifier are the same, reading the translation data of the first page tag corresponding to the first internationalization key that is the same as the second internationalization key from the translated page data, and using it as the translation data of the second page tag corresponding to the second internationalization key.

[0083] In the embodiment of the present application, the processor 420 may also be configured to:

[0084] When the first version identifier and the second version identifier are different, the translation resource is called to translate the second page label corresponding to each second internationalization key into the target language.

[0085] In the embodiment of the present application, the processor 420 may also be configured to:

[0086] After storing the translated page data, determine the number of page loads after the first web page; if the number of page loads is greater than or equal to a preset threshold and there is no second internationalization key that is the same as any first internationalization key, delete the translated page data from the cache.

[0087] Through the above technical solution, starting from the perspective of a single WEB page, the backend establishes a set of translation resource management methods by page. By loading internationalized translation resources by page, breaking the whole into parts and loading dynamically, it aims to improve the loading efficiency of translation resources, reduce network resource consumption, and increase the response speed when translation changes. In order to make up for the problem that the existing solution’s translation resources are packaged and released together with the front-end project, resulting in temporary inaccessibility of the page, this solution adopts a strategy of instant loading by page, so that translation resources can be updated dynamically, and the translation resources loaded at a single time are small in size and load quickly, allowing international users to have a better experience when using the business system.

[0088] Figure 5 The structure block diagram of a web page processing system according to an embodiment of the present application is schematically shown. Figure 5As shown, an embodiment of the present application provides a web page processing system 500, which may include the above-mentioned web page processing device 400.

[0089] In an embodiment of the present application, the web page processing system 500 also includes: a first database 510, the first database includes multiple page tags and multiple internationalization keys, each page tag in the first list corresponding to the first database corresponds to an internationalization key; a second database 520, the first database includes multiple internationalization keys and translation resources corresponding to multiple target languages, each internationalization key and the language identifier of each target language in the second list corresponding to the second database corresponds to a translation resource; a local database 530, which is used to store translated page data. The web page processing system starts from the perspective of a single WEB page, and the back end establishes a set of translation resource management methods according to the page. The language resources are classified by page and language, combined with the method of loading the translation resource file from the server, to realize the internationalization of the front-end interface, without the need to load all the translation resources at once, thereby reducing the user's network overhead.

[0090] Figure 6 The structure diagram of a web page processing system according to a specific embodiment of the present application is schematically shown. Figure 6 As shown, the embodiment of the present application provides a web page processing system, including a WEB interface, a local database, a language resource classification library (first database), a translation resource storage library (second database), a resource loading interface, and a version verification interface. Specifically, the language resources of multiple first page tags in the first web page are stored in the back-end database by page classification, and all translation resources are managed by the back-end service. The resource classification management service provides basic translation information maintenance, language resource classification information maintenance, and provides an interface for front-end version verification and resource loading. The front-end page can load language resources on demand, call the translation resources corresponding to the target language, so as to translate each first page tag into the target language, and store the translated page data. The translated page data refers to the language translation of the first page tag after being translated into the target language. That is, after the front-end page service end is loaded into the language resource to complete internationalization, the translated language translation (i.e., page language resource) is cached in the cache of the browser local database. The strategy of instant loading by page is adopted, so that the translation resources can be dynamically updated, and the translation resources loaded once are small in size and fast in loading speed, so that international users can get a better experience when using the business system.

[0091] The embodiment of the present application also provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute the above-mentioned web page processing method.

[0092] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7As shown. The computer device includes a processor A01, a network interface A02, a memory (not shown in the figure) and a database (not shown in the figure) connected through a system bus. Among them, the processor A01 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes an internal memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01, a computer program B02 and a database (not shown in the figure). The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A04. The database of the computer device is used to store web page processing data. The network interface A02 of the computer device is used to communicate with an external terminal through a network connection. When the computer program B02 is executed by the processor A01, a web page processing method is implemented.

[0093] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure 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 certain components, or have a different arrangement of components.

[0094] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt 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.) that contain computer-usable program code.

[0095] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0096] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0097] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0098] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0099] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0100] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0101] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0102] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A web page processing method, characterized in that: The processing method comprises: Obtaining a target language for a first webpage, wherein the first webpage includes a plurality of first page tags, wherein each first page tag corresponds to a first internationalization key; Calling a translation resource corresponding to the target language, translating each first page tag into the target language, and storing the translated page data; Loading a second webpage, and obtaining second page tags included in the second webpage, wherein each second page tag corresponds to a second internationalization key; When the translation language for the second webpage is the target language, detecting whether there is a second internationalization key that is the same as the first internationalization key; Reading translation data of a first page label corresponding to the first internationalization key which is the same as the second internationalization key from the translated page data, and using it as translation data of a second page label corresponding to the second internationalization key; The translation resource is called to translate the second page labels corresponding to other second internationalization keys into the target language.

2. The web page processing method according to claim 1, characterized in that: The calling of the translation resource corresponding to the target language to translate each first page tag into the target language comprises: Acquire a first page identifier and a first version identifier of the first webpage, and a language identifier corresponding to the target language; Searching a first internationalization key corresponding to each first page tag from a first database according to the first page identifier and the first version identifier, wherein each page tag in a first list corresponding to the first database corresponds to an internationalization key; For each first page tag, searching a second database for a translation resource corresponding to the first page tag and the target language according to the first internationalization key and the language identifier, wherein each internationalization key and each language identifier in a second list corresponding to the second database corresponds to one translation resource; For each first page tag, a translation resource corresponding to the target language is called from the second database to translate the first page tag into the target language.

3. The web page processing method according to claim 2, characterized in that: The calling of the translation resource to translate the second page label corresponding to the other second internationalization key into the target language includes: Searching in a second database for translation resources corresponding to each other internationalization key and the target language according to each other internationalization key and the language identifier; The translation resource corresponding to the target language is called from the second database, and the second page label corresponding to each other internationalization key is translated into the target language.

4. The web page processing method according to claim 2, characterized in that: The processing method also includes: When a translation resource corresponding to any internationalization key in the second database is updated, a target page tag corresponding to the internationalization key is determined to update a version identifier of a web page corresponding to the target page tag.

5. The web page processing method according to claim 1, characterized in that: The reading, from the translated page data, the translation data of the first page label corresponding to the first internationalization key which is the same as the second internationalization key, and using it as the translation data of the second page label corresponding to the second internationalization key comprises: Obtaining a first version identifier of the first webpage and a second version identifier of the second webpage; Detecting whether the first version identifier is the same as the second version identifier; When the first version identifier and the second version identifier are the same, the translation data of the first page label corresponding to the first internationalization key that is the same as the second internationalization key is read from the translated page data and used as the translation data of the second page label corresponding to the second internationalization key.

6. The webpage processing method according to claim 5, characterized in that: The processing method also includes: In the case where the first version identifier and the second version identifier are different, the translation resource is called to translate the second page label corresponding to each second internationalization key into the target language.

7. The web page processing method according to claim 1, characterized in that: The processing method also includes: After storing the translated page data, determining the number of page loads after the first web page; When the number of page loading times is greater than or equal to a preset threshold and there is no second internationalization key that is the same as any first internationalization key, the translated page data is deleted from the cache.

8. A web page processing device, characterized in that: include: a memory configured to store instructions; as well as A processor is configured to call the instructions from the memory and implement the webpage processing method according to any one of claims 1 to 7 when executing the instructions.

9. A web page processing system, characterized in that: Comprising a device according to claim 8.

10. The web page processing system according to claim 9, characterized in that: The system further comprises: A first database, wherein the first database includes a plurality of page tags and a plurality of internationalization keys, and each page tag in a first list corresponding to the first database corresponds to an internationalization key; a second database, wherein the first database includes a plurality of internationalization keys and translation resources corresponding to a plurality of target languages, and each internationalization key and each language identifier of each target language in a second list corresponding to the second database corresponds to one translation resource; Local database, used to store translated page data.

11. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores instructions, which are used to enable the machine to execute the webpage processing method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Chinese webpage internationalization adaptation method and device based on large model and medium

    CN120315799A