CN102567384A - Webpage multi-language dynamic switching method and system based on webpage browser engine - Google Patents

Webpage multi-language dynamic switching method and system based on webpage browser engine Download PDF

Info

Publication number
CN102567384A
CN102567384A CN201010611502XA CN201010611502A CN102567384A CN 102567384 A CN102567384 A CN 102567384A CN 201010611502X A CN201010611502X A CN 201010611502XA CN 201010611502 A CN201010611502 A CN 201010611502A CN 102567384 A CN102567384 A CN 102567384A
Authority
CN
China
Prior art keywords
text
webpage
browser engine
multilingual
label
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201010611502XA
Other languages
Chinese (zh)
Other versions
CN102567384B (en
Inventor
刘超
刘啸
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Lianshang Network Technology Co Ltd
Original Assignee
Shengle Information Technolpogy Shanghai Co Ltd
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 Shengle Information Technolpogy Shanghai Co Ltd filed Critical Shengle Information Technolpogy Shanghai Co Ltd
Priority to CN201010611502.XA priority Critical patent/CN102567384B/en
Publication of CN102567384A publication Critical patent/CN102567384A/en
Application granted granted Critical
Publication of CN102567384B publication Critical patent/CN102567384B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a webpage multi-language dynamic switching method based on a webpage browser engine. The method comprises the steps of: intercepting text inside a label and carrying out translation and dynamic replacement when the browser engine loads a webpage and parses to an appointed multilingual label. The invention also discloses a system for realizing the method. The system comprises an intercepting module and a multilingual storage and query module, which are embedded in the browser engine, wherein the intercepting module is used for intercepting the text in the multilingual label and transmitting to the multilingual storage and query module when the webpage browser engine carries out page parse; and the multilingual storage and query module is used for translating the intercepted text into appointed language and updating the text content. According to the multi-language dynamic switching method and system, by amending the bottom-layer code of the browser engine, the webpage language is only needed to be replaced once when the HTML (Hyper Text Makeup Language) page is parsed and is not needed to be replaced again when the page is loaded again, thus the webpage language dynamic switching efficiency is increased.

Description

Based on multilingual dynamic switching method of the webpage of web browser engine and system
Technical field
The present invention relates to homepages language and switch field, the multi-lingual dynamic switching method of especially a kind of webpage based on the browser core engine.The invention still further relates to the system of this method of realization.
Background technology
In the browser interface of handheld device, to realize multilingual dynamic switching; Usually the method that adopts at present is in the multi-lingual character string of equipment end storage; In the page that browser loads, move the JavaScript script then; According to the current language setting, the localized character string that occurs in the webpage is carried out dynamic replacement.The shortcoming of this method is, during the each Web page loading of browser, all needs extra execution script to replace; This has brought additional overhead to system, and the webpage that slowed down is written into and speed of displaying, and; The JavaScript script is written into localized character string from the outside, certainly will will relate to the switching of running environment, i.e. frequent redirect between script explanation environment and the multi-lingual storage environment; Therefore, the language switching efficiency is lower.
Summary of the invention
The technical matters that the present invention will solve provides the multilingual dynamic switching side of a kind of webpage based on the web browser engine, and it can improve the efficient that homepages language switches.
For solving the problems of the technologies described above, the multilingual dynamic switching method of the webpage based on the web browser engine of the present invention may further comprise the steps:
1) the multi-lingualization label of definition html web page, the text in this label is the text that need carry out multilingual dynamic switching;
2) before browser engine makes up the dom tree of html web page, insert following steps:
When browser engine is resolved to multi-lingualization label, writes down this label, and tackle the text in this label;
According to the current language of the text, search the translation character string of the text, and with the original character string of this translation character string replacement text.
Another technical matters that the present invention will solve provides a kind of system that is used to realize the said method of claim 1.
For solving the problems of the technologies described above, the multilingual dynamic switched system of the webpage based on the web browser engine of the present invention includes:
Blocking module is embedded in the browser engine, is used for when the browser engine analyzing web page, needs being carried out the text of multilingual dynamic switching and tackling, and sends multi-lingual storing queries module to;
Multi-lingual storing queries module is embedded in the browser engine, is used to receive the text that blocking module sends, and according to the current language of the text, and content of text is translated and upgraded.
Comprise a multilingual vocabulary in the said multi-lingual storing queries module, be used to store the entry of different language.
The present invention tackles its HTML resolving through revising the bottom code of browser engine, carries out webpage in browser engine and resolves; When obtaining the webpage character string; Carry out multi-lingual inquiry and dynamic replacement, carry out the character string dynamic switch method with traditional operation JavaScript script and compare, the present invention only needs when html page is resolved, to replace once; Need not the time switch once more and carry out script in page heavy duty, thereby display efficiency has been promoted more than one times.
Description of drawings
Fig. 1 is the process flow diagram that existing Web kit resolves HTML;
Fig. 2 is that Webkit resolves the process flow diagram of HTML after inserting replacement flow process of the present invention.
Embodiment
Understand for technology contents of the present invention, characteristics and effect being had more specifically, combine the present invention's one possible embodiments and accompanying drawing at present, details are as follows:
Webkit is a browser core engine of increasing income; Its source code clear in structure is easy to safeguard, is one of browser kernel of present main flow; On PC platform and handheld device; Use very extensively, especially based on the handheld device of Android platform, often first-selected Webkit is as the core engine of its browser.Present embodiment has promptly selected Android1.5 as implementing platform.
The flow process of the original parsing of Webkit HTML sees also shown in Figure 1, may further comprise the steps:
1) Webkit uses its loader that carries, from network or the local html source code that loads.
2) HTMLTokenizer of Webkit (HTML segmenter) carries out lexical analysis to this html source code, obtains each segment mark and signs (Tag) and literal object.
3) HTMLParser of Webkit (html parser) receiving step 2) analyze the morphology object that obtains, and resolve and handle, be node with these morphology objects then, generate dom tree.
4) Webkit plays up dom tree, and is plotted on the display screen.
Present embodiment is revised the bottom code of Webkit; Blocking module and multi-lingual storing queries module in Webkit, have newly been embedded; Blocking module is used for when HTMLParser resolves; Needs are carried out the text of multilingual translation and tackle, and send multi-lingual storing queries module to and translate.Store multilingual vocabulary in the multi-lingual storing queries module, be used for the text translation that blocking module sends is become the language of appointment.In addition; Before revising the Webkit bottom code; The present invention arranges the label that need carry out the inline text of multilingual translation in the html web page, be decided to be approximately in the present embodiment<multilang>, for example; Source code<multilang>text</multilang>in, " text " is exactly the character string that need carry out multilingual translation.
After the Webkit bottom code was revised, respective change also took place in the flow process that Webkit resolves HTML, and new process of analysis can be consulted shown in Figure 2.Load html source code at Webkit, and after using HTMLTokenizer that it is carried out lexical analysis, the HTMLParser of Webkit resolves to each literal node.When HTMLParser be resolved to<during multilang>label; This label is inserted in the dom tree; Blocking module is just tackled herein, notes this label, then; When HTMLParser was resolved to plain text " text ", blocking module just sent this character string " text " to multi-lingual storing queries module.Multi-lingual storing queries module is searched in multilingual vocabulary and is searched the translation character string according to current language setting (for example, Chinese), obtains " text " two words.Multi-lingual storing queries module is back to Webkit to this translation character string and is tackled the place; " text " replaces with " text " with original character string; Then, the character string after HTMLParser will replace is inserted in the dom tree, by Webkit dom tree is played up and drawn to be shown on the screen; So, just, accomplished dynamic replacement to the inherited literal node.

