WO2019071406A1 - Front-end page internationalization processing method, application server and computer readable storage medium - Google Patents

Front-end page internationalization processing method, application server and computer readable storage medium Download PDF

Info

Publication number
WO2019071406A1
WO2019071406A1 PCT/CN2017/105436 CN2017105436W WO2019071406A1 WO 2019071406 A1 WO2019071406 A1 WO 2019071406A1 CN 2017105436 W CN2017105436 W CN 2017105436W WO 2019071406 A1 WO2019071406 A1 WO 2019071406A1
Authority
WO
WIPO (PCT)
Prior art keywords
internationalized
page
resource file
content
internationalization
Prior art date
Application number
PCT/CN2017/105436
Other languages
French (fr)
Chinese (zh)
Inventor
陈飞
向洁
马会明
Original Assignee
深圳中兴力维技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳中兴力维技术有限公司 filed Critical 深圳中兴力维技术有限公司
Priority to PCT/CN2017/105436 priority Critical patent/WO2019071406A1/en
Priority to CN201780009061.6A priority patent/CN108885544B/en
Publication of WO2019071406A1 publication Critical patent/WO2019071406A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code

Definitions

  • the present invention relates to the field of web page bursting technology, and in particular, to a front page page internationalization processing method, an application server, and a computer readable storage medium.
  • the international solution is mainly server back-end processing.
  • the Java back-end processes the template and outputs the assembled Html file.
  • the solution requires the developer to master certain back-end technologies, such as JSP, Velocity, etc., and if you switch the burst platform, all pages need to be re-issued.
  • All resource files need to be loaded at once, or each page loads a separate resource file. Loading all resource files at once can avoid duplication of internationalization, but it can lead to long periods of loading resources, affecting the user experience. If the private resource file is loaded separately for each page, the resource file can be divided to avoid the one-time loading speed being too slow, but the content will be repeated internationally. For example, "OK" will have many pages. If each page uses a separate resource file, it will result in the internationalization of the word "OK" in each resource file, causing duplicate work.
  • the main purpose of the present invention is to provide a front-end page internationalization processing method and a corresponding application server, which aims to solve the problem of how to implement internationalization of all content of a page in a pure front-end page, and improve resource file loading. Technical issues of efficiency.
  • the present invention provides a front-end page internationalization processing method, the method comprising the steps of: reading an attribute parameter set by a root node of a page, and obtaining a path of an internationalized resource file to be loaded by the current page; The path acquires a corresponding internationalized resource file, and loads in a preset order; parses the internationalized resource file; and replaces the content that needs to be internationalized in the page with the parsed internationalized content.
  • the method further includes the step before the step of reading the attribute parameter set by the root node of the page
  • the internationalized resource file stores the internationalized content in a key-value pair key-value mode, and the internationalized resource The file is named after the file name plus the language.
  • an international resource resource file without a language suffix is configured, and the default default international content is stored as the default international resource file.
  • the step of configuring the internationalized resource file corresponding to the page further includes: storing the internationalized content common to the plurality of pages in a common internationalized resource file.
  • the preset order is: a public default international resource file, an internationalized resource file of a common corresponding locale, a default internationalized resource file of the page private, and a corresponding language ring of the page private.
  • Internationalized resource documents are: a public default international resource file, an internationalized resource file of a common corresponding locale, a default internationalized resource file of the page private, and a corresponding language ring of the page private.
  • the step of setting an attribute parameter at the root node of the page specifically includes: setting a data-* attribute parameter for each label of the content that needs to be internationalized in the page, and configuring a current page.
  • the path of the loaded internationalized resource file is stored in the json format, and the value of the data-* attribute parameter is a key value in the internationalized resource file.
  • the step of setting an attribute parameter at the root node of the page further includes: if the content that needs to be internationalized is not the value of the input box or the content in the label, but an attribute of the label, Add an additional configuration item to the data-* attribute parameter to identify the attribute value that the label needs to be internationalized; if you need to internationalize multiple attributes of the label, use the English comma in the data-* attribute parameter. Separating a plurality of key values, and separating each of the internationalized tag attributes with a comma in the additional configuration item, the plurality of key values sequentially corresponding to the plurality of tag attributes.
  • the step of parsing the internationalized resource file specifically includes: parsing the content stored in the internationalized resource file into a key-value mode, and storing by using a public map, wherein the key corresponds to the The key value in the internationalized resource file, the value is the corresponding internationalized content in the internationalized resource file, and the key value in the public map is unique, and the key in the post-loaded internationalized resource file will be overwritten first.
  • the key in the loaded internationalization resource file specifically includes: parsing the content stored in the internationalized resource file into a key-value mode, and storing by using a public map, wherein the key corresponds to the The key value in the internationalized resource file, the value is the corresponding internationalized content in the internationalized resource file, and the key value in the public map is unique, and the key in the post-loaded internationalized resource file will be overwritten first.
  • the key in the loaded internationalization resource file specifically includes: parsing the content stored in the internationalized resource file into a key-value mode, and storing by using
  • the step of replacing the content that needs to be internationalized in the page with the parsed internationalized content includes: traversing all tags in the page that have data-* attribute parameters set, according to The dat a-* attribute parameter queries the corresponding key value from the public map, thereby obtaining corresponding internationalized content, and replacing the content that needs to be internationalized in the page with the obtained internationalized content.
  • the present invention further provides an application server, where the application server includes: a memory, a processor, an audio device, and a front page page stored on the memory and operable on the processor. And the front-end page internationalization processing program is executed by the processor to implement the step of the front-end page internationalization processing method as described above.
  • the present invention further provides a computer readable storage medium, where the front end page internationalization processing program is stored on the computer readable storage medium, and the front end page internationalization processing program is processed by a processor. The steps of implementing the front-end page internationalization processing method as described above are performed.
  • the front page internationalization processing method, the application server, and the computer readable storage medium proposed by the present invention The front-end and back-end pages of the website can be completely separated, so that the front-end pages are completely independent, and the front-end static pages are internationalized regardless of the platform of the back-end service and the language of the burst.
  • Html5 standard custom data data-* attribute parameter through the configuration of the static page, directly use the public JS file to read and traverse the page data-* attribute configuration, no longer need to write a separate JS file for each page, convenient
  • the need for internationalized content is replaced with the corresponding language content, which simplifies the workload of front-end internationalization and improves the efficiency of bursting. And it can realize the internationalization of the prompt content of the page content and prompt information, label custom attributes, etc., to meet the special needs of some pages.
  • the present invention uses a public international resource file and a page-localized international resource file to be dual-loaded, and can simultaneously load common internationalized resource files in different directories, and uniformly load some common international resources.
  • the page's private international resources are loaded on demand to achieve a balance between reduced work of internationalized language data and page loading efficiency.
  • ajax will automatically cache the loaded internationalized resource files. The second time you hit the same page again, you don't need to repeatedly download the internationalized resource files, it will automatically read from the cache. take. Make full use of the browser's own caching mechanism, so that the efficiency of the second page loading is further improved.
  • FIG. 1 is a schematic structural diagram of an application server according to a first embodiment of the present invention
  • FIG. 2 is a block diagram of a front-end page internationalization processing program according to a second embodiment of the present invention
  • FIG. 3 is a block diagram of a front-end page internationalization processing program according to a third embodiment of the present invention
  • 4 is a flowchart of a front-end page internationalization processing method according to a fourth embodiment of the present invention
  • FIG. 5 is a flowchart of a front-end page internationalization processing method according to a fifth embodiment of the present invention.
  • FIG. 1 it is a schematic diagram of an architecture of an application server 2 proposed by the present invention.
  • the application server 2 may include, but is not limited to, the memory 11, the processor 12, and the network interface 13 being communicably connected to each other through a system bus.
  • Figure 1 only shows the application server 2 with components 11-13, but it should be understood that not all illustrated components may be implemented and that more or fewer components may be implemented instead.
  • the memory 11 includes at least one type of readable storage medium, including a flash memory, a hard disk, a multimedia card, a card type memory (eg, SD or DX memory, etc.), a random access memory. (RAM), static random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk, etc.
  • the memory 11 may be an internal storage unit of the application server 2, such as a hard disk or memory of the application server 2.
  • the memory 11 may also be an external storage device of the application server 2, such as a plug-in hard disk equipped on the application server 2, a smart memory card (SMC), and a secure digital device. (Secure Digital, SD) card, flash card, etc.
  • the memory 11 can also include both the internal storage unit of the application server 2 and its external storage device.
  • the memory 11 is generally used to store an operating system installed in the application server 2 and various types of application software, such as program code of the front page internationalization processing program 200. Further, the memory 11 can also be used to temporarily store various types of data that have been output or are to be output.
  • the processor 12 may be a central processing unit in some embodiments (Central Processing)
  • the processor 12 is typically used to control the overall operation of the application server 2.
  • the processor 12 is configured to run program code or processing data stored in the memory 11, for example, running the front-end page internationalization processing program 200 and the like.
  • the network interface 13 may include a wireless network interface or a wired network interface, which is typically used for A communication connection is established between the application server 2 and other electronic devices.
  • a second embodiment of the present invention provides a front end page internationalization processing program 200.
  • the front-end page internationalization processing program 200 includes a series of computer program instructions stored in the memory 11, and when the computer program instructions are executed by the processor 12, embodiments of the present invention may be implemented.
  • the front end page is internationalized for processing operations.
  • the front end page globalization program 200 can be divided into one or more modules based on the particular operations implemented by the various portions of the computer program instructions. For example, in FIG. 2, the front end page globalization program 200 can be divided into a reading module 202, a loading module 204, a parsing module 206, and a replacement module 208. among them:
  • the reading module 202 is configured to read an attribute parameter set by the root node of the page, and obtain a path of the internationalized resource file that is required to be loaded by the current page.
  • the public JS is used to read the data-* attribute parameter set by the root node of the page, to obtain a path of the internationalized resource file to be loaded on the page.
  • the data-* attribute parameter configures a path of the internationalized resource file to be loaded on the current page, and stores the file in the json format.
  • the path is a URL path for the client (browser) to download the internationalized resource file.
  • the value of the data-* attribute parameter is a key value in the internationalized resource file. If the internationalized content is not the value of the input box or the content of the label, but an attribute of the label, such as title or placeholder, then an additional configuration item needs to be added in the data-* attribute parameter to identify the label.
  • Property values that need to be internationalized such as data-il8n-options.
  • the loading module 204 is configured to acquire a corresponding internationalized resource file according to the path, and load in a preset order.
  • the internationalized resource file can be obtained through ajax technology.
  • the preset order is: a public internationalized resource file > a page-specific default internationalized resource file > an internationalized resource file of a page-specific corresponding locale.
  • a public internationalized resource file > a page-specific default internationalized resource file > an internationalized resource file of a page-specific corresponding locale.
  • the resource file there are three internationalized resource files home.pro perties, home_zh_CN.properties, home_en_US .properties, which are private to the page, and the default internationalized resource file for this page, private Chinese internationalization. Resource files, private English internationalization resource files.
  • the common default internationalization resource file common.properties is loaded first, and then the publicized internationalized resource file corresponding to the locale is loaded according to the locale, for example, Chinese, then the public Chinese internationalization resource file common_ Z h_CN is loaded. .propertie S , At this point, the public international resource file is loaded. Then, load the page's private internationalization resource file home.properties and the private Chinese internationalization resource file home_zh_CN.properties, so that all the internationalized resource files corresponding to the page are loaded.
  • the publicized international resource file does not need to be repeatedly loaded, reducing the internationalization of some common content repetition.
  • the last loaded internationalized resource file has the highest priority for the same page.
  • the parsing module 206 is configured to parse the internationalized resource file.
  • the content stored in the internationalized resource file is parsed into a key-value mode, and is stored by using a public map.
  • key corresponds to the key value in the resource file
  • value is the corresponding internationalized content in the resource file.
  • the public map provides a mapping relationship, in which elements are stored in the form of key-values, which can quickly find v alue according to the key.
  • the key value in the public map is unique and cannot be repeated. If there is the same key, the key in the loaded internationalized resource file will overwrite the key in the previously loaded internationalized resource file. Therefore, if there is no corresponding international content in the internationalized resource file corresponding to the locale, the corresponding value in the default internationalized resource file is obtained.
  • the replacement module 208 is configured to replace the content that needs to be internationalized in the page with the parsed internationalized content.
  • the tag is not traversed, if the tag does not have a corresponding data-* attribute parameter, the default attribute is used to internationalize, and the content that needs to be internationalized is replaced with the default international content. If the tag belongs to input, select, text area, it is an input control, and the input box value is replaced by the internationalized content. In the case of other tags, the content in the replacement tag is the internationalized content. Content internationalization can not only internationalize text, but also replace images or other Html content, allowing different locales to display different images.
  • a third embodiment of the present invention provides a schematic diagram of a front-end page internationalization processing program 200.
  • the front-end page internationalization processing program 200 includes a configuration module 210 and a setting in addition to the reading module 202, the loading module 204, the parsing module 206, and the replacement module 208 in the second embodiment.
  • Module 212 the configuration module 210 and a setting in addition to the reading module 202, the loading module 204, the parsing module 206, and the replacement module 208 in the second embodiment.
  • the configuration module 210 is configured to configure an internationalized resource file corresponding to the page.
  • the internationalized resource file stores the internationalized content in a key-value mode, and the internationalized resource file is named by a file name plus a language.
  • the configuration module 210 can also configure an international resource resource file without a language suffix, and store the preset default internationalized content as a default internationalized resource file.
  • the default internationalized content can be obtained from the default internationalized resource file.
  • the configuration module 210 configures the internationalized resource file to store the internationalized content common to multiple pages in a common internationalized resource file. For example, the internationalized content corresponding to the words "date”, “confirm”, “cancel”, etc., can be stored in the publicized international resource file for all pages to call.
  • the setting module 212 is configured to set an attribute parameter at the root of the page to correspond to the current page.
  • a data-* attribute is added to a root node of a static page to be internationalized, and a data-* attribute parameter is set for each label of the content that needs to be internationalized in the page.
  • dat a-il8n configure the path of the internationalized resource file to be loaded on the current page, and store it in json format.
  • the path is a URL path for the client (browser) to download the internationalized resource file.
  • the value of the data-* attribute parameter is a key value in the internationalized resource file.
  • the Html page that needs to be internationalized is set by the data-* attribute parameter, so that all Html tags of the page can use a common JS file, and no additional operations need to be performed on js after setting once.
  • the custom attribute parameters may also be read by setting other custom attribute parameters and then using JS's getAttribute or jQuery's attr method.
  • the content configured in the custom attribute parameter can also be defined using an array or a string of specific punctuation.
  • the configuration of the other format is similar to the data-* attribute parameter of the json format, and will not be described here.
  • the configuration module 210 and the setting module 212 complete the configuration of the internationalized resource file corresponding to the page and the data-* attribute parameter, the page is loaded according to the data-*.
  • the attribute parameter automatically reads the corresponding internationalized resource file, thereby outputting the internationalized content.
  • a fourth embodiment of the present invention provides a front page page internationalization processing method.
  • the method includes the following steps:
  • S402. Read an attribute parameter set by the root node of the page, and obtain a path of the internationalized resource file to be loaded by the current page.
  • the public JS is used to read the data-* attribute parameter set by the root node of the page, to obtain a path of the internationalized resource file to be loaded on the page.
  • the data-* attribute parameter configures the path of the internationalized resource file to be loaded on the current page, and stores it in the json format.
  • the path is a URL path for the client (browser) to download the internationalized resource file.
  • the value of the data-* attribute parameter is a key value in the internationalized resource file. If the internationalized content is not the value of the input box or the content of the label, but an attribute of the label, such as title or placeholder, then an additional configuration item needs to be added in the data-* attribute parameter to identify the label.
  • Property values that need to be internationalized such as data-il8n-options.
  • a plurality of key values are separated by a comma in the data-* attribute parameter, and each of the additional configuration items is separated by a comma.
  • S404 Acquire a corresponding internationalized resource file according to the path, and load in a preset order.
  • the corresponding internationalized resource file is obtained according to the locale of the page.
  • the internationalized resource file can be obtained through ajax technology.
  • the preset order is: a public default international resource file, an internationalized resource file of a common corresponding locale, a default internationalized resource file of the page private, and an internationalized resource file corresponding to the local language of the page.
  • a public default international resource file For example, for a page, there are three public international resource files common.prop erties, common_zh_CN.properties, common_en_US .properties, and another 1 J is a public dog internationalization resource file, a public Chinese internationalization resource file. Public English international resource files, and three internationalized resource files home.properties, home_zh_CN.proper Ties .
  • home_en_US.properties which are the default internationalized resource files for the page, the private Chinese internationalization resource files, and the private English internationalization resource files.
  • the public default internationalization resource file common.properties is loaded first, and then the publicized internationalized resource file corresponding to the locale is loaded according to the locale, for example, Chinese, then the public Chinese internationalization resource file co mmon_zh_CN is loaded. Properties, at this point, the public international resource file is loaded. Then, load the page's private internationalization resource file home.properties and the private Chinese internationalization resource file home_zh_CN.properties, so that all the internationalized resource files corresponding to the page are loaded.
  • the publicized international resource file does not need to be repeatedly loaded, reducing the internationalization of some common content duplication.
  • the last loaded internationalized resource file has the highest priority for the same page.
  • the content stored in the internationalized resource file is parsed into a key-value mode, and is stored by using a public map.
  • key corresponds to the key value in the resource file
  • value is the corresponding internationalized content in the resource file.
  • the public map provides a mapping relationship, wherein the elements are stored in the form of a key-value, which can quickly find a val ue according to the key.
  • the key value in the public map is unique and cannot be repeated. If there is the same key, the key in the loaded internationalized resource file will overwrite the key in the previously loaded internationalized resource file. Therefore, if there is no corresponding international content in the internationalized resource file corresponding to the locale, the corresponding value in the default internationalized resource file is obtained.
  • the traversal tag ⁇ if the tag does not set the corresponding data-* attribute parameter, the default attribute is used to internationalize, and the content that needs to be internationalized is replaced with the default international content. If the tag belongs to input, select, and text area, it is an input control, and the input box value is replaced by the internationalized content. If it is another label, replace it The content within the tag is the internationalized content. Content internationalization can not only internationalize text, but also replace images or other Html content, so that different locales can display different images.
  • a fifth embodiment of the present invention provides a front page page internationalization processing method.
  • the steps S506-S512 of the front-end page internationalization processing method are similar to the steps S402-S4 08 of the fourth embodiment, except that the method further includes steps S502-S504.
  • the method comprises the following steps:
  • the internationalized resource file stores the internationalized content in a key-value mode, and the internationalized resource file is named by a file name plus a language.
  • the configuration module 210 can also configure an international resource resource file without a language suffix, and store the preset default internationalized content as a default internationalized resource file.
  • the default internationalized content can be obtained from the default internationalized resource file.
  • the configuration module 210 configures the internationalized resource file to store the internationalized content common to multiple pages in a common internationalized resource file. For example, the internationalized content corresponding to the words "date”, “confirm”, “cancel”, etc., can be stored in the publicized international resource file for all pages to call.
  • a data-* attribute is added to a root node of a static page to be internationalized, and a data-* attribute parameter is set for each label of the content that needs to be internationalized in the page.
  • dat a-il8n configure the path of the internationalized resource file to be loaded on the current page, and store it in json format.
  • the path is a URL path for the client (browser) to download the internationalized resource file.
  • the value of the data-* attribute parameter is a key value in the internationalized resource file.
  • the shell lj needs to add an additional configuration item to identify the data-* attribute parameter.
  • the tag needs to be internationalized attribute values, such as data-il8n-options.
  • a plurality of key values are separated by a comma in the data-* attribute parameter, and each of the additional configuration items is separated by a comma.
  • the Html page that needs to be internationalized is set by the data-* attribute parameter, so that all Html tags of the page can use a common JS file, and no additional operations need to be performed on js after setting once.
  • the custom attribute parameters may also be read by setting other custom attribute parameters and then using JS's getAttribute or jQuery's attr method.
  • the content configured in the custom attribute parameter can also be defined using an array or a string of specific punctuation.
  • the configuration of the other format is similar to the data-* attribute parameter of the json format, and will not be described here.
  • the public JS is used to read the data-* attribute parameter set by the root node of the page, to obtain a path of the internationalized resource file to be loaded on the page.
  • the corresponding internationalized resource file is obtained according to the locale of the page.
  • the internationalized resource file can be obtained through ajax technology.
  • the preset order is: a public default international resource file, an internationalized resource file of a common corresponding locale, a default internationalized resource file of the page private, and an internationalized resource file corresponding to the local language of the page.
  • a public default international resource file for a page, there are three public international resource files common.prop erties, common_zh_CN.properties, common_en_US .properties, and another 1 J is a public dog internationalization resource file, a public Chinese internationalization resource file. Public English international resource files, and three internationalized resource files home.properties, home_zh_CN.proper Ties .
  • home_en_US.properties which are the default internationalized resource files for the page, the private Chinese internationalization resource files, and the private English internationalization resource files.
  • the public default internationalization resource file common.properties is loaded first, and then the publicized internationalized resource file corresponding to the locale is loaded according to the locale, for example, Chinese, then the public Chinese internationalization resource file co mmon_zh_CN is loaded. Properties, at this point, the public international resource file is loaded. Then, load the page's private internationalization resource file home.properties and the private Chinese internationalization resource file home_zh_CN.properties, so that all the internationalized resource files corresponding to the page are loaded.
  • the last loaded internationalized resource file has the highest priority for the same page.
  • the content stored in the internationalized resource file is parsed into a key-value mode, and is stored by using a public map.
  • key corresponds to the key value in the resource file
  • value is the corresponding internationalized content in the resource file.
  • the public map provides a mapping relationship, wherein the elements are stored in the form of a key-value, which can quickly find a val ue according to the key.
  • the key value in the public map is unique and cannot be repeated. If there is the same key, the key in the loaded internationalized resource file will overwrite the key in the previously loaded internationalized resource file. Therefore, if there is no corresponding international content in the internationalized resource file corresponding to the locale, the corresponding value in the default internationalized resource file is obtained.
  • the traversal tag ⁇ if the tag does not set the corresponding data-* attribute parameter, the default attribute is used to internationalize, and the content that needs to be internationalized is replaced with the default international content. If the tag belongs to input, select, and text area, it is an input control, and the input box value is replaced by the internationalized content. If it is another label, replace it The content within the tag is the internationalized content. Content internationalization can not only internationalize text, but also replace images or other Html content, so that different locales can display different images.
  • the foregoing method can be implemented by means of software plus a necessary general hardware platform, and can also be implemented by hardware, but in many cases.
  • the former is a better implementation.
  • the technical solution of the present invention which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
  • the front page internationalization processing method, the application server and the computer readable storage medium proposed by the invention can completely separate the front and back pages of the website, so that the front end page is completely independent, and the platform of the back end service is completely complete.
  • Independent of the implementation of the internationalization of the front-end static pages. Use the Html5 standard custom data data-* attribute parameter to read and traverse the page directly using the public JS file through the configuration of the static page. With the data-* attribute configuration, it is no longer necessary to write a separate JS file for each page. It is convenient to replace the internationalized content with the corresponding language content, which simplifies the front-end internationalization workload and improves the bursting efficiency. And it can realize the internationalization of the prompt content of the page content and prompt information, label custom attributes, etc., to meet the special needs of some pages.
  • the present invention uses a public international resource file and a page-localized international resource file to be dual-loaded, and can simultaneously load common internationalized resource files in different directories, and is uniformly loaded for some common international resources.
  • Private international resources are loaded on demand to achieve a balance between reduced work of internationalized language data and page loading efficiency.
  • JS's native parsing and ajax features to ensure page parsing efficiency.
  • browser-based features, ajax will automatically cache the loaded international resource file, the second time you fight the same page again internationalization, do not need to repeatedly download the internationalized resource file, will automatically read from the cache take.
  • Make full use of the browser's own caching mechanism so that the efficiency of the second page loading is further improved. Therefore, it has industrial applicability.

