[go: up one dir, main page]

CN119906692A - Web page processing method, device, equipment and storage medium for instant messaging client - Google Patents

Web page processing method, device, equipment and storage medium for instant messaging client Download PDF

Info

Publication number
CN119906692A
CN119906692A CN202311402871.1A CN202311402871A CN119906692A CN 119906692 A CN119906692 A CN 119906692A CN 202311402871 A CN202311402871 A CN 202311402871A CN 119906692 A CN119906692 A CN 119906692A
Authority
CN
China
Prior art keywords
webpage
instant messaging
text
web page
messaging client
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.)
Pending
Application number
CN202311402871.1A
Other languages
Chinese (zh)
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202311402871.1A priority Critical patent/CN119906692A/en
Publication of CN119906692A publication Critical patent/CN119906692A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • H04L51/046Interoperability with other network applications or services
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/40Processing or translation of natural language
    • G06F40/58Use of machine translation, e.g. for multi-lingual retrieval, for server-side translation for client devices or for real-time translation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/07User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail characterised by the inclusion of specific contents
    • H04L51/18Commands or executable codes

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本申请提供了一种即时通信客户端的网页处理方法、装置、设备及存储介质;方法包括:响应于针对所述即时通信客户端中的网页链接的触发操作,显示与所述网页链接对应的网页;向所述网页注入代码,通过所述代码建立所述即时通信客户端与所述网页之间的通信通道;接收所述网页通过所述通信通道发送的待翻译文本;向服务器发送所述待翻译文本;接收所述服务器返回的针对所述待翻译文本的翻译结果;通过所述通信通道向所述网页发送所述翻译结果,以在所述网页基于所述翻译结果进行更新。通过本申请,能够解决用户在即时通信客户端中阅读网页时遇到的语言障碍问题。

The present application provides a web page processing method, device, equipment and storage medium of an instant messaging client; the method includes: in response to a trigger operation for a web page link in the instant messaging client, displaying a web page corresponding to the web page link; injecting code into the web page, and establishing a communication channel between the instant messaging client and the web page through the code; receiving a text to be translated sent by the web page through the communication channel; sending the text to be translated to a server; receiving a translation result for the text to be translated returned by the server; sending the translation result to the web page through the communication channel, so that the web page is updated based on the translation result. Through the present application, the language barrier problem encountered by users when reading web pages in an instant messaging client can be solved.

Description