Claims (3)

1. the multilingual dynamic switching method of the webpage based on the web browser engine is characterized in that, may further comprise the steps:
1) the multi-lingualization label of definition html web page, the text in this label is the text that need carry out multilingual dynamic switching;
2) before browser engine makes up the dom tree of html web page, insert following steps:
When browser engine is resolved to multi-lingualization label, writes down this label, and tackle the text in this label;
According to the current language of the text, search the translation character string of the text, and with the original character string of this translation character string replacement text.
2. the multilingual dynamic switched system of webpage of realizing the said method of claim 1 is characterized in that, includes:
Blocking module is embedded in the browser engine, is used for when the browser engine analyzing web page, needs being carried out the text of multilingual dynamic switching and tackling, and sends multi-lingual storing queries module to;
Multi-lingual storing queries module is embedded in the browser engine, is used to receive the text that blocking module sends, and according to the current language of the text, and content of text is translated and upgraded.
3. the multilingual dynamic switched system of webpage as claimed in claim 2 is characterized in that: include a multilingual vocabulary in the said multi-lingual storing queries module, be used to store the entry of different language.
CN201010611502.XA 2010-12-29 2010-12-29 Webpage multi-language dynamic switching method and system based on webpage browser engine Active CN102567384B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010611502.XA CN102567384B (en) 2010-12-29 2010-12-29 Webpage multi-language dynamic switching method and system based on webpage browser engine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010611502.XA CN102567384B (en) 2010-12-29 2010-12-29 Webpage multi-language dynamic switching method and system based on webpage browser engine