Abstract

A front-end page internationalization processing method, an application server and a computer readable storage medium. The method comprises: reading an attribute parameter that is set for a page root node, to obtain a path of an internationalization resource file that needs to be loaded on a current page (S402); acquiring a corresponding internationalization resource file according to the path, and loading same in a preset order (S404); parsing the internationalization resource file (S406); and replacing the content that needs to be internationalized on the page with the parsed internationalization content (S408). The solution above can realize, on a pure front-end page, internationalization of all contents of the page, and improve resource file loading efficiency.

Description

前端页面国际化处理方法、 应用服务器及计算机可读存 储介质  Front page internationalization method, application server and computer readable storage medium
技术领域  Technical field
[0001] 本发明涉及网页幵发技术领域, 尤其涉及前端页面国际化处理方法、 应用服务 器及计算机可读存储介质。  [0001] The present invention relates to the field of web page bursting technology, and in particular, to a front page page internationalization processing method, an application server, and a computer readable storage medium.
背景技术  Background technique
[0002] 如今 WEB前端的功能越来越复杂, 能实现的功能越来越多, 对于前端技术人员 的要求越来越高, 前端和后端的区分更加细化。 所以, 纯前端页面信息的国际 化需求也应运而生, 使前端幵发人员可以专注于前端的幵发, 不必过分分散精 力。  [0002] Today's WEB front-end functions are more and more complex, and more and more functions can be realized. The requirements for front-end technicians are getting higher and higher, and the distinction between front-end and back-end is more detailed. Therefore, the international demand for pure front-end page information has also emerged, enabling front-end executives to focus on the front-end bursts without having to over-disperse.
[0003] 目前, 国际化的解决方案主要是服务器后端处理, 以 Java为例, Java后端对模 版进行处理, 输出组装好的 Html文件。 该解决方案需要幵发人员掌握一定的后 端技术, 如 JSP、 Velocity等, 并且, 如果切换幵发平台, 所有的页面都需要重新 幵发。  [0003] At present, the international solution is mainly server back-end processing. Taking Java as an example, the Java back-end processes the template and outputs the assembled Html file. The solution requires the developer to master certain back-end technologies, such as JSP, Velocity, etc., and if you switch the burst platform, all pages need to be re-issued.
[0004] 另一种解决方案是在前端页面使用 JavaScript (JS) 脚本语言进行处理。 主要是 通过 JS语言获取页面语言环境, 然后加载对应的资源文件, 对需要进行国际化的 内容进行替换完成国际化。 这种解决方案目前存在以下问题:  [0004] Another solution is to use a JavaScript (JS) scripting language for processing on front-end pages. The main purpose is to obtain the page locale through the JS language, and then load the corresponding resource file to replace the internationalization of the content that needs to be internationalized. This solution currently has the following problems:
[0005] 需要一次性加载所有的资源文件, 或者每个页面加载单独的资源文件。 一次性 加载所有资源文件可以避免重复的国际化工作, 但是会导致加载资源的吋间过 长, 影响用户体验。 若是每个页面单独加载私有资源文件可以分割资源文件, 避免一次性加载速度过慢, 但是会导致内容重复的国际化。 例如, "确定"许多页 面都会有, 若是每个页面使用单独的资源文件, 则会导致每个资源文件中都会 有"确定"这个词的国际化, 造成重复的工作。  [0005] All resource files need to be loaded at once, or each page loads a separate resource file. Loading all resource files at once can avoid duplication of internationalization, but it can lead to long periods of loading resources, affecting the user experience. If the private resource file is loaded separately for each page, the resource file can be divided to avoid the one-time loading speed being too slow, but the content will be repeated internationally. For example, "OK" will have many pages. If each page uses a separate resource file, it will result in the internationalization of the word "OK" in each resource file, causing duplicate work.
[0006] 目前的国际化方案需要在不同的页面中编写 JS代码, 手动为每一个需要国际化 的标签重新赋值, 代码量巨大, 不方便使用。 而且都是着重于可见的内容国际 化, 如页面内容, 输入框内容和按钮上的显示文字等, 并没有对页面元素的属 性等提示性的内容实现自动的国际化实现, <input title='1示题" placeholder "提 示" >中的 title和 placeholder 对于这些内容, 目前的国际化方案是需要手动的编 写 JS代码进行替换。 [0006] The current internationalization solution requires writing JS code on different pages, manually reassigning each tag that needs to be internationalized, and the code is huge and inconvenient to use. And they all focus on the internationalization of visible content, such as page content, input box content and display text on buttons, etc., and there is no genus for page elements. Sexual and other prompt content to achieve automatic internationalization, <input title='1 title "placeholder" prompt "> title and placeholder For these contents, the current internationalization program needs to manually write JS code to replace .
[0007] 目前还有一种国际化方法会在页面使用特定符号搭配正则表达式国际化, 因为 使用了自定义特殊符号当做标签, 抛弃了 JS语言对 Html内容的原生解析方式, 会使 JS语言解析页面的效率下降, 降低页面加载效率。  [0007] There is also an internationalization method that uses a specific symbol to match the regular expression internationalization on the page, because the custom special symbol is used as a label, and the JS language's native parsing method for Html content is discarded, which will cause JS language parsing. The efficiency of the page is reduced, reducing page loading efficiency.
技术问题  technical problem
[0008] 有鉴于此, 本发明的主要目的在于提出一种前端页面国际化处理方法及对应的 应用服务器, 旨在解决如何在纯前端页面中实现页面所有内容的国际化, 并且 提高资源文件加载效率的技术问题。  [0008] In view of this, the main purpose of the present invention is to provide a front-end page internationalization processing method and a corresponding application server, which aims to solve the problem of how to implement internationalization of all content of a page in a pure front-end page, and improve resource file loading. Technical issues of efficiency.
问题的解决方案  Problem solution
技术解决方案  Technical solution
[0009] 为实现上述目的, 本发明提供一种前端页面国际化处理方法, 该方法包括步骤 : 读取页面根节点设置的属性参数, 得到当前页面所需加载的国际化资源文件 的路径; 根据所述路径获取对应的国际化资源文件, 并按预设顺序进行加载; 解析所述国际化资源文件; 及将所述页面内需要国际化的内容替换为所解析出 的国际化内容。  [0009] In order to achieve the above object, the present invention provides a front-end page internationalization processing method, the method comprising the steps of: reading an attribute parameter set by a root node of a page, and obtaining a path of an internationalized resource file to be loaded by the current page; The path acquires a corresponding internationalized resource file, and loads in a preset order; parses the internationalized resource file; and replaces the content that needs to be internationalized in the page with the parsed internationalized content.
[0010] 可选地, 该方法在所述读取页面根节点设置的属性参数的步骤之前还包括步骤 [0010] Optionally, the method further includes the step before the step of reading the attribute parameter set by the root node of the page
: 配置所述页面对应的国际化资源文件; 在所述页面根节点设置属性参数, 以 对应当前页面所需加载的国际化资源文件的路径。 : Configuring an internationalized resource file corresponding to the page; setting an attribute parameter at the root node of the page to correspond to a path of an internationalized resource file to be loaded on the current page.
[0011] 可选地, 在所述配置所述页面对应的国际化资源文件的步骤中, 所述国际化资 源文件内以键值对 key-value的模式存储国际化内容, 所述国际化资源文件以文件 名加语言的方式命名, 另外, 配置一个不加语言后缀的国际化资源资源文件, 存储预设的默认国际化内容, 作为默认的国际化资源文件。  [0011] Optionally, in the step of configuring the internationalized resource file corresponding to the page, the internationalized resource file stores the internationalized content in a key-value pair key-value mode, and the internationalized resource The file is named after the file name plus the language. In addition, an international resource resource file without a language suffix is configured, and the default default international content is stored as the default international resource file.
[0012] 可选地, 所述配置所述页面对应的国际化资源文件的步骤还包括: 将多个页面 通用的国际化内容存储在一个公共的国际化资源文件内。  [0012] Optionally, the step of configuring the internationalized resource file corresponding to the page further includes: storing the internationalized content common to the plurality of pages in a common internationalized resource file.
[0013] 可选地, 所述预设顺序为: 公共的默认国际化资源文件、 公共的对应语言环境 的国际化资源文件、 页面私有的默认国际化资源文件、 页面私有的对应语言环 境的国际化资源文件。 [0013] Optionally, the preset order is: a public default international resource file, an internationalized resource file of a common corresponding locale, a default internationalized resource file of the page private, and a corresponding language ring of the page private. Internationalized resource documents.
[0014] 可选地, 所述在所述页面根节点设置属性参数的步骤具体包括: 为所述页面中 每一个需要国际化的内容的标签设置一个 data-*属性参数, 配置当前页面所需加 载的国际化资源文件的路径, 以 json格式进行存储, 所述 data-*属性参数的值为 所述国际化资源文件中的 key值。  [0014] Optionally, the step of setting an attribute parameter at the root node of the page specifically includes: setting a data-* attribute parameter for each label of the content that needs to be internationalized in the page, and configuring a current page. The path of the loaded internationalized resource file is stored in the json format, and the value of the data-* attribute parameter is a key value in the internationalized resource file.
[0015] 可选地, 所述在所述页面根节点设置属性参数的步骤还包括: 若需要国际化的 内容不是输入框的值或标签内的内容, 而是标签的一个属性, 则在所述 data-*属 性参数中再添加一个额外的配置项来标识该标签需被国际化的属性值; 若需要 国际化该标签的多个属性, 则在所述 data-*属性参数中使用英文逗号分隔多个 key 值, 并且在所述额外的配置项中使用英文逗号分隔每一个被国际化的标签属性 , 所述多个 key值与多个标签属性按顺序对应。  [0015] Optionally, the step of setting an attribute parameter at the root node of the page further includes: if the content that needs to be internationalized is not the value of the input box or the content in the label, but an attribute of the label, Add an additional configuration item to the data-* attribute parameter to identify the attribute value that the label needs to be internationalized; if you need to internationalize multiple attributes of the label, use the English comma in the data-* attribute parameter. Separating a plurality of key values, and separating each of the internationalized tag attributes with a comma in the additional configuration item, the plurality of key values sequentially corresponding to the plurality of tag attributes.
[0016] 可选地, 所述解析所述国际化资源文件的步骤具体包括: 将所述国际化资源文 件内存储的内容解析成 key-value模式, 使用公共 Map进行存储, 其中, key对应 所述国际化资源文件中的 key值, value为所述国际化资源文件中对应的国际化内 容, 所述公共 Map中的 key值是唯一的, 后加载的国际化资源文件中的 key会覆盖 先加载的国际化资源文件中的 key。  [0016] Optionally, the step of parsing the internationalized resource file specifically includes: parsing the content stored in the internationalized resource file into a key-value mode, and storing by using a public map, wherein the key corresponds to the The key value in the internationalized resource file, the value is the corresponding internationalized content in the internationalized resource file, and the key value in the public map is unique, and the key in the post-loaded internationalized resource file will be overwritten first. The key in the loaded internationalization resource file.
[0017] 可选地, 所述将所述页面内需要国际化的内容替换为所解析出的国际化内容的 步骤具体包括: 遍历所述页面中所有设置了 data-*属性参数的标签, 根据所述 dat a-*属性参数从所述公共 Map中査询对应的 key值, 从而得到对应的国际化内容, 将所述页面中需要国际化的内容替换为所得到的国际化内容。  [0017] Optionally, the step of replacing the content that needs to be internationalized in the page with the parsed internationalized content includes: traversing all tags in the page that have data-* attribute parameters set, according to The dat a-* attribute parameter queries the corresponding key value from the public map, thereby obtaining corresponding internationalized content, and replacing the content that needs to be internationalized in the page with the obtained internationalized content.
[0018] 为实现上述目的, 本发明还提出一种应用服务器, 所述应用服务器包括: 存储 器、 处理器、 音频设备及存储在所述存储器上并可在所述处理器上运行的前端 页面国际化处理程序, 所述前端页面国际化处理程序被所述处理器执行吋实现 如上述的前端页面国际化处理方法的步骤。  [0018] In order to achieve the above object, the present invention further provides an application server, where the application server includes: a memory, a processor, an audio device, and a front page page stored on the memory and operable on the processor. And the front-end page internationalization processing program is executed by the processor to implement the step of the front-end page internationalization processing method as described above.
[0019] 此外, 为实现上述目的, 本发明还提供一种计算机可读存储介质, 所述计算机 可读存储介质上存储有前端页面国际化处理程序, 所述前端页面国际化处理程 序被处理器执行吋实现如上述的前端页面国际化处理方法的步骤。  [0019] In addition, in order to achieve the above object, the present invention further provides a computer readable storage medium, where the front end page internationalization processing program is stored on the computer readable storage medium, and the front end page internationalization processing program is processed by a processor. The steps of implementing the front-end page internationalization processing method as described above are performed.
[0020] 本发明提出的前端页面国际化处理方法、 应用服务器及计算机可读存储介质, 能够完全分离网站前后端页面, 使前端页面完整的独立出来, 与后端服务的平 台、 幵发语言完全无关而实施前端静态页面的国际化。 使用 Html5标准的自定义 数据 data-*属性参数, 通过静态页面的配置, 直接使用公共 JS文件读取并遍历页 面 data-*属性配置, 不再需要为每个页面单独编写 JS文件, 方便的将需要国际化 的内容替换为对应的语言内容, 简化了前端国际化的工作量, 提高了幵发效率 。 并且可以实现页面内容与提示信息、 标签自定义属性等提示性内容的国际化 , 满足了一些页面的特殊需求。 [0020] The front page internationalization processing method, the application server, and the computer readable storage medium proposed by the present invention, The front-end and back-end pages of the website can be completely separated, so that the front-end pages are completely independent, and the front-end static pages are internationalized regardless of the platform of the back-end service and the language of the burst. Using the Html5 standard custom data data-* attribute parameter, through the configuration of the static page, directly use the public JS file to read and traverse the page data-* attribute configuration, no longer need to write a separate JS file for each page, convenient The need for internationalized content is replaced with the corresponding language content, which simplifies the workload of front-end internationalization and improves the efficiency of bursting. And it can realize the internationalization of the prompt content of the page content and prompt information, label custom attributes, etc., to meet the special needs of some pages.
发明的有益效果  Advantageous effects of the invention
有益效果  Beneficial effect
[0021] 本发明使用了公共的国际化资源文件与页面私有的国际化资源文件双重加载的 方式, 能够同吋加载不同目录下的公共国际化资源文件, 对于一些通用的国际 化资源统一加载, 页面私有的国际化资源按需加载来实现对于国际化语言数据 重复劳作的减少与页面加载效率之间的平衡。 并且充分的利用了 JS的原生解析方 式和 ajax的特性, 保证了页面解析效率。 同吋, 基于浏览器的特性, ajax会自动 缓存加载的国际化资源文件, 第二次打幵相同页面再次国际化的吋候, 不需要 重复的下载国际化资源文件, 会自动从缓存中读取。 充分利用了浏览器自身的 缓存机制, 使得页面第二次加载的效率更进一步的提升。  [0021] The present invention uses a public international resource file and a page-localized international resource file to be dual-loaded, and can simultaneously load common internationalized resource files in different directories, and uniformly load some common international resources. The page's private international resources are loaded on demand to achieve a balance between reduced work of internationalized language data and page loading efficiency. And fully utilize the JS native parsing method and ajax features to ensure page parsing efficiency. Similarly, based on the browser's features, ajax will automatically cache the loaded internationalized resource files. The second time you hit the same page again, you don't need to repeatedly download the internationalized resource files, it will automatically read from the cache. take. Make full use of the browser's own caching mechanism, so that the efficiency of the second page loading is further improved.
对附图的简要说明  Brief description of the drawing
附图说明  DRAWINGS
[0022] 图 1为本发明第一实施例提出的一种应用服务器的架构示意图;  1 is a schematic structural diagram of an application server according to a first embodiment of the present invention;
[0023] 图 2为本发明第二实施例提出的一种前端页面国际化处理程序的模块示意图; [0024] 图 3为本发明第三实施例提出的一种前端页面国际化处理程序的模块示意图; [0025] 图 4为本发明第四实施例提出的一种前端页面国际化处理方法的流程图; 2 is a block diagram of a front-end page internationalization processing program according to a second embodiment of the present invention; [0024] FIG. 3 is a block diagram of a front-end page internationalization processing program according to a third embodiment of the present invention; 4 is a flowchart of a front-end page internationalization processing method according to a fourth embodiment of the present invention;
[0026] 图 5为本发明第五实施例提出的一种前端页面国际化处理方法的流程图; 5 is a flowchart of a front-end page internationalization processing method according to a fifth embodiment of the present invention;
[0027] 本发明目的的实现、 功能特点及优点将结合实施例, 参照附图做进一步说明。 [0027] The implementation, functional features, and advantages of the present invention will be further described with reference to the accompanying drawings.
本发明的实施方式 [0028] 为了使本发明所要解决的技术问题、 技术方案及工业实用性更加清楚、 明白, 以下结合附图和实施例, 对本发明进行进一步详细说明。 应当理解, 此处所描 述的具体实施例仅仅用以解释本发明, 并不用于限定本发明。 Embodiments of the invention The present invention will be further described in detail below with reference to the accompanying drawings and embodiments, in order to make the present invention. It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0029] 第一实施例  First Embodiment
[0030] 如图 1所示, 是本发明提出的一种应用服务器 2的架构示意图。 本实施例中, 所 述应用服务器 2可包括, 但不仅限于, 可通过系统总线相互通信连接存储器 11、 处理器 12、 网络接口 13。 需要指出的是, 图 1仅示出了具有组件 11-13的应用服务 器 2, 但是应理解的是, 并不要求实施所有示出的组件, 可以替代的实施更多或 者更少的组件。  [0030] As shown in FIG. 1, it is a schematic diagram of an architecture of an application server 2 proposed by the present invention. In this embodiment, the application server 2 may include, but is not limited to, the memory 11, the processor 12, and the network interface 13 being communicably connected to each other through a system bus. It is to be noted that Figure 1 only shows the application server 2 with components 11-13, but it should be understood that not all illustrated components may be implemented and that more or fewer components may be implemented instead.
[0031] 其中, 所述存储器 11至少包括一种类型的可读存储介质, 所述可读存储介质包 括闪存、 硬盘、 多媒体卡、 卡型存储器 (例如, SD或 DX存储器等) 、 随机访问 存储器 (RAM) 、 静态随机访问存储器 (SRAM) 、 只读存储器 (ROM) 、 电 可擦除可编程只读存储器 (EEPROM) 、 可编程只读存储器 (PROM) 、 磁性存 储器、 磁盘、 光盘等。 在一些实施例中, 所述存储器 11可以是所述应用服务器 2 的内部存储单元, 例如该应用服务器 2的硬盘或内存。 在另一些实施例中, 所述 存储器 11也可以是所述应用服务器 2的外部存储设备, 例如该应用服务器 2上配 备的插接式硬盘, 智能存储卡 (Smart Media Card, SMC) , 安全数字 (Secure Digital, SD) 卡, 闪存卡 (Flash Card) 等。 当然, 所述存储器 11还可以既包括所 述应用服务器 2的内部存储单元也包括其外部存储设备。 本实施例中, 所述存储 器 11通常用于存储安装于所述应用服务器 2的操作系统和各类应用软件, 例如前 端页面国际化处理程序 200的程序代码等。 此外, 所述存储器 11还可以用于暂吋 地存储已经输出或者将要输出的各类数据。  [0031] wherein the memory 11 includes at least one type of readable storage medium, including a flash memory, a hard disk, a multimedia card, a card type memory (eg, SD or DX memory, etc.), a random access memory. (RAM), static random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of the application server 2, such as a hard disk or memory of the application server 2. In other embodiments, the memory 11 may also be an external storage device of the application server 2, such as a plug-in hard disk equipped on the application server 2, a smart memory card (SMC), and a secure digital device. (Secure Digital, SD) card, flash card, etc. Of course, the memory 11 can also include both the internal storage unit of the application server 2 and its external storage device. In this embodiment, the memory 11 is generally used to store an operating system installed in the application server 2 and various types of application software, such as program code of the front page internationalization processing program 200. Further, the memory 11 can also be used to temporarily store various types of data that have been output or are to be output.
[0032] 所述处理器 12在一些实施例中可以是中央处理器 (Central Processing  [0032] The processor 12 may be a central processing unit in some embodiments (Central Processing)
Unit, CPU) 、 控制器、 微控制器、 微处理器、 或其他数据处理芯片。 该处理器 12通常用于控制所述应用服务器 2的总体操作。 本实施例中, 所述处理器 12用于 运行所述存储器 11中存储的程序代码或者处理数据, 例如运行所述前端页面国 际化处理程序 200等。  Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 12 is typically used to control the overall operation of the application server 2. In this embodiment, the processor 12 is configured to run program code or processing data stored in the memory 11, for example, running the front-end page internationalization processing program 200 and the like.
所述网络接口 13可包括无线网络接口或有线网络接口, 该网络接口 13通常用于 在所述应用服务器 2与其他电子设备之间建立通信连接。 The network interface 13 may include a wireless network interface or a wired network interface, which is typically used for A communication connection is established between the application server 2 and other electronic devices.
[0034] 第二实施例 Second Embodiment
[0035] 如图 2所示, 本发明第二实施例提出一种前端页面国际化处理程序 200。  As shown in FIG. 2, a second embodiment of the present invention provides a front end page internationalization processing program 200.
[0036] 本实施例中, 所述前端页面国际化处理程序 200包括一系列的存储于存储器 11 上的计算机程序指令, 当该计算机程序指令被处理器 12执行吋, 可以实现本发 明各实施例的前端页面国际化处理操作。 在一些实施例中, 基于该计算机程序 指令各部分所实现的特定的操作, 所述前端页面国际化处理程序 200可以被划分 为一个或多个模块。 例如, 在图 2中, 所述前端页面国际化处理程序 200可以被 分割成读取模块 202、 加载模块 204、 解析模块 206及替换模块 208。 其中:  [0036] In this embodiment, the front-end page internationalization processing program 200 includes a series of computer program instructions stored in the memory 11, and when the computer program instructions are executed by the processor 12, embodiments of the present invention may be implemented. The front end page is internationalized for processing operations. In some embodiments, the front end page globalization program 200 can be divided into one or more modules based on the particular operations implemented by the various portions of the computer program instructions. For example, in FIG. 2, the front end page globalization program 200 can be divided into a reading module 202, a loading module 204, a parsing module 206, and a replacement module 208. among them:
[0037] 所述读取模块 202设置为读取页面根节点设置的属性参数, 得到当前页面所需 加载的国际化资源文件的路径。  [0037] The reading module 202 is configured to read an attribute parameter set by the root node of the page, and obtain a path of the internationalized resource file that is required to be loaded by the current page.
[0038] 具体地, 当需要加载静态页面吋, 使用公共 JS读取该页面根节点设置的 data-* 属性参数, 得到该页面所需加载的国际化资源文件的路径。  [0038] Specifically, when a static page needs to be loaded, the public JS is used to read the data-* attribute parameter set by the root node of the page, to obtain a path of the internationalized resource file to be loaded on the page.
[0039] 所述 data-*属性参数, 例如 data-ilSn, 配置当前页面所需加载的国际化资源文 件的路径, 以 json格式进行存储。 其中, 所述路径为客户端 (浏览器) 下载所述 国际化资源文件的 URL路径。 所述 data-*属性参数的值为国际化资源文件中的 key 值。 若需要国际化的内容不是输入框的值或标签内内容, 而是标签的一个属性 , 例如 title或 placeholder, 则在所述 data-*属性参数中需要再添加一个额外的配置 项来标识该标签需被国际化的属性值, 例如 data-il8n-options。  [0039] The data-* attribute parameter, for example, data-ilSn, configures a path of the internationalized resource file to be loaded on the current page, and stores the file in the json format. The path is a URL path for the client (browser) to download the internationalized resource file. The value of the data-* attribute parameter is a key value in the internationalized resource file. If the internationalized content is not the value of the input box or the content of the label, but an attribute of the label, such as title or placeholder, then an additional configuration item needs to be added in the data-* attribute parameter to identify the label. Property values that need to be internationalized, such as data-il8n-options.
[0040] 若需要国际化该标签的多个属性, 则在所述 data-*属性参数中使用英文逗号分 隔多个 key值, 并且在所述额外的配置项中使用英文逗号分隔每一个被国际化的 标签属性, 所述多个 key值与多个标签属性需要按顺序对应。 例如, <a title= "标 题,, data-il8n=,,keyl,key2,,  [0040] If it is required to internationalize multiple attributes of the tag, separate multiple key values by using a comma in the data-* attribute parameter, and separate each of the additional configuration items with a comma The tag attribute, the multiple key values and the plurality of tag attributes need to be sequentially matched. For example, <a title= "title,, data-il8n=,, keyl, key2,,
data-il8n-options="title,html">链接 </a>表示该标签的 title属性"标题"和标签内内 容"链接"被国际化为 keyl和 key2对应的国际化资源文件中内容。  The data-il8n-options="title,html">link </a> indicates that the title attribute "title" of the tag and the content "link" in the tag are internationalized as the contents of the internationalized resource file corresponding to keyl and key2.
[0041] 所述加载模块 204设置为根据所述路径获取对应的国际化资源文件, 并按预设 顺序进行加载。 [0041] The loading module 204 is configured to acquire a corresponding internationalized resource file according to the path, and load in a preset order.
[0042] 具体地, 当得到当前页面所需加载的国际化资源文件的路径后, 根据该页面的 语言环境, 获取对应的国际化资源文件。 可以通过 ajax技术获取所述国际化资源 文件。 [0042] Specifically, after obtaining the path of the internationalized resource file to be loaded by the current page, according to the page The locale, get the corresponding internationalized resource file. The internationalized resource file can be obtained through ajax technology.
[0043] 所述预设顺序为: 公共国际化资源文件 >页面私有的默认国际化资源文件 >页面 私有的对应语言环境的国际化资源文件。 例如, 针对某一页面, 有三个公共的 国际化资源文件 common.properties、 common_zh_CN.properties、 common_en_US . properties , 分别为公共的默认国际化资源文件、 公共的中文国际化资源文件、 公共的英文公国际化资源文件, 还有三个该页面私有的国际化资源文件 home.pro perties、 home_zh_CN.properties、 home_en_US .properties, 分另 'J为该页面禾厶有的 默认国际化资源文件、 私有的中文国际化资源文件、 私有的英文国际化资源文 件。 在加载过程中, 会先加载公共的默认国际化资源文件 common.properties , 再 根据语言环境加载对应语言环境的公共的国际化资源文件, 例如中文, 则加载 公共的中文国际化资源文件 common_Zh_CN.propertieS, 至此, 公共的国际化资 源文件加载完成。 然后, 加载该页面私有的国际化资源文件 home.properties和私 有的中文国际化资源文件 home_zh_CN.properties, 如此该页面对应的所有国际化 资源文件加载完成。 [0043] The preset order is: a public internationalized resource file > a page-specific default internationalized resource file > an internationalized resource file of a page-specific corresponding locale. For example, for a page, there are three public international resource files common.properties, common_zh_CN.properties, common_en_US . properties , which are public default internationalization resource files, public Chinese internationalization resource files, and public English public international. The resource file, there are three internationalized resource files home.pro perties, home_zh_CN.properties, home_en_US .properties, which are private to the page, and the default internationalized resource file for this page, private Chinese internationalization. Resource files, private English internationalization resource files. During the loading process, the common default internationalization resource file common.properties is loaded first, and then the publicized internationalized resource file corresponding to the locale is loaded according to the locale, for example, Chinese, then the public Chinese internationalization resource file common_ Z h_CN is loaded. .propertie S , At this point, the public international resource file is loaded. Then, load the page's private internationalization resource file home.properties and the private Chinese internationalization resource file home_zh_CN.properties, so that all the internationalized resource files corresponding to the page are loaded.
[0044] 通过配置公共的国际化资源文件和页面私有的国际化资源文件以及定义所述预 设顺序, 公共的国际化资源文件不需要重复加载, 减少了一些通用的内容重复 的国际化。  [0044] By configuring a common internationalized resource file and a page-specific internationalized resource file and defining the preset order, the publicized international resource file does not need to be repeatedly loaded, reducing the internationalization of some common content repetition.
[0045] 在本实施例中, 针对同一页面, 最后加载的国际化资源文件优先级最高。  [0045] In this embodiment, the last loaded internationalized resource file has the highest priority for the same page.
[0046] 所述解析模块 206设置为解析所述国际化资源文件。 [0046] The parsing module 206 is configured to parse the internationalized resource file.
[0047] 具体地, 加载国际化资源文件成功后, 将所述国际化资源文件内存储的内容解 析成键值对 (key-value) 模式, 使用公共 Map进行存储。 其中, key对应资源文 件中的 key值, value为资源文件中对应的国际化内容。 所述公共 Map提供了一种 映射关系, 其中的元素是以 key-value的形式存储的, 能够实现根据 key快速査找 v alue。 所述公共 Map中的 key值是唯一的, 不能重复, 若有相同的 key , 后加载的 国际化资源文件中的 key会覆盖先加载的国际化资源文件中的 key。 因此, 若对应 语言环境的国际化资源文件中没有相应的国际化内容, 会获取默认的国际化资 源文件中的对应值。 [0048] 所述替换模块 208设置为将所述页面内需要国际化的内容替换为所解析出的国 际化内容。 [0047] Specifically, after loading the internationalized resource file successfully, the content stored in the internationalized resource file is parsed into a key-value mode, and is stored by using a public map. Where key corresponds to the key value in the resource file, and value is the corresponding internationalized content in the resource file. The public map provides a mapping relationship, in which elements are stored in the form of key-values, which can quickly find v alue according to the key. The key value in the public map is unique and cannot be repeated. If there is the same key, the key in the loaded internationalized resource file will overwrite the key in the previously loaded internationalized resource file. Therefore, if there is no corresponding international content in the internationalized resource file corresponding to the locale, the corresponding value in the default internationalized resource file is obtained. [0048] The replacement module 208 is configured to replace the content that needs to be internationalized in the page with the parsed internationalized content.
[0049] 具体地, 当解析完毕所述国际化资源文件后, 遍历所述页面中所有设置了 data- *属性参数的标签, 根据所述 data-*属性参数从所述公共 Map中査询对应的 key值 , 从而得到对应的国际化内容, 将所述页面中需要国际化的内容替换为所得到 的国际化内容。  [0049] Specifically, after parsing the internationalized resource file, traversing all the tags in the page in which the data-* attribute parameter is set, and querying the corresponding map from the public Map according to the data-* attribute parameter. The key value is used to obtain the corresponding internationalized content, and the content that needs to be internationalized on the page is replaced with the obtained internationalized content.
[0050] 遍历标签吋, 若标签没有设置对应的 data-*属性参数, 则使用默认属性来国际 化, 将需要国际化的内容替换为默认国际化内容。 若标签属于 input、 select, text area, 则为输入控件, 替换输入框值为所述国际化内容。 若是其他标签, 则替换 标签内的内容为所述国际化内容。 内容国际化不仅能国际化文本, 也可以替换 图片或其他 Html内容, 使不同的语言环境展示不同的图片。  [0050] If the tag is not traversed, if the tag does not have a corresponding data-* attribute parameter, the default attribute is used to internationalize, and the content that needs to be internationalized is replaced with the default international content. If the tag belongs to input, select, text area, it is an input control, and the input box value is replaced by the internationalized content. In the case of other tags, the content in the replacement tag is the internationalized content. Content internationalization can not only internationalize text, but also replace images or other Html content, allowing different locales to display different images.
[0051] 第三实施例  Third Embodiment
[0052] 如图 3所示, 是本发明第三实施例提出一种前端页面国际化处理程序 200的模块 示意图。 本实施例中, 所述前端页面国际化处理程序 200除了包括第二实施例中 的所述读取模块 202、 加载模块 204、 解析模块 206及替换模块 208之外, 还包括 配置模块 210和设置模块 212。  As shown in FIG. 3, a third embodiment of the present invention provides a schematic diagram of a front-end page internationalization processing program 200. In this embodiment, the front-end page internationalization processing program 200 includes a configuration module 210 and a setting in addition to the reading module 202, the loading module 204, the parsing module 206, and the replacement module 208 in the second embodiment. Module 212.
[0053] 所述配置模块 210设置为配置所述页面对应的国际化资源文件。  [0053] The configuration module 210 is configured to configure an internationalized resource file corresponding to the page.
[0054] 具体地, 所述国际化资源文件内以 key-value的模式存储国际化内容, 所述国际 化资源文件以文件名加语言的方式命名。 另外, 所述配置模块 210还可以配置一 个不加语言后缀的国际化资源资源文件, 存储预设的默认国际化内容, 作为默 认的国际化资源文件。 当后续找不到对应的语言的国际化资源文件或在在对应 的语言的国际化资源文件中找不到国际化内容吋, 可以从所述默认国际化资源 文件中获取默认的国际化内容。  [0054] Specifically, the internationalized resource file stores the internationalized content in a key-value mode, and the internationalized resource file is named by a file name plus a language. In addition, the configuration module 210 can also configure an international resource resource file without a language suffix, and store the preset default internationalized content as a default internationalized resource file. When the internationalized resource file of the corresponding language cannot be found later or the internationalized content is not found in the internationalized resource file of the corresponding language, the default internationalized content can be obtained from the default internationalized resource file.
[0055] 在其他实施例中, 所述配置模块 210配置所述国际化资源文件吋, 可以将多个 页面通用的国际化内容存储在一个公共的国际化资源文件内。 例如"日期"、 "确 定"、 "取消"等词汇对应的国际化内容, 可以存放在所述公共的国际化资源文件 内, 供所有页面调用。  In other embodiments, the configuration module 210 configures the internationalized resource file to store the internationalized content common to multiple pages in a common internationalized resource file. For example, the internationalized content corresponding to the words "date", "confirm", "cancel", etc., can be stored in the publicized international resource file for all pages to call.
[0056] 所述设置模块 212设置为在页面根节点设置属性参数, 以对应当前页面所需加 载的国际化资源文件的路径。 [0056] The setting module 212 is configured to set an attribute parameter at the root of the page to correspond to the current page. The path to the internationalized resource file.
[0057] 具体地, 在本实施例中, 在待国际化的静态页面的根节点中增加 data-*属性, 并为该页面中每一个需要国际化的内容的标签设置一个 data-*属性参数, 例如 dat a-il8n, 配置当前页面所需加载的国际化资源文件的路径, 以 json格式进行存储 。 其中, 所述路径为客户端 (浏览器) 下载所述国际化资源文件的 URL路径。 所述 data-*属性参数的值为国际化资源文件中的 key值。 若需要国际化的内容不是 输入框的值或标签内内容, 而是标签的一个属性, 例如 title或 placeholder, 则在 所述 data-*属性参数中需要再添加一个额外的配置项来标识该标签需被国际化的 属性值, 例如 data-il8n-options。  [0057] Specifically, in this embodiment, a data-* attribute is added to a root node of a static page to be internationalized, and a data-* attribute parameter is set for each label of the content that needs to be internationalized in the page. For example, dat a-il8n, configure the path of the internationalized resource file to be loaded on the current page, and store it in json format. The path is a URL path for the client (browser) to download the internationalized resource file. The value of the data-* attribute parameter is a key value in the internationalized resource file. If the internationalized content is not the value of the input box or the content of the label, but an attribute of the label, such as title or placeholder, then an additional configuration item needs to be added in the data-* attribute parameter to identify the label. Property values that need to be internationalized, such as data-il8n-options.
[0058] 若需要国际化该标签的多个属性, 则在所述 data-*属性参数中使用英文逗号分 隔多个 key值, 并且在所述额外的配置项中使用英文逗号分隔每一个被国际化的 标签属性, 所述多个 key值与多个标签属性需要按顺序对应。 例如, <a title= "标 题,, data-il8n=,,keyl,key2,,  [0058] If it is required to internationalize multiple attributes of the tag, separate multiple key values by using a comma in the data-* attribute parameter, and separate each of the additional configuration items with a comma The tag attribute, the multiple key values and the plurality of tag attributes need to be sequentially matched. For example, <a title= "title,, data-il8n=,, keyl, key2,,
data-il8n-options="title,html">链接 </a>表示该标签的 title属性"标题"和标签内内 容"链接"被国际化为 keyl和 key2对应的国际化资源文件中内容。  The data-il8n-options="title,html">link </a> indicates that the title attribute "title" of the tag and the content "link" in the tag are internationalized as the contents of the internationalized resource file corresponding to keyl and key2.
[0059] 若是一行文本只有部分内容需要国际化, 可以使用一个行内标签包裹待国际化 元素。 例如 <a ><i data-il8n="key2">链接 </i>: 123456</a>, 只针对被<^><^>标 签包裹的内容 "链接 "国际化, 对 i标签外的内容不会国际化。  [0059] If only a portion of the content of a line of text needs to be internationalized, an inline tag can be used to wrap the elements to be internationalized. For example, <a ><i data-il8n="key2">link</i>: 123456</a>, only for the content "link" internationalized by the <^><^> tag, outside the i tag The content will not be internationalized.
[0060] 通过 data-*属性参数设置需要国际化的 Html页面, 使该页面所有 Html标签可以 使用一个公共的 JS文件, 一次设置后不需要对 js进行额外的操作。  [0060] The Html page that needs to be internationalized is set by the data-* attribute parameter, so that all Html tags of the page can use a common JS file, and no additional operations need to be performed on js after setting once.
[0061] 在其他实施例中, 也可以通过设置其他自定义的属性参数, 然后在后续使用 JS 的 getAttribute或 jQuery的 attr方法来读取所述自定义的属性参数。 所述自定义的属 性参数中所配置的内容也可以使用数组或特定标点符号的字符串来定义。 其他 格式的配置与所述 json格式的 data-*属性参数类似, 在此不再赘述。  [0061] In other embodiments, the custom attribute parameters may also be read by setting other custom attribute parameters and then using JS's getAttribute or jQuery's attr method. The content configured in the custom attribute parameter can also be defined using an array or a string of specific punctuation. The configuration of the other format is similar to the data-* attribute parameter of the json format, and will not be described here.
[0062] 在所述配置模块 210和所述设置模块 212完成对所述页面对应的国际化资源文件 的配置和 data-*属性参数的设置后, 在加载所述页面会根据所述 data-*属性参数 自动读取对应的国际化资源文件, 从而输出国际化后的内容。  [0062] After the configuration module 210 and the setting module 212 complete the configuration of the internationalized resource file corresponding to the page and the data-* attribute parameter, the page is loaded according to the data-*. The attribute parameter automatically reads the corresponding internationalized resource file, thereby outputting the internationalized content.
[0063] 第四实施例 [0064] 如图 4所示, 本发明第四实施例提出一种前端页面国际化处理方法。 该方法包 括以下步骤: Fourth Embodiment [0064] As shown in FIG. 4, a fourth embodiment of the present invention provides a front page page internationalization processing method. The method includes the following steps:
[0065] S402, 读取页面根节点设置的属性参数, 得到当前页面所需加载的国际化资源 文件的路径。  [0065] S402. Read an attribute parameter set by the root node of the page, and obtain a path of the internationalized resource file to be loaded by the current page.
[0066] 具体地, 当需要加载静态页面吋, 使用公共 JS读取该页面根节点设置的 data-* 属性参数, 得到该页面所需加载的国际化资源文件的路径。  [0066] Specifically, when a static page needs to be loaded, the public JS is used to read the data-* attribute parameter set by the root node of the page, to obtain a path of the internationalized resource file to be loaded on the page.
[0067] 所述 data-*属性参数, 例如 data-ilSn, 配置当前页面所需加载的国际化资源文 件的路径, 以 json格式进行存储。 其中, 所述路径为客户端 (浏览器) 下载所述 国际化资源文件的 URL路径。 所述 data-*属性参数的值为国际化资源文件中的 key 值。 若需要国际化的内容不是输入框的值或标签内内容, 而是标签的一个属性 , 例如 title或 placeholder, 则在所述 data-*属性参数中需要再添加一个额外的配置 项来标识该标签需被国际化的属性值, 例如 data-il8n-options。  [0067] The data-* attribute parameter, for example, data-ilSn, configures the path of the internationalized resource file to be loaded on the current page, and stores it in the json format. The path is a URL path for the client (browser) to download the internationalized resource file. The value of the data-* attribute parameter is a key value in the internationalized resource file. If the internationalized content is not the value of the input box or the content of the label, but an attribute of the label, such as title or placeholder, then an additional configuration item needs to be added in the data-* attribute parameter to identify the label. Property values that need to be internationalized, such as data-il8n-options.
[0068] 若需要国际化该标签的多个属性, 则在所述 data-*属性参数中使用英文逗号分 隔多个 key值, 并且在所述额外的配置项中使用英文逗号分隔每一个被国际化的 标签属性, 所述多个 key值与多个标签属性需要按顺序对应。 例如, <a title= "标 题,, data-il8n=,,keyl,key2,,  [0068] If it is required to internationalize a plurality of attributes of the tag, a plurality of key values are separated by a comma in the data-* attribute parameter, and each of the additional configuration items is separated by a comma. The tag attribute, the multiple key values and the plurality of tag attributes need to be sequentially matched. For example, <a title= "title,, data-il8n=,, keyl, key2,,
data-il8n-options="title,html">链接 </a>表示该标签的 title属性"标题"和标签内内 容"链接"被国际化为 keyl和 key2对应的国际化资源文件中内容。  The data-il8n-options="title,html">link </a> indicates that the title attribute "title" of the tag and the content "link" in the tag are internationalized as the contents of the internationalized resource file corresponding to keyl and key2.
[0069] S404, 根据所述路径获取对应的国际化资源文件, 并按预设顺序进行加载。 [0069] S404. Acquire a corresponding internationalized resource file according to the path, and load in a preset order.
[0070] 具体地, 当得到当前页面所需加载的国际化资源文件的路径后, 根据该页面的 语言环境, 获取对应的国际化资源文件。 可以通过 ajax技术获取所述国际化资源 文件。 [0070] Specifically, after obtaining the path of the internationalized resource file to be loaded by the current page, the corresponding internationalized resource file is obtained according to the locale of the page. The internationalized resource file can be obtained through ajax technology.
[0071] 所述预设顺序为: 公共的默认国际化资源文件、 公共的对应语言环境的国际化 资源文件、 页面私有的默认国际化资源文件、 页面私有的对应语言环境的国际 化资源文件。 例如, 针对某一页面, 有三个公共的国际化资源文件 common.prop erties、 common_zh_CN.properties、 common_en_US .properties, 分另1 J为公共的黒犬 认国际化资源文件、 公共的中文国际化资源文件、 公共的英文公国际化资源文 件, 还有三个该页面私有的国际化资源文件 home.properties、 home_zh_CN.proper ties . home_en_US.properties , 分别为该页面私有的默认国际化资源文件、 私有 的中文国际化资源文件、 私有的英文国际化资源文件。 在加载过程中, 会先加 载公共的默认国际化资源文件 common.properties , 再根据语言环境加载对应语言 环境的公共的国际化资源文件, 例如中文, 则加载公共的中文国际化资源文件 co mmon_zh_CN.properties , 至此, 公共的国际化资源文件加载完成。 然后, 加载 该页面私有的国际化资源文件 home.properties和私有的中文国际化资源文件 home _zh_CN.properties , 如此该页面对应的所有国际化资源文件加载完成。 [0071] The preset order is: a public default international resource file, an internationalized resource file of a common corresponding locale, a default internationalized resource file of the page private, and an internationalized resource file corresponding to the local language of the page. For example, for a page, there are three public international resource files common.prop erties, common_zh_CN.properties, common_en_US .properties, and another 1 J is a public dog internationalization resource file, a public Chinese internationalization resource file. Public English international resource files, and three internationalized resource files home.properties, home_zh_CN.proper Ties . home_en_US.properties , which are the default internationalized resource files for the page, the private Chinese internationalization resource files, and the private English internationalization resource files. During the loading process, the public default internationalization resource file common.properties is loaded first, and then the publicized internationalized resource file corresponding to the locale is loaded according to the locale, for example, Chinese, then the public Chinese internationalization resource file co mmon_zh_CN is loaded. Properties, at this point, the public international resource file is loaded. Then, load the page's private internationalization resource file home.properties and the private Chinese internationalization resource file home_zh_CN.properties, so that all the internationalized resource files corresponding to the page are loaded.
[0072] 通过配置公共的国际化资源文件和页面私有的国际化资源文件以及定义所述预 设顺序, 公共的国际化资源文件不需要重复加载, 减少了一些通用的内容重复 的国际化。 [0072] By configuring a common internationalized resource file and a page-specific internationalized resource file and defining the preset order, the publicized international resource file does not need to be repeatedly loaded, reducing the internationalization of some common content duplication.
[0073] 在本实施例中, 针对同一页面, 最后加载的国际化资源文件优先级最高。  [0073] In this embodiment, the last loaded internationalized resource file has the highest priority for the same page.
[0074] S406 , 解析所述国际化资源文件。 [0074] S406. Parse the internationalized resource file.
[0075] 具体地, 加载国际化资源文件成功后, 将所述国际化资源文件内存储的内容解 析成 key-value模式, 使用公共 Map进行存储。 其中, key对应资源文件中的 key值 , value为资源文件中对应的国际化内容。 所述公共 Map提供了一种映射关系, 其中的元素是以 key-value的形式存储的, 能够实现根据 key快速査找 value。 所述 公共 Map中的 key值是唯一的, 不能重复, 若有相同的 key , 后加载的国际化资源 文件中的 key会覆盖先加载的国际化资源文件中的 key。 因此, 若对应语言环境的 国际化资源文件中没有相应的国际化内容, 会获取默认的国际化资源文件中的 对应值。 [0075] Specifically, after the internationalized resource file is successfully loaded, the content stored in the internationalized resource file is parsed into a key-value mode, and is stored by using a public map. Where key corresponds to the key value in the resource file, and value is the corresponding internationalized content in the resource file. The public map provides a mapping relationship, wherein the elements are stored in the form of a key-value, which can quickly find a val ue according to the key. The key value in the public map is unique and cannot be repeated. If there is the same key, the key in the loaded internationalized resource file will overwrite the key in the previously loaded internationalized resource file. Therefore, if there is no corresponding international content in the internationalized resource file corresponding to the locale, the corresponding value in the default internationalized resource file is obtained.
[0076] S408 , 将所述页面内需要国际化的内容替换为所解析出的国际化内容。  [0076] S408. Replace the content that needs to be internationalized in the page with the parsed internationalized content.
[0077] 具体地, 当解析完毕所述国际化资源文件后, 遍历所述页面中所有设置了 data- *属性参数的标签, 根据所述 data-*属性参数从所述公共 Map中査询对应的 key值 , 从而得到对应的国际化内容, 将所述页面中需要国际化的内容替换为所得到 的国际化内容。 [0077] Specifically, after parsing the internationalized resource file, traversing all the tags in the page with the data-* attribute parameter, and querying the corresponding information from the public Map according to the data-* attribute parameter. The key value is used to obtain the corresponding internationalized content, and the content that needs to be internationalized on the page is replaced with the obtained internationalized content.
[0078] 遍历标签吋, 若标签没有设置对应的 data-*属性参数, 则使用默认属性来国际 化, 将需要国际化的内容替换为默认国际化内容。 若标签属于 input、 select, text area, 则为输入控件, 替换输入框值为所述国际化内容。 若是其他标签, 则替换 标签内的内容为所述国际化内容。 内容国际化不仅能国际化文本, 也可以替换 图片或其他 Html内容, 使不同的语言环境展示不同的图片。 [0078] The traversal tag 吋, if the tag does not set the corresponding data-* attribute parameter, the default attribute is used to internationalize, and the content that needs to be internationalized is replaced with the default international content. If the tag belongs to input, select, and text area, it is an input control, and the input box value is replaced by the internationalized content. If it is another label, replace it The content within the tag is the internationalized content. Content internationalization can not only internationalize text, but also replace images or other Html content, so that different locales can display different images.
[0079] 第五实施例 Fifth Embodiment
[0080] 如图 5所示, 本发明第五实施例提出一种前端页面国际化处理方法。 本实施例 中, 所述前端页面国际化处理方法的步骤 S506-S512与第四实施例的步骤 S402-S4 08相类似, 区别在于该方法还包括步骤 S502-S504。  [0080] As shown in FIG. 5, a fifth embodiment of the present invention provides a front page page internationalization processing method. In this embodiment, the steps S506-S512 of the front-end page internationalization processing method are similar to the steps S402-S4 08 of the fourth embodiment, except that the method further includes steps S502-S504.
[0081] 该方法包括以下步骤:  [0081] The method comprises the following steps:
[0082] S502, 配置所述页面对应的国际化资源文件。  [0082] S502. Configure an internationalization resource file corresponding to the page.
[0083] 具体地, 所述国际化资源文件内以 key-value的模式存储国际化内容, 所述国际 化资源文件以文件名加语言的方式命名。 另外, 所述配置模块 210还可以配置一 个不加语言后缀的国际化资源资源文件, 存储预设的默认国际化内容, 作为默 认的国际化资源文件。 当后续找不到对应的语言的国际化资源文件或在在对应 的语言的国际化资源文件中找不到国际化内容吋, 可以从所述默认国际化资源 文件中获取默认的国际化内容。  [0083] Specifically, the internationalized resource file stores the internationalized content in a key-value mode, and the internationalized resource file is named by a file name plus a language. In addition, the configuration module 210 can also configure an international resource resource file without a language suffix, and store the preset default internationalized content as a default internationalized resource file. When the internationalized resource file of the corresponding language cannot be found later or the internationalized content is not found in the internationalized resource file of the corresponding language, the default internationalized content can be obtained from the default internationalized resource file.
[0084] 在其他实施例中, 所述配置模块 210配置所述国际化资源文件吋, 可以将多个 页面通用的国际化内容存储在一个公共的国际化资源文件内。 例如"日期"、 "确 定"、 "取消"等词汇对应的国际化内容, 可以存放在所述公共的国际化资源文件 内, 供所有页面调用。 In other embodiments, the configuration module 210 configures the internationalized resource file to store the internationalized content common to multiple pages in a common internationalized resource file. For example, the internationalized content corresponding to the words "date", "confirm", "cancel", etc., can be stored in the publicized international resource file for all pages to call.
[0085] S504, 在页面根节点设置属性参数, 以对应当前页面所需加载的国际化资源文 件的路径。  [0085] S504. Set an attribute parameter at the root node of the page to correspond to a path of the internationalized resource file to be loaded by the current page.
[0086] 具体地, 在本实施例中, 在待国际化的静态页面的根节点中增加 data-*属性, 并为该页面中每一个需要国际化的内容的标签设置一个 data-*属性参数, 例如 dat a-il8n, 配置当前页面所需加载的国际化资源文件的路径, 以 json格式进行存储 。 其中, 所述路径为客户端 (浏览器) 下载所述国际化资源文件的 URL路径。 所述 data-*属性参数的值为国际化资源文件中的 key值。 若需要国际化的内容不是 输入框的值或标签内的内容, 而是标签的一个属性, 例如 title或 placeholder, 贝 lj 在所述 data-*属性参数中需要再添加一个额外的配置项来标识该标签需被国际化 的属性值, 例如 data-il8n-options。 [0087] 若需要国际化该标签的多个属性, 则在所述 data-*属性参数中使用英文逗号分 隔多个 key值, 并且在所述额外的配置项中使用英文逗号分隔每一个被国际化的 标签属性, 所述多个 key值与多个标签属性需要按顺序对应。 例如, <a title= "标 题,, data-il8n=,,keyl,key2,, [0086] Specifically, in this embodiment, a data-* attribute is added to a root node of a static page to be internationalized, and a data-* attribute parameter is set for each label of the content that needs to be internationalized in the page. For example, dat a-il8n, configure the path of the internationalized resource file to be loaded on the current page, and store it in json format. The path is a URL path for the client (browser) to download the internationalized resource file. The value of the data-* attribute parameter is a key value in the internationalized resource file. If the internationalized content is not the value of the input box or the content of the label, but an attribute of the label, such as title or placeholder, the shell lj needs to add an additional configuration item to identify the data-* attribute parameter. The tag needs to be internationalized attribute values, such as data-il8n-options. [0087] If it is required to internationalize a plurality of attributes of the tag, a plurality of key values are separated by a comma in the data-* attribute parameter, and each of the additional configuration items is separated by a comma. The tag attribute, the multiple key values and the plurality of tag attributes need to be sequentially matched. For example, <a title= "title,, data-il8n=,, keyl, key2,,
data-il8n-options="title,html">链接 </a>表示该标签的 title属性"标题"和标签内内 容"链接"被国际化为 keyl和 key2对应的国际化资源文件中内容。  The data-il8n-options="title,html">link </a> indicates that the title attribute "title" of the tag and the content "link" in the tag are internationalized as the contents of the internationalized resource file corresponding to keyl and key2.
[0088] 若是一行文本只有部分内容需要国际化, 可以使用一个行内标签包裹待国际化 元素。 例如 <a ><i data-il8n="key2">链接 </i>: 123456</a>, 只针对被<^><^>标 签包裹的内容 "链接 "国际化, 对 i标签外的内容不会国际化。  [0088] If only a portion of the content of a line of text needs to be internationalized, an inline tag can be used to wrap the elements to be internationalized. For example, <a ><i data-il8n="key2">link</i>: 123456</a>, only for the content "link" internationalized by the <^><^> tag, outside the i tag The content will not be internationalized.
[0089] 通过 data-*属性参数设置需要国际化的 Html页面, 使该页面所有 Html标签可以 使用一个公共的 JS文件, 一次设置后不需要对 js进行额外的操作。  [0089] The Html page that needs to be internationalized is set by the data-* attribute parameter, so that all Html tags of the page can use a common JS file, and no additional operations need to be performed on js after setting once.
[0090] 在其他实施例中, 也可以通过设置其他自定义的属性参数, 然后在后续使用 JS 的 getAttribute或 jQuery的 attr方法来读取所述自定义的属性参数。 所述自定义的属 性参数中所配置的内容也可以使用数组或特定标点符号的字符串来定义。 其他 格式的配置与所述 json格式的 data-*属性参数类似, 在此不再赘述。  [0090] In other embodiments, the custom attribute parameters may also be read by setting other custom attribute parameters and then using JS's getAttribute or jQuery's attr method. The content configured in the custom attribute parameter can also be defined using an array or a string of specific punctuation. The configuration of the other format is similar to the data-* attribute parameter of the json format, and will not be described here.
[0091] S506 , 读取页面根节点设置的属性参数, 得到所述国际化资源文件的路径。  [0091] S506. Read an attribute parameter set by the root node of the page, and obtain a path of the internationalized resource file.
[0092] 具体地, 当需要加载静态页面吋, 使用公共 JS读取该页面根节点设置的 data-* 属性参数, 得到该页面所需加载的国际化资源文件的路径。  [0092] Specifically, when a static page needs to be loaded, the public JS is used to read the data-* attribute parameter set by the root node of the page, to obtain a path of the internationalized resource file to be loaded on the page.
[0093] S508 , 根据所述路径获取对应的国际化资源文件, 并按预设顺序进行加载。  [0093] S508. Acquire a corresponding internationalized resource file according to the path, and load in a preset order.
[0094] 具体地, 当得到当前页面所需加载的国际化资源文件的路径后, 根据该页面的 语言环境, 获取对应的国际化资源文件。 可以通过 ajax技术获取所述国际化资源 文件。  [0094] Specifically, after obtaining the path of the internationalized resource file to be loaded by the current page, the corresponding internationalized resource file is obtained according to the locale of the page. The internationalized resource file can be obtained through ajax technology.
[0095] 所述预设顺序为: 公共的默认国际化资源文件、 公共的对应语言环境的国际化 资源文件、 页面私有的默认国际化资源文件、 页面私有的对应语言环境的国际 化资源文件。 例如, 针对某一页面, 有三个公共的国际化资源文件 common.prop erties、 common_zh_CN.properties、 common_en_US .properties, 分另1 J为公共的黒犬 认国际化资源文件、 公共的中文国际化资源文件、 公共的英文公国际化资源文 件, 还有三个该页面私有的国际化资源文件 home.properties、 home_zh_CN.proper ties . home_en_US.properties , 分别为该页面私有的默认国际化资源文件、 私有 的中文国际化资源文件、 私有的英文国际化资源文件。 在加载过程中, 会先加 载公共的默认国际化资源文件 common.properties , 再根据语言环境加载对应语言 环境的公共的国际化资源文件, 例如中文, 则加载公共的中文国际化资源文件 co mmon_zh_CN.properties , 至此, 公共的国际化资源文件加载完成。 然后, 加载 该页面私有的国际化资源文件 home.properties和私有的中文国际化资源文件 home _zh_CN.properties , 如此该页面对应的所有国际化资源文件加载完成。 [0095] The preset order is: a public default international resource file, an internationalized resource file of a common corresponding locale, a default internationalized resource file of the page private, and an internationalized resource file corresponding to the local language of the page. For example, for a page, there are three public international resource files common.prop erties, common_zh_CN.properties, common_en_US .properties, and another 1 J is a public dog internationalization resource file, a public Chinese internationalization resource file. Public English international resource files, and three internationalized resource files home.properties, home_zh_CN.proper Ties . home_en_US.properties , which are the default internationalized resource files for the page, the private Chinese internationalization resource files, and the private English internationalization resource files. During the loading process, the public default internationalization resource file common.properties is loaded first, and then the publicized internationalized resource file corresponding to the locale is loaded according to the locale, for example, Chinese, then the public Chinese internationalization resource file co mmon_zh_CN is loaded. Properties, at this point, the public international resource file is loaded. Then, load the page's private internationalization resource file home.properties and the private Chinese internationalization resource file home_zh_CN.properties, so that all the internationalized resource files corresponding to the page are loaded.
[0096] 通过配置公共的国际化资源文件和页面私有的国际化资源文件以及定义所述预 设顺序, 公共的国际化资源文件不需要重复加载, 减少了一些通用的内容重复 的国际化。 [0096] By configuring a common internationalized resource file and a page-specific internationalized resource file and defining the preset order, the publicized international resource file does not need to be repeatedly loaded, which reduces the internationalization of some common content.
[0097] 在本实施例中, 针对同一页面, 最后加载的国际化资源文件优先级最高。  [0097] In this embodiment, the last loaded internationalized resource file has the highest priority for the same page.
[0098] S510, 解析所述国际化资源文件。 [0098] S510. Parse the internationalized resource file.
[0099] 具体地, 加载国际化资源文件成功后, 将所述国际化资源文件内存储的内容解 析成 key-value模式, 使用公共 Map进行存储。 其中, key对应资源文件中的 key值 , value为资源文件中对应的国际化内容。 所述公共 Map提供了一种映射关系, 其中的元素是以 key-value的形式存储的, 能够实现根据 key快速査找 value。 所述 公共 Map中的 key值是唯一的, 不能重复, 若有相同的 key , 后加载的国际化资源 文件中的 key会覆盖先加载的国际化资源文件中的 key。 因此, 若对应语言环境的 国际化资源文件中没有相应的国际化内容, 会获取默认的国际化资源文件中的 对应值。 [0099] Specifically, after loading the internationalized resource file successfully, the content stored in the internationalized resource file is parsed into a key-value mode, and is stored by using a public map. Where key corresponds to the key value in the resource file, and value is the corresponding internationalized content in the resource file. The public map provides a mapping relationship, wherein the elements are stored in the form of a key-value, which can quickly find a val ue according to the key. The key value in the public map is unique and cannot be repeated. If there is the same key, the key in the loaded internationalized resource file will overwrite the key in the previously loaded internationalized resource file. Therefore, if there is no corresponding international content in the internationalized resource file corresponding to the locale, the corresponding value in the default internationalized resource file is obtained.
[0100] S512, 将所述页面内需要国际化的内容替换为所解析出的国际化内容。  [0100] S512. Replace the content that needs to be internationalized in the page with the parsed internationalized content.
[0101] 具体地, 当解析完毕所述国际化资源文件后, 遍历所述页面中所有设置了 data- *属性参数的标签, 根据所述 data-*属性参数从所述公共 Map中査询对应的 key值 , 从而得到对应的国际化内容, 将所述页面中需要国际化的内容替换为所得到 的国际化内容。 [0101] Specifically, after parsing the internationalized resource file, traversing all the tags in the page in which the data-* attribute parameter is set, and querying the corresponding map from the public Map according to the data-* attribute parameter. The key value is used to obtain the corresponding internationalized content, and the content that needs to be internationalized on the page is replaced with the obtained internationalized content.
[0102] 遍历标签吋, 若标签没有设置对应的 data-*属性参数, 则使用默认属性来国际 化, 将需要国际化的内容替换为默认国际化内容。 若标签属于 input、 select, text area, 则为输入控件, 替换输入框值为所述国际化内容。 若是其他标签, 则替换 标签内的内容为所述国际化内容。 内容国际化不仅能国际化文本, 也可以替换 图片或其他 Html内容, 使不同的语言环境展示不同的图片。 [0102] The traversal tag 吋, if the tag does not set the corresponding data-* attribute parameter, the default attribute is used to internationalize, and the content that needs to be internationalized is replaced with the default international content. If the tag belongs to input, select, and text area, it is an input control, and the input box value is replaced by the internationalized content. If it is another label, replace it The content within the tag is the internationalized content. Content internationalization can not only internationalize text, but also replace images or other Html content, so that different locales can display different images.
[0103] 需要说明的是, 在本文中, 术语"包括"、 "包含 "或者其任何其他变体意在涵盖 非排他性的包含, 从而使得包括一系列要素的过程、 方法、 物品或者装置不仅 包括那些要素, 而且还包括没有明确列出的其他要素, 或者是还包括为这种过 程、 方法、 物品或者装置所固有的要素。 在没有更多限制的情况下, 由语句 "包 括一个 ...... "限定的要素, 并不排除在包括该要素的过程、 方法、 物品或者装置 中还存在另外的相同要素。  [0103] It is to be understood that the term "comprises", "comprising" or any other variants thereof is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes Those elements, but also other elements not explicitly listed, or elements that are inherent to such a process, method, item or device. An element defined by the phrase "comprises a ..." without further restrictions does not exclude the presence of additional elements in the process, method, article, or device that comprises the element.
[0104] 通过以上的实施方式的描述, 本领域的技术人员可以清楚地了解到上述实施例 方法可借助软件加必需的通用硬件平台的方式来实现, 当然也可以通过硬件来 实现, 但很多情况下前者是更佳的实施方式。 基于这样的理解, 本发明的技术 方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来 , 该计算机软件产品存储在一个存储介质 (如 ROM/RAM、 磁碟、 光盘) 中, 包 括若干指令用以使得一台终端设备 (可以是手机, 计算机, 服务器, 空调器, 或者网络设备等) 执行本发明各个实施例所述的方法。  Through the description of the above embodiments, those skilled in the art can clearly understand that the foregoing method can be implemented by means of software plus a necessary general hardware platform, and can also be implemented by hardware, but in many cases. The former is a better implementation. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, The optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
[0105] 以上参照附图说明了本发明的优选实施例, 并非因此局限本发明的权利范围。  The preferred embodiments of the present invention have been described above with reference to the drawings, and are not intended to limit the scope of the invention.
上述本发明实施例序号仅仅为了描述, 不代表实施例的优劣。 另外, 虽然在流 程图中示出了逻辑顺序, 但是在某些情况下, 可以以不同于此处的顺序执行所 示出或描述的步骤。  The serial numbers of the embodiments of the present invention are merely for the description, and do not represent the advantages and disadvantages of the embodiments. In addition, although the logical order is shown in the flowchart, in some cases the steps shown or described may be performed in a different order than the ones described herein.
[0106] 本领域技术人员不脱离本发明的范围和实质, 可以有多种变型方案实现本发明 , 比如作为一个实施例的特征可用于另一实施例而得到又一实施例。 凡在运用 本发明的技术构思之内所作的任何修改、 等同替换和改进, 均应在本发明的权 利范围之内。  A person skilled in the art can implement the invention in various modifications without departing from the scope and spirit of the invention. For example, the features of one embodiment can be used in another embodiment to obtain a further embodiment. Any modifications, equivalent substitutions and improvements made within the technical concept of the invention are intended to be within the scope of the invention.
工业实用性  Industrial applicability
[0107] 本发明提出的前端页面国际化处理方法、 应用服务器及计算机可读存储介质, 能够完全分离网站前后端页面, 使前端页面完整的独立出来, 与后端服务的平 台、 幵发语言完全无关而实施前端静态页面的国际化。 使用 Html5标准的自定义 数据 data-*属性参数, 通过静态页面的配置, 直接使用公共 JS文件读取并遍历页 面 data-*属性配置, 不再需要为每个页面单独编写 JS文件, 方便的将需要国际化 的内容替换为对应的语言内容, 简化了前端国际化的工作量, 提高了幵发效率 。 并且可以实现页面内容与提示信息、 标签自定义属性等提示性内容的国际化 , 满足了一些页面的特殊需求。 [0107] The front page internationalization processing method, the application server and the computer readable storage medium proposed by the invention can completely separate the front and back pages of the website, so that the front end page is completely independent, and the platform of the back end service is completely complete. Independent of the implementation of the internationalization of the front-end static pages. Use the Html5 standard custom data data-* attribute parameter to read and traverse the page directly using the public JS file through the configuration of the static page. With the data-* attribute configuration, it is no longer necessary to write a separate JS file for each page. It is convenient to replace the internationalized content with the corresponding language content, which simplifies the front-end internationalization workload and improves the bursting efficiency. And it can realize the internationalization of the prompt content of the page content and prompt information, label custom attributes, etc., to meet the special needs of some pages.
此外, 本发明使用了公共的国际化资源文件与页面私有的国际化资源文件双重 加载的方式, 能够同吋加载不同目录下的公共国际化资源文件, 对于一些通用 的国际化资源统一加载, 页面私有的国际化资源按需加载来实现对于国际化语 言数据重复劳作的减少与页面加载效率之间的平衡。 并且充分的利用了 JS的原生 解析方式和 ajax的特性, 保证了页面解析效率。 同吋, 基于浏览器的特性, ajax 会自动缓存加载的国际化资源文件, 第二次打幵相同页面再次国际化的吋候, 不需要重复的下载国际化资源文件, 会自动从缓存中读取。 充分利用了浏览器 自身的缓存机制, 使得页面第二次加载的效率更进一步的提升。 因此, 具有工 业实用性。  In addition, the present invention uses a public international resource file and a page-localized international resource file to be dual-loaded, and can simultaneously load common internationalized resource files in different directories, and is uniformly loaded for some common international resources. Private international resources are loaded on demand to achieve a balance between reduced work of internationalized language data and page loading efficiency. And make full use of JS's native parsing and ajax features to ensure page parsing efficiency. Similarly, browser-based features, ajax will automatically cache the loaded international resource file, the second time you fight the same page again internationalization, do not need to repeatedly download the internationalized resource file, will automatically read from the cache take. Make full use of the browser's own caching mechanism, so that the efficiency of the second page loading is further improved. Therefore, it has industrial applicability.