Webpage processing method, device, equipment and storage medium of instant messaging client
Technical Field
The present application relates to the field of internet technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing a web page of an instant messaging client.
Background
With the development of internet technology, instant messaging (IM, instant Messaging) may be performed using a session mode. For example, user a may enter an instant communication message (i.e., an IM message) in a session interface of the instant communication client and trigger the instant communication message to be sent to user B, thereby enabling instant communication between user a and user B. In addition, to convey more information, the user a may insert a web page link in the instant communication message sent to the user B, so that the user B may learn more about the corresponding web page by clicking on the web page link. However, due to the diversity of web pages, the web page opened by user B may be an english web page, and the native language of user B is chinese, i.e., user B may not be particularly familiar with english, resulting in language barriers encountered by user B when reading the web page.
Disclosure of Invention
The embodiment of the application provides a webpage processing method, device, electronic equipment, computer readable storage medium and computer program product of an instant communication client, which can solve the problem of language barrier encountered when a user reads a webpage in the instant communication client.
The technical scheme of the embodiment of the application is realized as follows:
The embodiment of the application provides a webpage processing method of an instant messaging client, which comprises the following steps:
Responding to a triggering operation for a webpage link in the instant communication client, and displaying a webpage corresponding to the webpage link;
Injecting codes into the webpage, and establishing a communication channel between the instant messaging client and the webpage through the codes;
Receiving a text to be translated sent by the webpage through the communication channel;
Sending the text to be translated to a server;
receiving a translation result which is returned by the server and is specific to the text to be translated;
and sending the translation result to the webpage through the communication channel so as to update the webpage based on the translation result.
The embodiment of the application provides a webpage processing device of an instant messaging client, which comprises:
the display module is used for responding to the triggering operation of the webpage link in the instant messaging client and displaying the webpage corresponding to the webpage link;
The injection module is used for injecting codes into the webpage, and establishing a communication channel between the instant messaging client and the webpage through the codes;
the receiving module is used for receiving the text to be translated sent by the webpage through the communication channel;
The sending module is used for sending the text to be translated to a server;
the receiving module is further configured to receive a translation result for the text to be translated, which is returned by the server;
and the sending module is also used for sending the translation result to the webpage through the communication channel so as to update the webpage based on the translation result.
An embodiment of the present application provides an electronic device, including:
a memory for storing executable instructions;
And the processor is used for realizing the webpage processing method of the instant messaging client when executing the executable instructions stored in the memory.
The embodiment of the application provides a computer readable storage medium which stores computer executable instructions for realizing the webpage processing method of the instant messaging client provided by the embodiment of the application when being executed by a processor.
The embodiment of the application provides a computer program product, which comprises a computer program or computer executable instructions and is used for realizing the webpage processing method of the instant messaging client provided by the embodiment of the application when being executed by a processor.
The embodiment of the application has the following beneficial effects:
When a user needs to read a webpage in an instant communication client, a code can be firstly injected into the webpage to establish a communication channel between the instant communication client and the webpage through the code, then the instant communication client can send the received text to be translated to a server after receiving the text to be translated sent by the webpage through the communication channel, so that the server translates the text to be translated, and then after receiving a translation result returned by the server, the instant communication client can return the translation result to the webpage through the communication channel to update the webpage based on the translation result, so that the webpage content opened in the instant communication client can be translated conveniently, and the problem of language barrier encountered when the user reads the webpage in the instant communication client is solved.
Drawings
Fig. 1 is a schematic architecture diagram of a web page processing system 100 of an instant messaging client according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of an electronic device 500 according to an embodiment of the present application;
FIG. 3 is a schematic diagram of an instant messaging client and a web page according to an embodiment of the present application;
fig. 4 is a flowchart of a web page processing method of an instant messaging client according to an embodiment of the present application;
Fig. 5A to fig. 5C are schematic flow diagrams of a web page processing method of an instant messaging client according to an embodiment of the present application;
fig. 6A and fig. 6B are schematic application scenarios of a web page processing method of an instant messaging client according to an embodiment of the present application;
Fig. 7 is a schematic diagram of a web page processing method of an instant messaging client according to an embodiment of the present application;
Fig. 8 is a flowchart illustrating a web page processing method of an instant messaging client according to an embodiment of the present application.
Detailed Description
The present application will be further described in detail with reference to the accompanying drawings, for the purpose of making the objects, technical solutions and advantages of the present application more apparent, and the described embodiments should not be construed as limiting the present application, and all other embodiments obtained by those skilled in the art without making any inventive effort are within the scope of the present application.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is to be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments and can be combined with one another without conflict.
It will be appreciated that in the embodiments of the present application, related data such as user information (e.g., instant messaging messages, mails, etc. sent by users) is involved, and when the embodiments of the present application are applied to specific products or technologies, user permissions or consents need to be obtained, and the collection, use, and processing of related data need to comply with related laws and regulations and standards of related countries and regions.
In the following description, the term "first/second/is merely to distinguish similar objects and does not represent a specific ordering of objects, it being understood that the" first/second/is interchangeable with a specific order or sequence, if allowed, to enable embodiments of the application described herein to be practiced otherwise than as illustrated or described herein.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the application only and is not intended to be limiting of the application.
Before describing embodiments of the present application in further detail, the terms and terminology involved in the embodiments of the present application will be described, and the terms and terminology involved in the embodiments of the present application will be used in the following explanation.
1) In response to a condition or state representing a dependency of an operation performed, one or more operations performed may be performed in real-time or with a set delay when the dependency is satisfied, and without any particular limitation to execution sequencing of the operations performed.
2) Hypertext markup language (HTML, hyper Text Markup Language) is a markup language that includes a series of tags by which document formats on a network can be unified, allowing discrete network resources to be connected as a logical entity. HTML text is descriptive text composed of HTML commands that can specify words, graphics, animations, sounds, tables, links, etc.
3) Document object model (DOM, document Object Model) is a standard programming interface that handles extensible markup language. It is a platform and language independent application program interface (API, application Programming Interface) that can dynamically access programs and scripts and update the style of their content, structure and World Wide Web (WWW) documents. The DOM provides an access model for the entire document, which can be a tree structure, with each node of the tree representing an HTML tag or text item within the tag. The DOM tree structure accurately describes the interrelationship between tags in an HTML document. The process of converting an HTML or extensible markup language (XML, extensible Markup Language) document to a DOM tree is referred to as parsing (Parse). After the HTML document is parsed, the HTML document is converted into a DOM tree, so that the processing of the HTML document can be realized through the operation on the DOM tree. The DOM tree not only describes the structure of the document, but also defines the behavior of the node object, and the nodes and the contents of the DOM tree can be conveniently accessed, modified, added and deleted by utilizing the method and the attribute of the object.
4) Web pages (Web pages) are basic elements constituting websites and are platforms for carrying various website applications. A web page is a plain text file containing HTML tags that can be stored in a computer at a corner of the world, a "page" in the world Wide Web, and in HTML format. Web pages typically use image files to provide drawings. In addition, the web page is to be read by a web browser.
5) Uniform resource locators (URLs, uniform Resource Location) are a representation on Web services of the Internet for specifying information locations. The resources available on the internet can be represented by simple strings that describe the syntax and semantics of such strings, which are called URLs. That is, the URL is an addressing mode set to identify the location of the resource on the internet, and the web page link (or web page address) is referred to as the URL in normal times. The url is a compact representation of the location and access method of resources available on the internet, and is the address of a standard resource on the internet.
6) The native interface refers to an interface developed by using a native development language (for example, java of Android, objective-C of iOS) of each platform. The native interface may directly access various hardware of the terminal device (e.g., a cell phone), including, for example, a camera, a microphone, etc., so that a richer and smoother user experience may be provided.
7) H5 pages are pages developed by using webpage technologies such as HTML5, CSS3 and JavaScript, and are generally displayed through a browser or a webpage view (webView) component, for example, the webpage can be the H5 page, and the H5 page has the advantages of being cross-platform, enabling a set of codes to run on various devices and platforms, and saving development and maintenance costs.
The embodiment of the application provides a webpage processing method, device, electronic equipment, computer readable storage medium and computer program product of an instant communication client, which can solve the problem of language barrier encountered when a user reads a webpage in the instant communication client. The electronic device provided by the embodiment of the application is explained below. The electronic device provided by the embodiment of the application can be implemented as a terminal device or cooperatively implemented by a server and the terminal device. The following describes an example of a web page processing method of an instant messaging client provided by the embodiment of the application implemented by a server and a terminal device cooperatively.
For example, referring to fig. 1, fig. 1 is a schematic architecture diagram of a web page processing system 100 of an instant messaging client according to an embodiment of the present application, and in order to implement an application for supporting and solving a problem of language barrier encountered when a user reads a web page in the instant messaging client, as shown in fig. 1, the web page processing system 100 of the instant messaging client includes a server 200, a network 300, and a terminal device 400, where the server 200 may be used to provide a translation service, the network 300 may be a local area network or a wide area network, or a combination of the two, the terminal device 400 is a terminal device associated with a user, and an instant messaging client 410 is running on the terminal device 400, where the instant messaging client 410 may be a personal instant messaging client (i.e. an instant messaging client that provides a social service for a personal user) or an enterprise instant messaging client (i.e. an instant messaging client that provides a social service for an enterprise user).
In some embodiments, taking the instant messaging client 410 as an enterprise instant messaging client for example, when a click operation of a user on a web page link (e.g., URL) displayed in a man-machine interaction interface of the instant messaging client 410 is received, a web page corresponding to the web page link may be displayed independently of a native interface of the instant messaging client 410, e.g., the instant messaging client 410 may call a browser and display the web page corresponding to the web page link in the browser. The instant messaging client 410 may then inject code into the web page, through which a communication channel between the instant messaging client 410 and the web page is established. Then, when a click operation of a user on a translation control (for example, a "translation full text" button) displayed in a suspended manner in the web page is received, text to be translated in the web page can be extracted through the above code, and then the web page can send the text to be translated to the instant messaging client 410 through the established communication channel. After receiving the text to be translated sent by the web page, the instant communication client 410 may send the text to be translated to the server 200 through the network 300, so that the server 200 translates the text to be translated. After receiving the translation result for the text to be translated returned by the server 200, the instant communication client 410 can send the translation result to the webpage through the established communication channel so as to update the webpage based on the translation result, so that the webpage content opened in the instant communication client can be translated conveniently and quickly, and the problem of language barrier encountered when the user reads the webpage in the instant communication client is solved effectively.
In other embodiments, the embodiments of the present application may also be implemented by means of Cloud Technology (Cloud Technology), which refers to a hosting Technology that unifies serial resources such as hardware, software, networks, etc. in a wide area network or a local area network, so as to implement calculation, storage, processing, and sharing of data.
The cloud technology is a generic term of network technology, information technology, integration technology, management platform technology, application technology and the like based on cloud computing business model application, can form a resource pool, and is flexible and convenient as required. Cloud computing technology will become an important support. Background services of technical network systems require a large amount of computing and storage resources.
By way of example, the server 200 in fig. 1 may be a stand-alone physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs, content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal device 400 may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted terminal, etc. The terminal device 400 and the server 200 may be directly or indirectly connected through wired or wireless communication, which is not limited in the embodiment of the present application.
In some embodiments, the terminal device or the server may further implement the webpage processing method of the instant messaging client provided by the embodiment of the present application by running various computer executable instructions, or computer programs. For example, the computer-executable instructions may be commands at the micro-program level, machine instructions, or software instructions. The computer programs may be Native programs or software modules in the operating system, native applications (APPlication, APP) that require installation in the operating system to run, such as instant messaging APP, or applets that can be embedded in any APP, that is, programs that only need to be downloaded to the browser environment to run. In general, the computer-executable instructions may be any form of instructions and the computer program may be any form of application, module, or plug-in.
The following continues to describe the structure of the electronic device provided by the embodiment of the present application. Taking an electronic device as an example of a terminal device, referring to fig. 2, fig. 2 is a schematic structural diagram of an electronic device 500 according to an embodiment of the present application, and the electronic device 500 shown in fig. 2 includes at least one processor 510, a memory 550, at least one network interface 520, and a user interface 530. The various components in electronic device 500 are coupled together by bus system 540. It is appreciated that the bus system 540 is used to enable connected communications between these components. The bus system 540 includes a power bus, a control bus, and a status signal bus in addition to the data bus. The various buses are labeled as bus system 540 in fig. 2 for clarity of illustration.
The Processor 510 may be an integrated circuit chip having signal processing capabilities such as a general purpose Processor, such as a microprocessor or any conventional Processor, a digital signal Processor (DSP, digital Signal Processor), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like.
The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and/or one or more visual displays. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid state memory, hard drives, optical drives, and the like. Memory 550 may optionally include one or more storage devices physically located remote from processor 510.
Memory 550 includes volatile memory or nonvolatile memory, and may also include both volatile and nonvolatile memory. The non-volatile Memory may be a Read Only Memory (ROM) and the volatile Memory may be a random access Memory (RAM, random Access Memory). The memory 550 described in embodiments of the present application is intended to comprise any suitable type of memory.
In some embodiments, memory 550 is capable of storing data to support various operations, examples of which include programs, modules and data structures, or subsets or supersets thereof, as exemplified below.
An operating system 551 including system programs for handling various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and handling hardware-based tasks;
Network communication module 552 for accessing other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include Bluetooth, wireless compatibility authentication (WiFi), universal serial bus (USB, universal Serial Bus), and the like;
a presentation module 553 for enabling presentation of information (e.g., a user interface for operating a peripheral device and displaying content and information) via one or more output devices 531 (e.g., a display screen, speakers, etc.) associated with the user interface 530;
The input processing module 554 is configured to detect one or more user inputs or interactions from one of the one or more input devices 532 and translate the detected inputs or interactions.
In some embodiments, the apparatus provided by the embodiments of the present application may be implemented in software, and fig. 2 shows a web page processing apparatus 555 of an instant messaging client stored in a memory 550, which may be software in the form of a program, a plug-in, or the like, including software modules including a display module 5551, an injection module 5552, a receiving module 5553, a sending module 5554, an extraction module 5555, and an updating module 5556, which are logical, so that any combination or further splitting may be performed according to the implemented functions. It should be noted that, in fig. 2, all the above modules are shown once for convenience of expression, but the web page processing apparatus 555 of the instant communication client should not be considered as excluding implementation that may include only the display module 5551, the injection module 5552, the receiving module 5553, and the transmitting module 5554, and functions of the respective modules will be described below.
The webpage processing method of the instant messaging client provided by the embodiment of the application is specifically described below in connection with the exemplary application and implementation of the terminal device provided by the embodiment of the application.
In order to facilitate understanding of the webpage processing method of the instant messaging client provided by the embodiment of the application, a process of calling the instant messaging client and the webpage mutually is explained first.
For example, referring to fig. 3, fig. 3 is a schematic diagram of an interaction between an instant messaging client and a web page provided by an embodiment of the present application, as shown in fig. 3, in a terminal device, an operating system layer 320 is run above a hardware layer 310, an application layer 330 shows the instant messaging client (i.e. a local application), an operating system may be Android, a web page (e.g. an H5 page) loaded by the instant messaging client may be embedded with a JS script, the instant messaging client may create an instance of a Webview component in its own content space, as an operating environment of the JS script, and a JS interpreter in the Webview component interprets the JS script and executes the JS script to implement various functions in the web page, including, for example, loading dynamic functions, responding to various operations of a user, and so on.
In some embodiments, the functions implemented by the JS script may include detecting the instant messaging client, automatically completing according to user input, displaying various function buttons, popping up a dialog box after clicking a button of a web page, checking whether the grammar of the user filling in the form is correct and prompting when the grammar is wrong, etc., which cannot be exhausted here.
The Webview component can also be used as an intermediary for communication between the JS script and the instant messaging client, the communication between the JS script and the instant messaging client is realized through the interaction between the JS script and the instant messaging client, and the interaction between the JS script and the instant messaging client is expressed as the interaction between a JS method and a local method, which is described below.
1) Instant messaging client invokes JS script
When the instant messaging client needs to call the JS script in the webpage, first, the instant messaging client opens the support of the Webview component for JS, and one example of opening the support of the Webview component for JS is:
ContentiWebView. Getsettings (). SetJavaScriptEnabled (true), where true represents setting JS support on.
Then, the instant messaging client may call the name of the JS method and transfer parameters using the loading method provided by the Webview component (denoted loadUrl), and one example of calling the JS script and transferring parameters is:
webview.loadUrl ("javascript: methodName (parameterValues); where methodName represents the name of the JS method called and parameterValues represents the parameters passed to the JS method.
If the called JS method has a return value, the instant communication client can not acquire the return value through loadUrl methods, the instant communication client defines a Java method for the JS method to call, and the JS method transmits the return value to the JS script through calling the Java method.
For example, the instant messaging client may also call the web page by means of URL Scheme. The URL Schema is an intra-page jump protocol, and can be used for conveniently jumping each page in the application by defining the Schema protocol, and the server can customize the page to which the notification application jumps, for example, the jump page can be customized through a notification bar message, the page can be jumped through an H5 page, and the like. The URL Schema protocol format is described below. Taking URL schemes as "xl:// good: 8888/goodsDetailgoodsId = 10011002", where xl represents the name of the scheme protocol, good represents which address field the scheme acts on, goodsDetail represents the page specified by the scheme, goodsId represents the parameter passed, and 8888 represents the port number of the path. Thus, the local application can acquire the related parameters carried by the URL schema request by intercepting the URL schema request sent by the page.
2) JS script calling instant communication client
When the JS script needs to call the instant messaging client, an interface provided by the Webview component and used for calling the instant messaging client is bound in the JS script, and then a method of the instant messaging client is called and parameters are transferred, wherein one example is as follows:
window.jsterfacename.methodname (parameterValues), wherein JSInterfaceName represents an interface for invoking an instant messaging client, methodName (parameterValues) represents a name of a method of the instant messaging client that needs to be invoked, methodName (parameterValues) represents parameters that need to be imported to the invoked instant messaging client.
The following will specifically describe a web page processing method of an instant messaging client according to an embodiment of the present application with reference to fig. 4.
Referring to fig. 4, an example, fig. 4 is a flowchart of a web page processing method of an instant messaging client according to an embodiment of the present application, and will be described with reference to the steps shown in fig. 4.
It should be noted that, for convenience of description, specific distinction is not made between the terminal device and the instant messaging client operated by the terminal device.
In step 101, in response to a trigger operation for a web page link in an instant messaging client, a web page corresponding to the web page link is displayed.
In some embodiments, the instant messaging client may include a session interface (e.g., a private chat session interface including a group chat session interface and a point-to-point chat session interface), where the session interface may include a target instant messaging message carrying a web page link (e.g., URL), step 101 may be implemented by displaying a web page corresponding to the web page link in a manner independent of the native interface of the instant messaging client in response to a triggering operation (e.g., a clicking operation) for the web page link carried by the target instant messaging message.
For example, taking an instant messaging client as an enterprise instant messaging client, a group chat list may be displayed in a man-machine interaction interface of the enterprise instant messaging client, where the group chat list may include a plurality of group chat, including, for example, group chat a, group chat B, group chat C, and group chat D. When a click operation of the current user (e.g., user 1) on the group chat B in the group chat list is received, a group chat session interface of the group chat B may be displayed, in which at least one instant communication message including a target instant communication message (e.g., may be the instant communication message 1 sent by the user 2) carrying a web page link (e.g., URL) may be displayed. When receiving the clicking operation of the user 1 on the webpage link carried by the instant communication message 1 sent by the user 2, the webpage corresponding to the webpage link can be displayed in a mode independent of the original interface of the enterprise instant communication client, for example, the enterprise instant communication client can call a browser running on the terminal device to display the webpage (such as an H5 page) corresponding to the webpage link through the browser, or the enterprise instant communication client can call a WebView component to display the webpage corresponding to the webpage link through the WebView component. That is, the user may also open a corresponding web page through a web page link carried in the instant communication message.
In other embodiments, the instant messaging client may further include a mail processing interface (e.g., a mail receiving interface), where the mail processing interface may include a target mail carrying a web page link, and the step 101 may be implemented by displaying, in response to a triggering operation (e.g., a clicking operation) for the web page link carried by the target mail, a web page corresponding to the web page link in a manner independent of a native interface of the instant messaging client.
For example, taking an instant messaging client as an enterprise instant messaging client, a mail processing portal may be displayed in a man-machine interaction interface of the enterprise instant messaging client, and when a click operation of a current user (e.g., user 1) on the mail processing portal is received, the mail processing interface may be displayed, where the mail processing interface may include at least one mail received by the user 1 and including a target mail (e.g., mail 1 sent by user 2) carrying a web page link. When a clicking operation of the user 1 on a webpage link (for example, URL) carried by the mail 1 sent by the user 2 is received, a webpage corresponding to the webpage link may be displayed independently of a native interface of the enterprise instant messaging client, for example, the enterprise instant messaging client may call a browser running on the terminal device to display the webpage corresponding to the webpage link through the browser, or the enterprise instant messaging client may call a WebView component to display the webpage corresponding to the webpage link through the WebView component. That is, the user can open the corresponding web page through the web page link carried in the mail.
In some embodiments, the instant messaging client may further include a workbench interface, where the workbench interface may include a target application (e.g., a customer service application) carrying a web page link, and the step 101 may be implemented by responding to a triggering operation of the web page link carried by the target application to display a web page corresponding to the web page link in a manner independent of a native interface of the instant messaging client.
For example, taking an instant messaging client as an enterprise instant messaging client, a workbench entrance may be displayed in a man-machine interaction interface of the enterprise instant messaging client, when a clicking operation of a current user (for example, user 1) on the workbench entrance is received, the workbench interface may be displayed, wherein the workbench interface may include at least one application including a target application carrying a web page link, when a clicking operation of the user 1 on the web page link carried by the target application is received, a web page corresponding to the web page link may be displayed in a manner independent of a native interface of the enterprise instant messaging client, for example, the enterprise instant messaging client may call a browser running on a terminal device to display the web page corresponding to the web page link through the browser, or the enterprise instant messaging client may call a WebView component to display the web page corresponding to the web page link through the WebView component. That is, the user may also open a corresponding web page through a web page link carried in the workstation application.
In step 102, code is injected into the web page, and a communication channel between the instant messaging client and the web page is established through the code.
In some embodiments, since the web page is displayed in a manner independent of the native interface of the instant messaging client, it is necessary to inject code into the web page to establish a communication channel between the instant messaging client and the web page through the code, thereby enabling bi-directional communication between the instant messaging client and the web page.
By way of example, the types of code may include one of a message handler (MESSAGEHANDLERS), a global function, and a bridge (JSBridge), and the above-described injecting code into a web page may be implemented by registering a message handler with a browser engine (e.g., webkit) of a browser for displaying a web page when an operating system of an instant messaging client is a first type of operating system (e.g., iOS and Mac operating systems), to establish a communication channel between the instant messaging client and the web page through the message handler, registering a global function with a browser engine (e.g., V8 engine in Cef) of a browser for displaying a web page when an operating system of an instant messaging client is a second type of operating system (e.g., windows operating system), to establish a communication channel between the instant messaging client and the web page through the global function, and injecting a bridge with a browser for displaying a web page when an operating system of an instant messaging client is a third type of operating system (e.g., android operating system).
Taking an instant messaging client as an enterprise instant messaging client as an example, when the operating system running the enterprise instant messaging client is an iOS operating system or a Mac operating system, bi-directional communication between the JS script embedded in the web page and the enterprise instant messaging client can be completed by registering MESSAGEHANDLERS with a browser engine (e.g., webkit) of a browser for displaying the web page.
For example, taking the instant messaging client as an enterprise instant messaging client, when the operating system running the enterprise instant messaging client is a Windows operating system, the global function may be registered with a browser engine of a browser for displaying a web page, for example, after the global function is registered with a V8 engine in Cef, the bi-directional communication between the JS script embedded in the web page and the enterprise instant messaging client may be completed.
By way of example, taking the instant messaging client as an enterprise instant messaging client, when the operating system running the enterprise instant messaging client is an Android operating system, JSBridge can be injected into a browser for displaying a webpage to complete bidirectional communication between a JS script embedded in the webpage and the enterprise instant messaging client.
In other embodiments, after the instant messaging client injects code (e.g., wwtranslate. JS code) into the web page, the web page may execute the JS code injected by the instant messaging client to establish a bi-directional communication channel between the JS script and the instant messaging client (i.e., the native application), and then the web page may return a notification to the instant messaging client that the web page is ready to complete bi-directional communication between the JS script and the instant messaging client, e.g., the web page may send OnContentReady notification to the instant messaging client. In addition, the instant messaging client may also send a registration change notification (SETPERSISTSEED) to the web page after receiving the OnContentReady notification sent by the web page, to inform the web page that it is known that the communication channel has been established.
In step 103, text to be translated sent by the web page through the communication channel is received.
In some embodiments, the above-mentioned web page may include a translation control (e.g. a "translate full text" button), and referring to fig. 5A, fig. 5A is a flowchart illustrating a web page processing method of an instant messaging client according to an embodiment of the present application, as shown in fig. 5A, before executing step 103 shown in fig. 4, step 107A shown in fig. 5A may also be executed, which will be described with reference to the step shown in fig. 5A.
In step 107A, text to be translated included in the web page is extracted by code in response to a triggering operation for the translation control.
In some embodiments, the extraction of the text to be translated included in the web page through the code may be implemented by obtaining a document object model tree (i.e., DOM tree) of the web page, obtaining nodes including text labels in the document object model tree as effective nodes, creating a mapping relationship between an identifier of the effective nodes and text content corresponding to the text labels, and encoding the text content corresponding to the effective nodes to obtain the text to be translated conforming to a set format (e.g., JSON format).
In other embodiments, the above-described document object model tree for obtaining a web page may be implemented by obtaining hypertext markup language source code (i.e., HTML source code) of the web page, and parsing the hypertext markup language source code to obtain the document object model tree for the web page.
The method and the device can be used for extracting the text to be translated in the webpage through the code injected in the step 102 when the clicking operation of the user for the full translation button is received, and concretely comprise the steps of firstly acquiring the HTML source code of the webpage, then analyzing the HTML source code of the webpage to obtain a DOM tree of the webpage, traversing the DOM tree, recursively searching for effective nodes (namely nodes comprising text labels) in the DOM tree, filtering redundant nodes without display and non-text content, namely, translating only the text content in the webpage, recording a Hash (Hash) mapping relation between an identifier (such as an ID) of the effective nodes and the text content (TextContent) corresponding to the text labels, and finally encoding the text content corresponding to the effective nodes to obtain the text to be translated in JOSN format and sending the text to an instant messaging client. That is, the translation for the web page content may be manually triggered by the user, and the text content in the web page is translated after receiving a click operation of the user on a translation control displayed in the web page.
It should be noted that, the user may also select the target language type to be translated by himself, for example, when a long-press operation of the user on the translation control (for example, the "full translation" button) is received, multiple candidate language types (for example, including chinese, japanese, korean, french and so on) may be displayed for the user to select. For example, taking the native language of the user as the Chinese, the text to be translated in the webpage can be translated into the Chinese by default, and of course, the user can also select the target language type to be translated by himself, for example, if the user selects Japanese from a plurality of candidate language types, the text to be translated in the webpage can be translated into Japanese, so that the personalized requirement of the user can be met.
In other embodiments, referring to fig. 5B, fig. 5B is a flowchart of a web page processing method of an instant messaging client according to an embodiment of the present application, as shown in fig. 5B, before executing step 103 shown in fig. 4, step 107B shown in fig. 5B may also be executed, and the description will be made with reference to the step shown in fig. 5B.
In step 107B, in response to the language type of the web page being different from the language type of the instant messaging client, text to be translated included in the web page is extracted by the code.
In some embodiments, text content in the web page may also be automatically translated, for example, when the language type of the web page is detected to be different from the language type of the instant messaging client, text to be translated in the web page may be automatically extracted by the code injected in step 102. For example, taking the instant messaging client as the enterprise instant messaging client, assuming that the language type of the enterprise instant messaging client is chinese and the language type of the web page opened in the enterprise instant messaging client is english (i.e., the user opens an english web page), the text to be translated in the web page can be automatically extracted through the code injected in step 102, that is, when the language type of the web page is detected to be different from the language type of the enterprise instant messaging client, the text content in the web page can be automatically translated, so as to solve the problem of language barrier encountered when the user reads the english web page.
In some embodiments, referring to fig. 5C, fig. 5C is a flowchart of a web page processing method of an instant messaging client according to an embodiment of the present application, as shown in fig. 5C, before executing step 103 shown in fig. 4, step 107C shown in fig. 5C may also be executed, and will be described with reference to the step shown in fig. 5C.
In step 107C, text to be translated included in the web page is extracted by the code in response to the language type of the web page being different from the language type of the operating system running the instant messaging client.
In some embodiments, text content in the web page may also be automatically translated, for example, when the language type of the web page is detected to be different from the language type of the operating system running the instant messaging client, text to be translated in the web page may be automatically extracted by the code injected in step 102. For example, taking the instant messaging client as the enterprise instant messaging client, assuming that the language type of the operating system running the enterprise instant messaging client is chinese and the language type of the webpage opened in the enterprise instant messaging client is english, that is, the user opens an english webpage in the enterprise instant messaging client, text to be translated (that is, english text content to be translated) in the english webpage can be automatically extracted through the code injected in step 102, that is, when the language type of the operating system running the enterprise instant messaging client is detected to be different from the language type of the webpage, the text content in the webpage can be automatically translated, so as to solve the problem of language barrier encountered when the user reads the webpage in the enterprise instant messaging client.
In step 104, the text to be translated is sent to the server.
In some embodiments, step 104 may be implemented by sending a translation request carrying text to be translated to a server, where the translation request is for the server to extract the text to be translated from the translation request and translate a language type of the text to be translated from a first language type to a second language type, the first language type being a native language type (e.g., english) of the text to be translated, the second language type may include one of a selected language type, a language type of an instant messaging client (e.g., chinese), and a language type of an operating system running the instant messaging client.
For example, taking an instant messaging client as an enterprise instant messaging client, the enterprise instant messaging client may encapsulate a text to be translated into a translation request after receiving the text to be translated sent by a web page through a communication channel, and then send the translation request to a server (for example, a server dedicated to provide a translation service), where the translation request carries the text to be translated sent by the web page. After receiving the translation request sent by the enterprise instant messaging client, the server may first extract the text to be translated from the translation request, and then translate the language type of the text to be translated from a first language type (e.g., english) to a second language type (e.g., chinese).
It should be noted that, the translation request may also carry a target language type set by the user (i.e., a language type selected by the user), while the server extracts the text to be translated from the translation request, the server may also extract the target language type set by the user from the translation request, and then the server may translate the text to be translated into the target language type. When the translation request does not carry the target language type set by the user, the server may translate the text to be translated into the target language type set by the user last time, or translate the text to be translated into the same language type as the language type of the instant messaging client, which is not particularly limited in the embodiment of the present application.
In step 105, a translation result for the text to be translated returned by the server is received.
In some embodiments, taking an instant messaging client as an enterprise instant messaging client as an example, after translating a text to be translated sent by the enterprise instant messaging client to obtain a translation result for the text to be translated, the server may return the translation result to the enterprise instant messaging client.
In step 106, the translation result is sent to the web page through the communication channel to update the web page based on the translation result.
In some embodiments, the updating of the translation results on the web page can be achieved by decoding the translation results to obtain the translation text in the same format as the text content (i.e. the text content before translation in the web page), determining the valid nodes corresponding to the translation text from the document object model tree according to the mapping relation established when extracting the text to be translated, and replacing the text content (e.g. "Hello") corresponding to the valid nodes with the translation text (e.g. "Hello").
Taking an instant messaging client as an enterprise instant messaging client as an example, after receiving a translation result returned by a server, the enterprise instant messaging client can return the translation result to a webpage through a communication channel established before, after receiving the translation result sent by the enterprise instant messaging client, the webpage can decode the translation result to obtain a translation text with the same format as the original text content in the webpage, then find an effective node corresponding to the translation text from a DOM tree of the webpage according to a mapping relation established when extracting the text to be translated, and finally replace the original text content corresponding to the effective node with the translation text, thereby realizing translation of the text content in the webpage.
According to the webpage processing method of the instant messaging client, when a user needs to read a webpage in the instant messaging client, codes can be injected into the webpage firstly to establish a communication channel between the instant messaging client and the webpage through the codes, then the instant messaging client can send the received text to be translated to a server after receiving the text to be translated sent by the webpage through the communication channel, so that the server translates the text to be translated, and then after receiving a translation result returned by the server, the instant messaging client can return the translation result to the webpage through the communication channel to update the webpage based on the translation result, and therefore the problem of language barrier encountered when the user reads the webpage in the instant messaging client can be solved.
In the following, an example application of the embodiment of the present application in an actual application scenario is described by taking an enterprise instant messaging client as an example.
Aiming at the enterprise instant messaging client, the embodiment of the application expands the original IM message translation capability of the enterprise instant messaging client to all webpage scenes, such as webpages opened from IM messages and H5 webpages opened from enterprise mail and workbench applications. The enterprise instant messaging client can analyze webpage structures in various scenes, respectively extract corresponding text contents, for example, an iOS platform and a Mac platform are taken as examples, the iOS platform and the Mac platform can provide a fast translation entry through the automatic identification capability, and can identify webpage structure changes in real time, so that a translation result of refreshing and changing the contents without perception is achieved, convenient translation of a user in multi-language webpage contents encountered in the enterprise instant messaging client is realized, and the problem of language barriers encountered by the user in webpage reading is solved.
That is, the technical scheme provided by the embodiment of the application can solve the problem of language barrier encountered when a user enters a plurality of scenes of a webpage (including IM message/application/mail) in an enterprise instant messaging client, and simultaneously, the user can trigger translation and rapidly compare the original translations when reading the webpage. In addition, the embodiment of the application can also expand the translation capability to any webpage, extract the text content in the webpage and identify the webpage change in real time.
The webpage processing method of the instant messaging client provided by the embodiment of the application is specifically described below.
In some embodiments, taking an iOS device as an example, fig. 6A is a schematic application scenario of a web page processing method of an instant messaging client provided by the embodiment of the present application, as shown in fig. 6A, the iOS device may display a "full translation" button 601 (corresponding to the translation control described above) in a web page 600 in a floating manner, and when receiving a click operation of a user on the "full translation" button 601 displayed in the floating manner in the web page 600, may translate text content in the web page 600 and switch the "full translation" button 601 to an "in-translation" state 602.
In other embodiments, referring to fig. 6B by taking a Mac device as an example, fig. 6B is a schematic application scenario diagram of a web page processing method of an instant messaging client according to an embodiment of the present application, as shown in fig. 6B, a translation option (e.g. a "full translation" button) may be displayed in the middle of a navigation bar of the Mac device, and when a click operation of a user on the "full translation" button is received, text content in a web page may be translated, and the "full translation" button may be switched to an "in-translation" state 603. When the text content in the web page is translated, the "translate full text" button is switched to the "display text" button 604. When a click operation of the user on the "show text" button 604 is received, text content in the web page may be switched back to text, for example, english may be switched back from text.
In some embodiments, referring to fig. 7, fig. 7 is a schematic diagram of a web page processing method of an instant messaging client provided by the embodiment of the present application, as shown in fig. 7, each platform (for example, including iOS, mac, android, windows) may uniformly inject a section of js code (for example, wwtranslate. Js code) when a web page is opened in a browser, and through the js code, communication between the web page and a terminal device (i.e., an enterprise instant messaging client running on the terminal device) and an ability of automatically extracting text to be translated are implemented. After receiving the text to be translated sent by the webpage based on the communication channel, the terminal device can submit the text to be translated to a translation service (such as a background translation service of an enterprise instant messaging client) so that the translation service translates the text to be translated to obtain a translation result. After receiving the translation result returned by the translation service, the terminal device can return the translation result to the webpage through the communication channel, and the JS script embedded in the webpage can re-render the webpage based on the translation result, namely, the translated text content is displayed in the webpage.
The following describes a webpage processing method of an instant messaging client according to an embodiment of the present application with reference to fig. 8.
For example, referring to fig. 8, fig. 8 is a flowchart of a web page processing method of an instant messaging client according to an embodiment of the present application, and will be described with reference to the steps shown in fig. 8.
In step 201, the client injects wwtranslate. Js code into the web page.
In some embodiments, a client (i.e., an enterprise instant messaging client) injects a wwtranslate. Js code before the web page begins, establishing a communication channel between the enterprise instant messaging client and the web page. For example, the iOS and Mac devices may register MESSAGEHANDLERS with the Webkit to complete communication from the JS script to the terminal device, and after the Windows device may register the global function with the V8 engine in the Cef, complete communication from the JS script to the terminal device, and the Android device may directly follow JSBridge to complete bidirectional communication between the JS script and the terminal device.
In step 202, the web page executes js code.
In step 203, the web page sends OnContentReady a notification to the client.
In step 204, the client sends a registration change notification to the web page.
In some embodiments, the web page translation flow protocol may include:
1) Informing the webpage that the JS script is ready to be completed to a local application (Native): onContentReady protocol;
2) Registration change notification SETPERSISTSEED protocol;
3) Acquiring a full-quantity text Native to JS script getPlainText protocol to be translated;
4) The terminal equipment calls back the translation result to the interface Native to JS script replaceText protocol;
5) And triggering the translation service of the enterprise instant messaging client to return the translated text Native to a translation service (Server) through the network request.
In step 205, the web page sends text to be translated to the client.
In some embodiments, text to be translated in a web page may be extracted by first recursively searching for valid nodes (i.e., nodes including text labels) from the DOM tree of the web page, filtering redundant nodes that do not display and are not text content, then recording the Hash mapping relationship of the IDs of the valid nodes (nodes) and the text content (textContent), recording the state as the original state, then waiting for getPlainText protocol, recoding the text content corresponding to the valid nodes into text to be translated, and recalling to the terminal device.
In step 206, the client sends a translation request to the translation service.
In step 207, the translation service sends the translation result to the client.
In step 208, the client sends the translation result to the web page.
In step 209, the web page is updated based on the translation result.
In some embodiments, after the translation service finishes translating the text to be translated sent by the enterprise instant messaging client, the translation result can be returned to the enterprise instant messaging client through replaceText protocol, after receiving the translation result returned by the translation service, the enterprise instant messaging client can return the translation result to the webpage through the communication channel, and after decoding the translation result, the webpage finds the corresponding node to be translated (i.e. the above effective node) through the mapping relation, and refreshes the screen. In addition, an interface identifier may be registered, and when an interface node is identified as having a change, a translation may be updated for that node, and a change notification may be triggered in the translation.
In step 210, the web page sends a change notification to the client.
In step 211, the client sends a new translation request to the translation service.
In step 212, the translation service sends the new translation result to the client.
In step 213, the client sends the new translation result to the web page.
In step 214, the web page is updated based on the new translation result.
In some embodiments, the embodiment of the present application may acquire the target language type (for example, chinese) set in the terminal device setting item by the user, and record in a browser opening/mail or other scenario. After the scene such as the webpage/mail is opened for automatic or manual translation, the user can also temporarily select other types of languages for re-translation, for example, after the user temporarily selects other types of languages (for example, japanese), the webpage can send a change notification to the enterprise instant messaging client, and the enterprise instant messaging client can record the other types of languages temporarily selected by the user as the target translation language type of the current scene. When the webpage and mail are jumped in the scene, the user can preferentially follow the temporarily selected target translation language type, namely, the text content in the webpage can be preferentially translated into Japanese.
In summary, the technical solution provided by the embodiment of the present application has the following beneficial effects:
According to the technical scheme provided by the embodiment of the application, the user can acquire the translation capability when various scenes in the enterprise instant messaging client enter the webpage and the mailbox, and can update the translation content in real time through content identification when the webpage content is identified to be changed, the capability of self-defining and selecting the target language type in the translation scene is provided, the capability of freely switching the target language type is realized, the translation language type is automatically recorded in the scene, and the problem of language barrier when the user reads the webpage and the mail in multiple scenes is solved.
Continuing with the description below of an exemplary structure of the instant messaging client web page processing device 555 implemented as software modules provided in accordance with an embodiment of the present application, in some embodiments, as shown in fig. 2, the software modules stored in the instant messaging client web page processing device 555 of the memory 550 may include a display module 5551, an injection module 5552, a receiving module 5553, and a transmitting module 5554.
The system comprises a display module 5551 for responding to the triggering operation of the webpage link in the instant messaging client, an injection module 5552 for injecting codes into the webpage, a receiving module 5553 for receiving texts to be translated sent by the webpage through the communication channel, a sending module 5554 for sending the texts to be translated to a server, a receiving module 5553 for receiving translation results for the texts to be translated returned by the server, and a sending module 5554 for sending the translation results to the webpage through the communication channel so as to update the webpage based on the translation results.
In some embodiments, the instant messaging client comprises a session interface, wherein the session interface comprises a target instant messaging message carrying a web page link, and the display module 5551 is further configured to display a web page corresponding to the web page link in a manner independent of a native interface of the instant messaging client in response to a triggering operation of the web page link carried by the target instant messaging message.
In some embodiments, the instant messaging client comprises a mail processing interface, wherein the mail processing interface comprises a target mail carrying a webpage link, and the display module 5551 is further configured to display a webpage corresponding to the webpage link in a manner independent of a native interface of the instant messaging client in response to a triggering operation of the webpage link carried by the target mail.
In some embodiments, the instant messaging client comprises a workbench interface, wherein the workbench interface comprises a target application carrying a webpage link, and the display module 5551 is further used for responding to a triggering operation of the webpage link carried by the target application and displaying a webpage corresponding to the webpage link in a mode independent of a native interface of the instant messaging client.
In some embodiments, the webpage comprises a translation control, and the webpage processing device 555 of the instant messaging client further comprises an extraction module 5555 for extracting the text to be translated included in the webpage through codes in response to a triggering operation for the translation control before the receiving module 5553 receives the text to be translated sent by the webpage through the communication channel.
In some embodiments, the extracting module 5555 is further configured to extract, by the code, the text to be translated included in the web page in response to the language type of the web page being different from the language type of the instant messaging client before the receiving module 5553 receives the text to be translated sent by the web page through the communication channel.
In some embodiments, the extracting module 5555 is further configured to extract, by code, the text to be translated included in the web page in response to the language type of the web page being different from the language type of the operating system running the instant messaging client before the receiving module 5553 receives the text to be translated sent by the web page through the communication channel.
In some embodiments, the extraction module 5555 is further configured to obtain a document object model tree of the web page, obtain a node including a text label in the document object model tree as an effective node, create a mapping relationship between an identifier of the effective node and text content corresponding to the text label, and encode the text content corresponding to the effective node to obtain a text to be translated according to a set format.
In some embodiments, the web page processing device 555 of the instant messaging client further includes an update module 5556, configured to decode the translation result to obtain a translated text in the same format as the text content, determine, according to the mapping relationship, an effective node corresponding to the translated text from the document object model tree, and replace the text content corresponding to the effective node with the translated text.
In some embodiments, the extraction module 5555 is further configured to obtain a hypertext markup language source code of the web page, and parse the hypertext markup language source code to obtain a document object model tree of the web page.
In some embodiments, the sending module 5554 is further configured to send a translation request carrying the text to be translated to the server, where the translation request is used for the server to extract the text to be translated from the translation request, and translate a language type of the text to be translated from a first language type to a second language type, where the first language type is a native language type of the text to be translated, and the second language type includes one of a selected language type, a language type of the instant messaging client, and a language type of an operating system running the instant messaging client.
In some embodiments, the types of code include a message handler, a global function, and a bridge, and the injection module 5552 is further configured to register the message handler with a browser engine of a browser for displaying web pages when the operating system running the instant messaging client is a first type of operating system, register the global function with the browser engine of the browser for displaying web pages when the operating system running the instant messaging client is a second type of operating system, and inject the bridge with the browser for displaying web pages when the operating system running the instant messaging client is a third type of operating system.
It should be noted that, the description of the apparatus according to the embodiment of the present application is similar to the description of the embodiment of the method described above, and has similar beneficial effects as the embodiment of the method, so that a detailed description is omitted. The technical details of the web page processing device of the instant messaging client provided in the embodiment of the present application may be understood according to the description of fig. 4 or any of fig. 5A to 5C.
Embodiments of the present application provide a computer program product comprising a computer program or computer-executable instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer executable instructions from the computer readable storage medium, and the processor executes the computer executable instructions, so that the computer device executes the webpage processing method of the instant messaging client according to the embodiment of the application.
Embodiments of the present application provide a computer readable storage medium storing computer executable instructions, where the computer executable instructions are stored, which when executed by a processor, cause the processor to perform a web page processing method of an instant messaging client provided by the embodiments of the present application, for example, a web page processing method of an instant messaging client as shown in fig. 4, or any one of fig. 5A to 5C.
In some embodiments, the computer readable storage medium may be FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM, or various devices including one or any combination of the above.
In some embodiments, the executable instructions may be in the form of programs, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and they may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
As an example, executable instructions may be deployed to be executed on one electronic device or on multiple electronic devices located at one site or distributed across multiple sites and interconnected by a communication network.
The foregoing is merely exemplary embodiments of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims (16)