Publications (2)

Publication Number Publication Date
CN102567384A true CN102567384A (en) 2012-07-11
CN102567384B CN102567384B (en) 2017-02-01

Family

ID=46412821

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010611502.XA Active CN102567384B (en) 2010-12-29 2010-12-29 Webpage multi-language dynamic switching method and system based on webpage browser engine

Country Status (1)

Country Link
CN (1) CN102567384B (en)

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104050212A (en) * 2013-03-13 2014-09-17 国际商业机器公司 Method and system for mobilizing a web application to take advantage of a native device capability
CN104281711A (en) * 2014-10-27 2015-01-14 浪潮(北京)电子信息产业有限公司 Multi-language processing method and multi-language processing device for WEB application
CN104714968A (en) * 2013-12-16 2015-06-17 中国银联股份有限公司 Method and device for internationalizing web page
CN104915204A (en) * 2015-06-08 2015-09-16 小米科技有限责任公司 Web processing method and device
CN105488041A (en) * 2014-09-15 2016-04-13 北京畅游天下网络技术有限公司 Browser interface multi-language display method
CN106254681A (en) * 2016-09-22 2016-12-21 青岛海信移动通信技术股份有限公司 The language form changing method of a kind of ring tone name and terminal
CN106372065A (en) * 2016-10-27 2017-02-01 新疆大学 Method and system for developing multi-language website
CN107203405A (en) * 2017-06-23 2017-09-26 郑州云海信息技术有限公司 A kind of method and apparatus for checking multilingual definition
US10083156B2 (en) 2013-03-13 2018-09-25 International Business Machines Corporation Mobile enablement of webpages
CN109901886A (en) * 2019-01-23 2019-06-18 北京达佳互联信息技术有限公司 Page language switching method, system, device and computer readable storage medium
US10346501B2 (en) 2013-03-13 2019-07-09 International Business Machines Corporation Mobile enablement of existing web sites
CN110096432A (en) * 2019-03-21 2019-08-06 平安普惠企业管理有限公司 Test text replacement method, device, computer equipment and storage medium
CN110362370A (en) * 2019-06-14 2019-10-22 平安科技(深圳)有限公司 A kind of switching method of homepages language, device and terminal device
CN111401000A (en) * 2020-04-03 2020-07-10 上海一者信息科技有限公司 Translation real-time preview method for online auxiliary translation
CN113438542A (en) * 2021-05-28 2021-09-24 北京智慧星光信息技术有限公司 Subtitle real-time translation method, system, electronic equipment and storage medium
CN113742550A (en) * 2021-08-20 2021-12-03 广州市易工品科技有限公司 Data acquisition method, device and system based on browser
CN113742550B (en) * 2021-08-20 2024-04-19 广州市易工品科技有限公司 Browser-based data acquisition method, device and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1745379A (en) * 2003-01-28 2006-03-08 法国电信公司 Method and system for supplying an automatic web content translation service
CN101615181A (en) * 2008-06-27 2009-12-30 国际商业机器公司 Create the system and method for internationalization network application
US7784026B1 (en) * 2002-06-05 2010-08-24 Adobe Systems Incorporated Web application internationalization
CN102693322A (en) * 2012-06-01 2012-09-26 杭州海康威视数字技术股份有限公司 Multi-language supporting webpage processing method, webpage loading method and systems

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7784026B1 (en) * 2002-06-05 2010-08-24 Adobe Systems Incorporated Web application internationalization
CN1745379A (en) * 2003-01-28 2006-03-08 法国电信公司 Method and system for supplying an automatic web content translation service
CN101615181A (en) * 2008-06-27 2009-12-30 国际商业机器公司 Create the system and method for internationalization network application
CN102693322A (en) * 2012-06-01 2012-09-26 杭州海康威视数字技术股份有限公司 Multi-language supporting webpage processing method, webpage loading method and systems