Claims

权利要求书 Claim
一种前端页面国际化处理方法, 应用于应用服务器中, 该方法包括步 骤: A front-end page internationalization processing method is applied to an application server, and the method includes the following steps:
读取页面根节点设置的属性参数, 得到当前页面所需加载的国际化资 源文件的路径; Read the attribute parameter set by the root node of the page to obtain the path of the internationalization resource file to be loaded on the current page;
根据所述路径获取对应的国际化资源文件, 并按预设顺序进行加载; 解析所述国际化资源文件; 及将所述页面内需要国际化的内容替换为 所解析出的国际化内容。 Obtaining a corresponding internationalized resource file according to the path, and loading in a preset order; parsing the internationalized resource file; and replacing the content that needs to be internationalized in the page with the parsed internationalized content.
根据权利要求 1所述的前端页面国际化处理方法, 其中, 该方法在所 述读取页面根节点设置的属性参数的步骤之前还包括步骤: 配置所述页面对应的国际化资源文件; The front-end page internationalization processing method according to claim 1, wherein the method further comprises the step of: configuring an internationalized resource file corresponding to the page before the step of reading the attribute parameter set by the root node of the page;
在所述页面根节点设置属性参数, 以对应当前页面所需加载的国际化 资源文件的路径。 The attribute parameter is set at the root node of the page to correspond to the path of the internationalization resource file to be loaded by the current page.
根据权利要求 2所述的前端页面国际化处理方法, 其中, 在所述配置 所述页面对应的国际化资源文件的步骤中, 所述国际化资源文件内以 键值对 key-value的模式存储国际化内容, 所述国际化资源文件以文件 名加语言的方式命名, 另外, 配置一个不加语言后缀的国际化资源资 源文件, 存储预设的默认国际化内容, 作为默认的国际化资源文件。 根据权利要求 3所述的前端页面国际化处理方法, 其中, 所述配置所 述页面对应的国际化资源文件的步骤还包括: 将多个页面通用的国际 化内容存储在一个公共的国际化资源文件内。 The front-end page internationalization processing method according to claim 2, wherein in the step of configuring the internationalized resource file corresponding to the page, the internationalized resource file is stored in a key-value pair key-value mode Internationalized content, the internationalized resource file is named by file name plus language. In addition, an international resource resource file without language suffix is configured, and the default default international content is stored as a default international resource file. . The method of processing the front-end page internationalization according to claim 3, wherein the step of configuring the internationalized resource file corresponding to the page further comprises: storing the internationalized content common to the plurality of pages in a common international resource. Within the file.
根据权利要求 4所述的前端页面国际化处理方法, 其中, 所述预设顺 序为: 公共的默认国际化资源文件、 公共的对应语言环境的国际化资 源文件、 页面私有的默认国际化资源文件、 页面私有的对应语言环境 的国际化资源文件。 The front-end page internationalization processing method according to claim 4, wherein the preset order is: a public default internationalized resource file, an internationalized resource file of a common corresponding locale, and a default internationalized resource file of a private page. An internationalized resource file for the corresponding locale of the page.
根据权利要求 2所述的前端页面国际化处理方法, 其中, 所述在所述 页面根节点设置属性参数的步骤具体包括: The method for processing an internationalization of a front-end page according to claim 2, wherein the step of setting an attribute parameter at the root node of the page comprises:
为所述页面中每一个需要国际化的内容的标签设置一个 data-*属性参 数, 配置当前页面所需加载的国际化资源文件的路径, 以 json格式进 行存储, 所述 data-*属性参数的值为所述国际化资源文件中的 key值。 根据权利要求 6所述的前端页面国际化处理方法, 其中, 所述在所述 页面根节点设置属性参数的步骤还包括: Set a data-* attribute parameter for each label of the content in the page that needs to be internationalized. The path of the internationalized resource file to be loaded by the current page is configured to be stored in the json format, and the value of the data-* attribute parameter is a key value in the internationalized resource file. The method for processing an internationalization of a front-end page according to claim 6, wherein the step of setting an attribute parameter at the root node of the page further comprises:
若需要国际化的内容不是输入框的值或标签内的内容, 而是标签的一 个属性, 则在所述 data-*属性参数中再添加一个额外的配置项来标识 该标签需被国际化的属性值; If the internationalized content is not the value of the input box or the content of the label, but an attribute of the label, an additional configuration item is added to the data-* attribute parameter to identify that the label needs to be internationalized. Attribute value
若需要国际化该标签的多个属性, 则在所述 data-*属性参数中使用英 文逗号分隔多个 key值, 并且在所述额外的配置项中使用英文逗号分 隔每一个被国际化的标签属性, 所述多个 key值与多个标签属性按顺 序对应。 If it is required to internationalize multiple attributes of the tag, separate multiple key values by using a comma in the data-* attribute parameter, and separate each internationalized tag with a comma in the additional configuration item. The attribute, the multiple key values and the plurality of label attributes correspond in order.
根据权利要求 2所述的前端页面国际化处理方法, 其中, 所述解析所 述国际化资源文件的步骤具体包括: The front-end page internationalization processing method according to claim 2, wherein the step of parsing the internationalized resource file specifically includes:
将所述国际化资源文件内存储的内容解析成 key-value模式, 使用公共 Map进行存储, 其中, key对应所述国际化资源文件中的 key值, value 为所述国际化资源文件中对应的国际化内容, 所述公共 Map中的 key 值是唯一的, 后加载的国际化资源文件中的 key会覆盖先加载的国际 化资源文件中的 key。 The content stored in the internationalized resource file is parsed into a key-value mode, and is stored by using a public map, where key corresponds to a key value in the internationalized resource file, and value is a corresponding value in the internationalized resource file. In the internationalized content, the key value in the public map is unique, and the key in the post-loaded internationalized resource file overwrites the key in the previously loaded internationalized resource file.
根据权利要求 8所述的前端页面国际化处理方法, 其中, 所述将所述 页面内需要国际化的内容替换为所解析出的国际化内容的步骤具体包 括: The method of processing the front-end page internationalization according to claim 8, wherein the step of replacing the content that needs to be internationalized in the page with the internationalized content that is parsed comprises:
遍历所述页面中所有设置了 data-*属性参数的标签, 根据所述 data-*属 性参数从所述公共 Map中査询对应的 key值, 从而得到对应的国际化 内容, 将所述页面中需要国际化的内容替换为所得到的国际化内容。 一种应用服务器, 所述应用服务器包括: 存储器、 处理器及存储在所 述存储器上并可在所述处理器上运行的前端页面国际化处理程序, 所 述前端页面国际化处理程序被所述处理器执行吋实现如权利要求 1至 9 中任一项所述的前端页面国际化处理方法的步骤。 [权利要求 11] 一种计算机可读存储介质, 其特征在于, 所述计算机可读存储介质上 存储有前端页面国际化处理程序, 所述前端页面国际化处理程序被处 理器执行吋实现如权利要求 1至 9中任一项所述的前端页面国际化处理 方法的步骤。 Traversing all the tags of the data-* attribute parameter in the page, and querying the corresponding key value from the public map according to the data-* attribute parameter, thereby obtaining corresponding internationalized content, and the page is The content that needs internationalization is replaced with the international content obtained. An application server, the application server includes: a memory, a processor, and a front-end page internationalization processing program stored on the memory and operable on the processor, wherein the front-end page internationalization processing program is The processor executes the steps of implementing the front-end page internationalization processing method according to any one of claims 1 to 9. [Claim 11] A computer readable storage medium, wherein the computer readable storage medium stores a front end page internationalization processing program, and the front end page internationalization processing program is executed by a processor to implement the right The step of the front page page internationalization processing method according to any one of claims 1 to 9.
PCT/CN2017/105436 2017-10-10 2017-10-10 Front-end page internationalization processing method, application server and computer readable storage medium WO2019071406A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2017/105436 WO2019071406A1 (en) 2017-10-10 2017-10-10 Front-end page internationalization processing method, application server and computer readable storage medium
CN201780009061.6A CN108885544B (en) 2017-10-10 2017-10-10 Front-end page internationalized processing method, application server and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/105436 WO2019071406A1 (en) 2017-10-10 2017-10-10 Front-end page internationalization processing method, application server and computer readable storage medium

Publications (1)

Publication Number Publication Date
WO2019071406A1 true WO2019071406A1 (en) 2019-04-18

Family

ID=64325643

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/105436 WO2019071406A1 (en) 2017-10-10 2017-10-10 Front-end page internationalization processing method, application server and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN108885544B (en)
WO (1) WO2019071406A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110413574B (en) * 2019-07-30 2023-04-07 深圳市携众通科技有限公司 Method for automatically generating code internationalized resources
CN111651221B (en) * 2020-07-14 2022-09-20 迈普通信技术股份有限公司 Annotation internationalization method and device, storage medium and electronic equipment
CN113590185B (en) * 2021-09-28 2022-02-18 苏州浪潮智能科技有限公司 Page international configuration method, device, equipment and medium based on micro front end
CN114491359A (en) * 2021-12-28 2022-05-13 北京航天智造科技发展有限公司 Webpage internationalization processing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102456041A (en) * 2010-10-29 2012-05-16 金蝶软件(中国)有限公司 Webpage language switching method and device as well as network application system
CN105138555A (en) * 2015-07-20 2015-12-09 新浪网技术(中国)有限公司 Webpage multi-language internationalization loading method and apparatus
CN106484402A (en) * 2016-09-23 2017-03-08 郑州云海信息技术有限公司 A kind of collocation method of the internationalized resources file being suitable for wildcard pattern
CN106648582A (en) * 2016-09-19 2017-05-10 济南浪潮高新科技投资发展有限公司 Implementation method for internationalized homonymous resource file deploying updating

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101193434B (en) * 2006-11-29 2010-12-08 中兴通讯股份有限公司 System and method for optimizing circuit via which the domestic roaming user calls foreign visited user
CN101710282B (en) * 2009-11-16 2013-07-17 金蝶软件(中国)有限公司 Method and device for realizing system support for multi-language resource
CN104978394A (en) * 2015-05-08 2015-10-14 安徽机电职业技术学院 Webpage tag data organization and update method for multi-language display
CN106484383B (en) * 2015-08-31 2019-08-23 阿里巴巴集团控股有限公司 Page rendering method, device and equipment
CN106569793B (en) * 2016-09-19 2020-02-14 浪潮集团有限公司 Js internationalization implementation method based on node
CN106603718A (en) * 2017-01-01 2017-04-26 国云科技股份有限公司 Uniform source management and private cloud resource synchronization method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102456041A (en) * 2010-10-29 2012-05-16 金蝶软件(中国)有限公司 Webpage language switching method and device as well as network application system
CN105138555A (en) * 2015-07-20 2015-12-09 新浪网技术(中国)有限公司 Webpage multi-language internationalization loading method and apparatus
CN106648582A (en) * 2016-09-19 2017-05-10 济南浪潮高新科技投资发展有限公司 Implementation method for internationalized homonymous resource file deploying updating
CN106484402A (en) * 2016-09-23 2017-03-08 郑州云海信息技术有限公司 A kind of collocation method of the internationalized resources file being suitable for wildcard pattern

Also Published As

Publication number Publication date
CN108885544B (en) 2021-07-02
CN108885544A (en) 2018-11-23

Similar Documents

Publication Publication Date Title
KR101824222B1 (en) Fast rendering of websites containing dynamic content and stale content
JP6114834B2 (en) Information presentation method, apparatus, program, and recording medium
WO2018077085A1 (en) Application processing method, device and storage medium
US8983935B2 (en) Methods for utilizing a javascript emulator in a web content proxy server and devices thereof
US20160170712A1 (en) Method for integrally implementing development and release of APP
WO2019071406A1 (en) Front-end page internationalization processing method, application server and computer readable storage medium
US20180225387A1 (en) Method and apparatus for accessing webpage, apparatus and non-volatile computer storage medium
CN104754062B (en) Information popularization method, server and user terminal based on internet
US20190340230A1 (en) System and method for generating websites from predefined templates
US9781262B2 (en) Methods and apparatus for voice-enabling a web application
US20120072831A1 (en) Method for creating a multi-lingual web page
US20140040746A1 (en) Methods and apparatus for voiced-enabling a web application
KR102229742B1 (en) Method and device for previewing a dynamic image, and method and device for displaying a presentation package
WO2020048189A1 (en) Image generation
US10375149B2 (en) Application registration and interaction
CN113382083B (en) Webpage screenshot method and device
US9292252B2 (en) Methods and apparatus for voiced-enabling a web application
US10116726B2 (en) Methods for bundling images and devices thereof
WO2023092580A1 (en) Page display method and apparatus, storage medium, and electronic device
JP5039946B2 (en) Technology for relaying communication between client devices and server devices
US20210397671A1 (en) Method and device for processing resource description file and for obtaining page resource
CN113761412A (en) Application page display method and device, electronic equipment, medium and application system
WO2022099913A1 (en) Interface configuration method and apparatus, and device and medium
WO2017197889A1 (en) Keyword link method, device and system
CN107643892B (en) Interface processing method, device, storage medium and processor

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17928511

Country of ref document: EP

Kind code of ref document: A1