1. A web page processing method for an instant messaging client, the method comprising:
Responding to a triggering operation for a webpage link in the instant communication client, and displaying a webpage corresponding to the webpage link;
Injecting codes into the webpage, and establishing a communication channel between the instant messaging client and the webpage through the codes;
Receiving a text to be translated sent by the webpage through the communication channel;
Sending the text to be translated to a server;
receiving a translation result which is returned by the server and is specific to the text to be translated;
and sending the translation result to the webpage through the communication channel so as to update the webpage based on the translation result.
2. The method of claim 1, wherein the step of determining the position of the substrate comprises,
The instant messaging client comprises a session interface, wherein the session interface comprises a target instant messaging message carrying a webpage link;
the responding to the triggering operation for the webpage link in the instant communication client displays the webpage corresponding to the webpage link, and comprises the following steps:
And responding to the triggering operation of the webpage link carried by the target instant communication message, and displaying the webpage corresponding to the webpage link in a mode of being independent of a native interface of the instant communication client.
3. The method of claim 1, wherein the step of determining the position of the substrate comprises,
The instant messaging client comprises a mail processing interface, wherein the mail processing interface comprises a target mail carrying a webpage link;
the responding to the triggering operation for the webpage link in the instant communication client displays the webpage corresponding to the webpage link, and comprises the following steps:
and responding to the triggering operation of the webpage link carried by the target mail, and displaying the webpage corresponding to the webpage link in a mode independent of a native interface of the instant messaging client.
4. The method of claim 1, wherein the step of determining the position of the substrate comprises,
The instant messaging client comprises a workbench interface, wherein the workbench interface comprises a target application carrying a webpage link;
the responding to the triggering operation for the webpage link in the instant communication client displays the webpage corresponding to the webpage link, and comprises the following steps:
and responding to the triggering operation of the webpage link carried by the target application, and displaying the webpage corresponding to the webpage link in a mode independent of a native interface of the instant messaging client.
5. The method of claim 1, wherein the step of determining the position of the substrate comprises,
The web page includes a translation control;
before receiving the text to be translated sent by the web page through the communication channel, the method further comprises:
And responding to the triggering operation for the translation control, and extracting the text to be translated included in the webpage through the code.
6. The method of claim 1, wherein prior to said receiving text to be translated sent by the web page over the communication channel, the method further comprises:
And responding to the fact that the language type of the webpage is different from the language type of the instant messaging client, and extracting the text to be translated included in the webpage through the codes.
7. The method of claim 1, wherein prior to said receiving text to be translated sent by the web page over the communication channel, the method further comprises:
and extracting the text to be translated included in the webpage through the code in response to the fact that the language type of the webpage is different from the language type of an operating system running the instant messaging client.
8. The method according to any one of claims 5 to 7, wherein the extracting text to be translated included in the web page by the code includes:
The following processing is performed by the code:
acquiring a document object model tree of the webpage;
acquiring nodes including text labels in the document object model tree to serve as effective nodes;
Creating a mapping relation between the identifications of the effective nodes and the text content corresponding to the text labels;
and coding the text content corresponding to the effective node to obtain the text to be translated which accords with a set format.
9. The method of claim 8, wherein the updating the web page based on the translation result comprises:
Decoding the translation result to obtain a translation text with the same format as the text content;
Determining the effective node corresponding to the translation text from the document object model tree according to the mapping relation;
and replacing the text content corresponding to the effective node with the translation text.
10. The method of claim 8, wherein the obtaining the document object model tree of the web page comprises:
Acquiring a hypertext markup language source code of the webpage;
And analyzing the hypertext markup language source code to obtain a document object model tree of the webpage.
11. The method according to any one of claims 1 to 10, wherein said sending the text to be translated to a server comprises:
And sending a translation request carrying the text to be translated to a server, wherein the translation request is used for the server to extract the text to be translated from the translation request and translate the language type of the text to be translated from a first language type to a second language type, the first language type is the original language type of the text to be translated, and the second language type comprises one of a selected language type, the language type of the instant messaging client and the language type of an operating system running the instant messaging client.
12. The method according to any one of claims 1 to 10, wherein,
The types of the codes comprise a message processing program, a global function and a bridge;
the injecting code into the web page includes:
when the operating system running the instant messaging client is a first type of operating system, registering the message processing program with a browser engine of a browser for displaying the webpage;
When the operating system running the instant messaging client is a second type of operating system, registering the global function with a browser engine of a browser for displaying the webpage;
and when the operating system running the instant messaging client is a third type of operating system, injecting the bridge into a browser for displaying the webpage.
13. A web page processing apparatus for an instant messaging client, the apparatus comprising:
the display module is used for responding to the triggering operation of the webpage link in the instant messaging client and displaying the webpage corresponding to the webpage link;
The injection module is used for injecting codes into the webpage, and establishing a communication channel between the instant messaging client and the webpage through the codes;
the receiving module is used for receiving the text to be translated sent by the webpage through the communication channel;
The sending module is used for sending the text to be translated to a server;
the receiving module is further configured to receive a translation result for the text to be translated, which is returned by the server;
and the sending module is also used for sending the translation result to the webpage through the communication channel so as to update the webpage based on the translation result.
14. An electronic device, comprising:
a memory for storing executable instructions;
a processor configured to implement the web page processing method of the instant messaging client according to any one of claims 1 to 12 when executing the executable instructions stored in the memory.
15. A computer readable storage medium storing computer executable instructions which, when executed by a processor, implement the method of web page processing for an instant messaging client of any of claims 1 to 12.
16. A computer program product comprising a computer program or computer executable instructions which, when executed by a processor, implement the method of web page processing for an instant messaging client of any of claims 1 to 12.
CN202311402871.1A 2023-10-26 2023-10-26 Web page processing method, device, equipment and storage medium for instant messaging client Pending CN119906692A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311402871.1A CN119906692A (en) 2023-10-26 2023-10-26 Web page processing method, device, equipment and storage medium for instant messaging client

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311402871.1A CN119906692A (en) 2023-10-26 2023-10-26 Web page processing method, device, equipment and storage medium for instant messaging client