Cited By (27)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10831858B2 (en) 2013-03-13 2020-11-10 International Business Machines Corporation Mobile enablement of existing web sites
US10346501B2 (en) 2013-03-13 2019-07-09 International Business Machines Corporation Mobile enablement of existing web sites
US10346502B2 (en) 2013-03-13 2019-07-09 International Business Machines Corporation Mobile enablement of existing web sites
US9563448B2 (en) 2013-03-13 2017-02-07 International Business Machines Corporation Mobilizing a web application to take advantage of a native device capability
US10089283B2 (en) 2013-03-13 2018-10-02 International Business Machines Corporation Mobile enablement of webpages
US10083156B2 (en) 2013-03-13 2018-09-25 International Business Machines Corporation Mobile enablement of webpages
CN104050212B (en) * 2013-03-13 2017-05-24 国际商业机器公司 Method and system for mobilizing a web application to take advantage of a native device capability
CN104050212A (en) * 2013-03-13 2014-09-17 国际商业机器公司 Method and system for mobilizing a web application to take advantage of a native device capability
CN104714968A (en) * 2013-12-16 2015-06-17 中国银联股份有限公司 Method and device for internationalizing web page
CN105488041A (en) * 2014-09-15 2016-04-13 北京畅游天下网络技术有限公司 Browser interface multi-language display method
CN105488041B (en) * 2014-09-15 2018-08-24 北京畅游天下网络技术有限公司 The method for realizing the multilingual display of browser interface
CN104281711B (en) * 2014-10-27 2018-04-27 浪潮(北京)电子信息产业有限公司 The multilingual treating method and apparatus of WEB application
CN104281711A (en) * 2014-10-27 2015-01-14 浪潮(北京)电子信息产业有限公司 Multi-language processing method and multi-language processing device for WEB application
CN104915204A (en) * 2015-06-08 2015-09-16 小米科技有限责任公司 Web processing method and device
CN106254681A (en) * 2016-09-22 2016-12-21 青岛海信移动通信技术股份有限公司 The language form changing method of a kind of ring tone name and terminal
CN106372065A (en) * 2016-10-27 2017-02-01 新疆大学 Method and system for developing multi-language website
CN107203405A (en) * 2017-06-23 2017-09-26 郑州云海信息技术有限公司 A kind of method and apparatus for checking multilingual definition
CN109901886A (en) * 2019-01-23 2019-06-18 北京达佳互联信息技术有限公司 Page language switching method, system, device and computer readable storage medium
CN109901886B (en) * 2019-01-23 2022-06-03 北京达佳互联信息技术有限公司 Page language switching method, system, device and computer readable storage medium
CN110096432A (en) * 2019-03-21 2019-08-06 平安普惠企业管理有限公司 Test text replacement method, device, computer equipment and storage medium
CN110362370A (en) * 2019-06-14 2019-10-22 平安科技(深圳)有限公司 A kind of switching method of homepages language, device and terminal device
CN111401000A (en) * 2020-04-03 2020-07-10 上海一者信息科技有限公司 Translation real-time preview method for online auxiliary translation
CN111401000B (en) * 2020-04-03 2023-06-20 上海一者信息科技有限公司 Real-time translation previewing method for online auxiliary translation
CN113438542A (en) * 2021-05-28 2021-09-24 北京智慧星光信息技术有限公司 Subtitle real-time translation method, system, electronic equipment and storage medium
CN113438542B (en) * 2021-05-28 2022-11-08 北京智慧星光信息技术有限公司 Subtitle real-time translation method, system, electronic equipment and storage medium
CN113742550A (en) * 2021-08-20 2021-12-03 广州市易工品科技有限公司 Data acquisition method, device and system based on browser
CN113742550B (en) * 2021-08-20 2024-04-19 广州市易工品科技有限公司 Browser-based data acquisition method, device and system

Also Published As

Publication number Publication date
CN102567384B (en) 2017-02-01

Similar Documents

Publication Publication Date Title
CN102567384A (en) Webpage multi-language dynamic switching method and system based on webpage browser engine
US9195644B2 (en) Short phrase language identification
CN111831384B (en) Language switching method, device, equipment and storage medium
US20080301545A1 (en) Method and system for the intelligent adaption of web content for mobile and handheld access
US20100088695A1 (en) System and method for localizing a server application using a client-side translator
Müller et al. Multi-level annotation in MMAX
US20080077565A1 (en) Method for finding at least one web service, among a plurality of web services described by respective semantic descriptions, in different forms or languages
CN104375808A (en) Method and device for displaying interfaces
Tonella et al. Restructuring multilingual web sites
CN106202066A (en) The interpretation method of website and device
IES20030062A2 (en) Document transformation
CN109976840A (en) The method and system of multilingual automatic adaptation are realized under a kind of separation platform based on front and back
US20150331781A1 (en) Debugging data format conversion
CN104331438A (en) Method and device for selectively extracting content of novel webpage
CN113139390A (en) Language conversion method and device applied to code character strings
CN103714116A (en) Webpage information extracting method and webpage information extracting equipment
US9645816B2 (en) Multi-language code search index
KR20120122959A (en) Method and Device for Collecting Web Contents and Computer-readable Recording Medium for the same
CN103544276B (en) Method and device for displaying script files by virtual machine
US20160041974A1 (en) Enhancing textual searches with executables
Movahhedian et al. Extended Metaphor in the Glorious Qur'an Through Translation: A Case Study
US9208134B2 (en) Methods and systems for tokenizing multilingual textual documents
CN110851678B (en) Method and device for crawling data
CN115062609A (en) Method and device for enhancing syntax dependence of Chinese language
CN114462430A (en) Entry extraction method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
ASS Succession or assignment of patent right

Owner name: SHANGHAI GUOKE ELECTRONIC CO., LTD.

Free format text: FORMER OWNER: SHENGLE INFORMATION TECHNOLOGY (SHANGHAI) CO., LTD.

Effective date: 20120709

C41 Transfer of patent application or patent right or utility model
TA01 Transfer of patent application right

Effective date of registration: 20120709

Address after: 201203 Shanghai City, Pudong New Area Shanghai City, Guo Shou Jing Road, Pudong New Area Zhangjiang hi tech Park No. 356

Applicant after: Shanghai Guoke Electronic Co., Ltd.

Address before: 201203 Shanghai City, Pudong New Area Shanghai City, Guo Shou Jing Road, Pudong New Area Zhangjiang hi tech Park No. 356

Applicant before: Shengle Information Technology (Shanghai) Co., Ltd.

ASS Succession or assignment of patent right

Owner name: SHANGHAI SHENGXUAN NETWORK TECHNOLOGY CO., LTD.

Free format text: FORMER OWNER: SHANGHAI GUOKE ELECTRONIC CO., LTD.

Effective date: 20130318

C41 Transfer of patent application or patent right or utility model
TA01 Transfer of patent application right

Effective date of registration: 20130318

Address after: 201203 Shanghai Guo Shou Jing Road, Zhangjiang High Tech Park of Pudong New Area No. 356 building 3 room 126

Applicant after: Shanghai Shengxuan Network Technology Co., Ltd.

Address before: 201203 Shanghai Guo Shou Jing Road, Pudong New Area Zhangjiang hi tech Park No. 356

Applicant before: Shanghai Guoke Electronic Co., Ltd.

C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C41 Transfer of patent application or patent right or utility model
TA01 Transfer of patent application right

Effective date of registration: 20160616

Address after: 201203 Shanghai Zhang Heng Road, Lane 666, No. 7, building 1, Pudong New Area

Applicant after: SHANGHAI ZHANGMEN TECHNOLOGY CO., LTD.

Address before: 201203 Shanghai Guo Shou Jing Road, Zhangjiang High Tech Park of Pudong New Area No. 356 building 3 room 126

Applicant before: Shanghai Shengxuan Network Technology Co., Ltd.

C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20170314

Address after: 200000 room N2025, building No. 2, Xincheng Road, mud town, Shanghai, Pudong New Area, China, 24

Patentee after: Shanghai Lian Shang network technology Co., Ltd

Address before: 201203 Shanghai Zhang Heng Road, Lane 666, No. 7, building 1, Pudong New Area

Patentee before: SHANGHAI ZHANGMEN TECHNOLOGY CO., LTD.