Publications (1)

Publication Number Publication Date
CN119906692A true CN119906692A (en) 2025-04-29

Family

ID=95471095

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311402871.1A Pending CN119906692A (en) 2023-10-26 2023-10-26 Web page processing method, device, equipment and storage medium for instant messaging client

Country Status (1)

Country Link
CN (1) CN119906692A (en)

Similar Documents

Publication Publication Date Title
US12182221B2 (en) Method and terminal device for extracting web page content
US11741183B2 (en) Systems and methods for hosted applications
CN106569900B (en) Applied program processing method and device
US9081757B2 (en) Systems and methods for tracking and updating hosted applications
US9292253B2 (en) Methods and apparatus for voiced-enabling a web application
US10853319B2 (en) System and method for display of document comparisons on a remote device
CN105760162A (en) Development method for hybrid APP software
CN104111855A (en) A method for dynamic updating of iOS client functions based on Lua
US20210232755A1 (en) Machine first approach for identifying accessibility, non-compliances, remediation techniques and fixing at run-time
JP2023541186A (en) Visualization page rendering method, device, equipment and storage medium
US20150188980A1 (en) Systems and Methods for Hosted Application Marketplaces
US9292252B2 (en) Methods and apparatus for voiced-enabling a web application
US20100229081A1 (en) Method for Providing a Navigation Element in an Application
CN111767109A (en) H5 page display method, device and readable storage medium based on terminal application
CN114595191A (en) Webpage processing method and device, electronic equipment and storage medium
CN108491232A (en) The method and system of control are loaded in voice dialogue platform
CN119906692A (en) Web page processing method, device, equipment and storage medium for instant messaging client
CN109656816A (en) Control recognition methods, device, equipment and storage medium
CN115687815A (en) Page information display method, device, equipment and medium
CN117806741A (en) Page display method and device, computer equipment, storage medium and product
Han et al. Practice and evaluation of pagelet-based client-side rendering mechanism
CN117034298A (en) XSS vulnerability detection method and device, electronic equipment and storage medium
Hoang Finnish scanner mobile application
CN121233114A (en) A method and related apparatus for dynamically generating native user interfaces
CN120762694A (en) View component processing method, device, electronic device, computer-readable storage medium, and computer program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication