Translation method and apparatus, electronic device and readable storage medium
By receiving and responding to the user's input track on the interface to be translated, it determines the target translation content and displays the translation results, solving the problem of inconvenience in selecting translation content in the screenshot box, and improving the accuracy and flexibility of translation.
Patent Information
- Application Number
- PCT/CN2024/087042
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-13
- Filing Date
- 2024-04-10
- Publication Date
- 2024-10-17
AI Technical Summary
In the existing technology, the operation of selecting translation content through the screenshot box is not convenient enough, especially when the content is irregular in shape, it is easy to cause multiple selections, missed selections or wrong selections, affecting the accuracy and flexibility of translation.
By receiving the user's input track on the interface to be translated, responding to the input track to determine the target translation content, and displaying the corresponding translation results, convenient translation content selection is achieved.
The accuracy and flexibility of selecting content to be translated on the interface are improved, allowing users to conveniently select the content to be translated, and enhancing the flexibility and accuracy of translation.
Smart Images

Figure CN2024087042_17102024_PF_FP_ABST
Abstract
Description
Translation method, device, electronic device and readable storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to Chinese patent application No. 202310399614.0 filed in China on April 13, 2023, the entire contents of which are incorporated herein by reference. Technical Field
[0003] The present application belongs to the technical field of electronic equipment, and specifically relates to a translation method, device, electronic equipment and readable storage medium. Background Art
[0004] Currently, when translating content in an interface, if a user only wants to translate part of the content, the user can select the content to be translated through the screenshot box for translation.
[0005] However, when selecting the content to be translated through the screenshot frame, the user may need to adjust the screenshot frame multiple times before triggering the selection of the content to be translated. For example, if the area where the content to be translated is located is irregular in shape, the user may need to select the content to be translated through the screenshot frame multiple times. As such, the operation of selecting the content to be translated through the screenshot frame is not convenient.
[0006] Summary of the Invention
[0007] The purpose of the embodiments of the present application is to provide a translation method, device, electronic device and readable storage medium, which can solve the problem that the operation of selecting translation content through the screenshot box is not convenient enough.
[0008] In a first aspect, an embodiment of the present application provides a translation method, the method comprising: receiving a first input to an interface to be translated; in response to the first input, determining target translation content according to an input trajectory of the first input; and displaying a translation result corresponding to the target translation content.
[0009] In a second aspect, embodiments of the present application provide a translation device comprising: a receiving module, a determining module, and a display module. The receiving module is configured to receive a first input to an interface to be translated; the determining module is configured to determine, in response to the first input received by the receiving module, target translation content based on an input trajectory of the first input; and the display module is configured to display a translation result corresponding to the target translation content determined by the determining module.
[0010] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0011] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0012] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method described in the first aspect.
[0013] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0014] In an embodiment of the present application, a first input to a translation interface can be received. In response to the first input, a target translation content can be determined based on the input trajectory of the first input, and a translation result corresponding to the target translation content can be displayed. Through this solution, since the target translation content to be translated can be determined in the translation interface based on the input trajectory of the user on the translation interface, the user can conveniently select the translation content to be translated. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] FIG1 is a flowchart of a translation method provided in an embodiment of the present application;
[0016] FIG2( a ) is a schematic diagram of an example of a translation method provided in an embodiment of the present application;
[0017] FIG2( b ) is a second schematic diagram of an example of a translation method provided in an embodiment of the present application;
[0018] FIG2( c ) is a third schematic diagram of an example of a translation method provided in an embodiment of the present application;
[0019] FIG3( a ) is a fourth schematic diagram of an example of a translation method provided in an embodiment of the present application;
[0020] FIG3( b ) is a fifth schematic diagram of an example of a translation method provided in an embodiment of the present application;
[0021] FIG3( c ) is a sixth schematic diagram of an example of a translation method provided in an embodiment of the present application;
[0022] FIG4 is a seventh schematic diagram of an example of a translation method provided in an embodiment of the present application;
[0023] FIG5( a ) is an eighth schematic diagram of an example of a translation method provided in an embodiment of the present application;
[0024] FIG5( b ) is a ninth example schematic diagram of a translation method provided in an embodiment of the present application;
[0025] FIG6 is a tenth schematic diagram of an example of a translation method provided in an embodiment of the present application;
[0026] FIG7 is an eleventh schematic diagram of an example of a translation method provided in an embodiment of the present application;
[0027] FIG8 is a schematic structural diagram of a translation device provided in an embodiment of the present application;
[0028] FIG9 is a schematic diagram of a hardware structure of an electronic device provided in an embodiment of the present application;
[0029] FIG10 is a second schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.
[0031] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0032] The translation method, device, electronic device, and readable storage medium provided in the embodiments of the present application are described in detail below with reference to specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0033] Translation is a frequently used function in learning, work, and daily life. Compared with traditional dictionary translation, electronic devices are more efficient and convenient. With the advancement of internet technology, the performance and effectiveness of electronic translation have greatly improved. More and more users are choosing to use electronic devices for translation, and their translation needs are becoming more personalized and differentiated.
[0034] When a user needs to translate part of the content in the translation interface displayed on an electronic device, such as when browsing the web, reading the news, learning a foreign language, or encountering unfamiliar words or sentences, the user will have the need to translate these unfamiliar words and sentences. In related technologies, the user can use a screenshot box to select the content to be translated, thereby triggering the selection and translation of the content in the screenshot box.
[0035] However, when selecting the content to be translated through the screenshot box, on the one hand, the user needs to repeatedly adjust the size and position of the screenshot box to select the content to be translated, which results in low flexibility in selecting the content to be translated; on the other hand, since the screenshot box is often a regular shape such as a rectangular box, when the content to be translated by the user wraps or the area is an irregular shape, it is easy to select multiple, miss or wrongly select the content to be translated through the screenshot box. For example, when the content to be translated by the user is a line and a half of text content in the interface to be translated, only one or two lines of text content can be selected through the screenshot box, but not a line and a half of text content, resulting in low accuracy in selecting the content to be translated. In this way, the accuracy and flexibility of selecting and translating the content in the interface to be translated through the screenshot box are low, which makes the operation of selecting the translation content through the screenshot box not convenient enough.
[0036] In an embodiment of the present application, when a user needs to view the translation results of part of the content of the interface to be translated, the user can perform a first input on the interface to be translated to trigger the input track according to the first input, directly select the target translation content, and display the translation results corresponding to the target translation content; that is, the user can trigger the selection of content that meets his translation needs in the interface to be translated by input that meets his translation needs. In this way, compared to the solution of selecting the content in the interface to be translated through a screenshot box, since the translation method provided in the embodiment of the present application can directly determine the content to be translated in the interface according to the input track of the input, it can improve the accuracy of selecting the content to be translated on the interface on the one hand, and improve the flexibility of selecting the content to be translated on the interface on the other hand, so that the user can easily select the translation content to be translated.
[0037] The translation method provided in the embodiments of the present application may be performed by a translation device. For example, the translation device may be an electronic device, or a component within the electronic device, such as an integrated circuit or chip. The following uses an electronic device as an example to illustrate the translation method provided in the embodiments of the present application.
[0038] The present application provides a translation method. FIG1 shows a flowchart of the translation method provided by the present application embodiment. The method can be applied to electronic devices. As shown in FIG1 , the translation method provided by the present application embodiment may include the following steps 101 to 103.
[0039] Step 101: The electronic device receives a first input from a user on an interface to be translated.
[0040] Optionally, the interface to be translated may be any interface displayed on a screen of an electronic device.
[0041] For example, the interface to be translated may be an interface displayed by an electronic device when a user browses a web page.
[0042] For another example, the interface to be translated may be an interface for displaying pictures in a gallery application.
[0043] For another example, the interface to be translated may be an interface of a document displayed on an electronic device, such as a Word document.
[0044] Optionally, the interface to be translated may include at least one character. In the embodiment of the present application, the character of the interface to be translated may include at least one of the following: letters, numbers, words, operation symbols, punctuation marks, and some functional symbols. For example, the word is a Chinese character.
[0045] Optionally, the first input may be a touch input or an air gesture input by the user on the interface to be translated.
[0046] For example, taking the first input as a user's touch input on the interface to be translated as an example, the first input can be any possible input such as a long press input, a sliding input, or a click input on the interface to be translated, which is not specifically limited in the present embodiment.
[0047] It should be noted that the above description of the specific form of the first input is only for example and does not limit the present application. In actual implementation, the input form of the first input can be determined according to actual usage requirements.
[0048] In the embodiment of the present application, the first input can be used to select translation content in the to-be-translated interface, such as the target translation content described below.
[0049] Optionally, when the user performs the first input, the electronic device may display the input track of the first input so that the user knows the character selected by the user.
[0050] Step 102: The electronic device determines target translation content according to an input trajectory of the first input in response to the first input.
[0051] Optionally, the target translation content may be a list, sentence or paragraph in the interface to be translated.
[0052] Optionally, the target translation content may be text content in the interface to be translated or characters in a picture in the interface to be translated.
[0053] Optionally, the number of the target translation contents may be one or more.
[0054] Optionally, when there is only one target translation content, the target translation content is a single content in the interface to be translated, e.g., the content includes at least one consecutive character displayed in the interface to be translated. When there are multiple target translation contents, the multiple target translation contents may be multiple contents displayed in consecutive or discontinuous positions in the interface to be translated, e.g., each content includes at least one consecutive character displayed in the interface to be translated.
[0055] Optionally, when there are multiple target translation contents, the first input may include multiple sub-inputs, each corresponding to each of the multiple target translation contents. Specifically, the target translation contents are determined based on the input trajectory of each of the multiple sub-inputs. This allows the user to trigger the selection of multiple target translation contents displayed in discontinuous locations in the to-be-translated interface through the first input, and display the translation results for these multiple target translation contents, thereby further improving translation flexibility.
[0056] For example, the number of target translation contents is two. As shown in Figure 2(a), the electronic device receives a user's first input on the to-be-translated interface 20. The first input includes two sliding inputs, and the input trajectories of the two sliding inputs include input trajectory 21 and input trajectory 22, respectively. Then, the electronic device can determine the characters passed by input trajectory 21 as a target translation content, "The Queen sat sewing by her window," and the characters passed by input trajectory 22 as a target translation content, "time." That is, the electronic device can determine a target translation content based on input trajectory 21 and input trajectory 22, respectively.
[0057] Step 103: The electronic device displays the translation result corresponding to the target translation content.
[0058] In an embodiment of the present application, after determining the target translation content, the electronic device may first translate the target translation content to obtain a translation result corresponding to the target translation content, and then display the translation result corresponding to the target translation content.
[0059] Optionally, the electronic device may identify the language of the target translation content, translate the characters in the target translation content into characters of another language, and then display the translation result.
[0060] Optionally, in an embodiment of the present application, the translation result of the target translation content may include: the target translation content and the translation corresponding to the target translation content, or include the translation corresponding to the target translation content.
[0061] Optionally, the electronic device may display the translation result in the form of a floating window or a pop-up window.
[0062] The translation method provided in the embodiments of the present application is described below with reference to the accompanying drawings.
[0063] Exemplarily, as shown in FIG2( a), the first input includes two sub-inputs, which are respectively the user's sliding input on the word "time" and "The Queen sat sewing by her window" in the to-be-translated interface 20, so that the electronic device can respond to the first input. As shown in FIG2( b), the electronic device selects "time" and "The Queen sat sewing by her window" according to the input trajectory of the first input; and as shown in FIG2( c), the electronic device can display the corresponding translation result of "time" as "time" and the corresponding translation result of "The Queen sat sewing by her window" as "The Queen sat sewing by the bed sewing".
[0064] The embodiment of the present application provides a translation method, which can determine the target translation content to be translated in the interface to be translated according to the input trajectory input by the user on the interface to be translated, so that the user can conveniently select the translation content to be translated.
[0065] Optionally, the electronic device may receive the first input from the user when the electronic device is in a local translation mode.
[0066] Optionally, in an embodiment of the present application, the electronic device may display at least one translation mode selection control when displaying an interface to be translated. Each of the at least one translation mode selection control corresponds to a translation mode. The at least one translation mode may include any one of the following: a local translation mode and a full-screen translation mode. In the local translation mode, the electronic device may translate part of the characters in the interface displayed by the electronic device; in the full-screen translation mode, the electronic device may translate all the characters in the interface displayed by the electronic device.
[0067] Optionally, after receiving a user input to one of the at least one translation mode selection controls, the electronic device may control the electronic device to be in a translation mode corresponding to the translation mode selection control.
[0068] In this way, since the user can trigger the electronic device to be in different translation modes by inputting different selection controls in at least one translation mode selection control, the flexibility of the electronic device in translating the content in the interface to be translated can be improved.
[0069] Optionally, before the above step 101, the translation method provided in the embodiment of the present application may further include the following steps 104 and 105, and the above step 102 may include any one of the following steps 102a to 102c.
[0070] Step 104: The electronic device receives a second input from the user regarding the interface to be translated.
[0071] Step 105: The electronic device determines a translation mode in response to the second input.
[0072] In an embodiment of the present application, after receiving the second input, the electronic device may respond to the second input and determine a translation mode based on the second input. The translation mode may be a translation mode corresponding to the second input. The translation mode may include any of the following: word mode, sentence mode, and paragraph mode.
[0073] Among them, when the translation mode is word mode, the above-mentioned target translation content is the word in the interface to be translated; when the translation mode is sentence mode, the above-mentioned target translation content is the sentence in the interface to be translated; when the translation mode is paragraph mode, the above-mentioned target translation content is the paragraph in the interface to be translated.
[0074] It is understandable that the user can trigger the electronic device to select the translation mode required by the user through the second input.
[0075] Optionally, the second input may be a touch input or air gesture input by the user on the translation interface. Specifically, the second input may be any possible input such as a click input, a long press input, etc. on the translation interface. This embodiment of the present application is not specifically limited.
[0076] For example, the electronic device may display multiple translation mode controls in the interface to be translated, each corresponding to any one of the following: word mode, sentence mode, and paragraph mode. The second input may be a user clicking a translation mode control among the multiple translation mode controls that meets the user's translation needs, thereby triggering the electronic device to select the translation mode corresponding to the translation mode control as the translation mode for translating the content in the interface to be translated.
[0077] It should be noted that the above description of the specific form of the second input is only for example and does not limit the present application. In actual implementation, the input form of the second input can be determined according to actual usage requirements.
[0078] Step 102a: In response to the first input, the electronic device determines, when the translation mode is the word mode, characters that intersect with the input trajectory of the first input as target translation content.
[0079] Optionally, “characters intersecting with the input trajectory of the first input” may be understood as characters passed by the input trajectory of the first input, that is, characters covered by the input trajectory of the first input.
[0080] For example, a user can use a brush tool, also known as a smudge brush, to smudge the interface to be translated. During the smudge process, the electronic device can display the smudge trajectory of the brush, and the smudge trajectory of the brush is consistent with the trajectory of the user's finger (i.e., the input trajectory of the first input). The target translation content can be the at least one character smudged along the smudge trajectory.
[0081] Step 102b: In response to the first input, when the translation mode is sentence mode, the electronic device determines the sentence containing the characters that intersect with the input trajectory of the first input as the target translation content.
[0082] Optionally, “the sentence where the characters intersecting with the input trajectory of the first input are located” may be understood as the sentence where the characters passed by the input trajectory of the first input are located.
[0083] For example, if there are one or more characters in a sentence that are passed by the input trajectory of the first input, then the sentence belongs to the sentence where the characters that intersect with the input trajectory of the first input are located.
[0084] Step 102c: In response to the first input, when the translation mode is paragraph mode, the electronic device determines the paragraph containing the characters intersecting with the input trajectory of the first input as target translation content.
[0085] Optionally, “the paragraph where the characters intersecting with the input trajectory of the first input are located” may be understood as the paragraph where the characters passed by the input trajectory of the first input are located.
[0086] For example, if there are one or more characters in a paragraph that are passed by the input trajectory of the first input, then the paragraph belongs to the paragraph where the characters that intersect with the input trajectory of the first input are located.
[0087] It can be understood that when the translation mode of the electronic device is different, the target translation content determined by the electronic device according to the input trajectory of the first input is also different.
[0088] Optionally, the electronic device may default to a translation mode, and the user may trigger the electronic device to switch the translation mode through a second input.
[0089] For example, as shown in FIG3( a ), if the electronic device is in sentence mode and displays a word mode control 31 and a paragraph mode control 32 in the translation interface 30 , the user can trigger the electronic device to switch to translation mode by selecting the word mode control 31 or the paragraph mode control 32 .
[0090] For example, the electronic device defaults to sentence mode, as shown in Figure 3(a). The user can click on the word mode control 31, so that the electronic device can switch the translation mode from sentence mode to word mode. As shown in Figure 3(b), after completing the translation mode switch, the electronic device can display the sentence mode control 33 and the paragraph mode control 32 in the to-be-translated interface 30. Then, as shown in Figure 3(b), the user can trigger the electronic device to select the target translation content "time" to be translated by making a first input to the to-be-translated interface 30. As shown in Figure 3(c), the electronic device can display the translation result "time" corresponding to the target translation content "time" in the pop-up window 34.
[0091] Optionally, the electronic device may highlight the target translation content so that the user can view the character content selected by the electronic device.
[0092] In this way, since the electronic device can determine the translation mode based on the second input of the interface to be translated, and when the translation mode is word mode, the characters that intersect with the input trajectory of the first input are determined as the target translation content; when the translation mode is sentence mode, the sentence containing the characters that intersect with the input trajectory of the first input is determined as the target translation content; or when the translation mode is paragraph mode, the paragraph containing the characters that intersect with the input trajectory of the first input is determined as the target translation content. Therefore, the electronic device can determine different target translation contents according to the input trajectory of the first input in different translation modes, thereby improving the flexibility of determining the target translation content from the interface to be translated.
[0093] Optionally, the interface to be translated may include a target image, the step 101 may include the following step 101a, and the step 102 may include the following step 102d.
[0094] Step 101a: The electronic device receives a first input of a target image from a user.
[0095] In the embodiment of the present application, the target image may include characters.
[0096] Optionally, the target image may be an image containing characters displayed by an electronic device.
[0097] For example, when a user browses a web page, i.e., an interface to be translated, and the web page contains an English picture, then the English picture can be the target picture.
[0098] For another example, the target image may be an image in a gallery that includes characters.
[0099] Step 102d: In response to the first input, the electronic device determines target translation content from the characters in the target image according to an input trajectory of the first input on the target image.
[0100] Optionally, the electronic device may receive and respond to a first input of a user to a target image in the translation interface, and determine target translation content from characters in the target image.
[0101] For example, the user may paint on the target image using a brush tool, that is, the electronic device receives the user's first input on the target image, and the electronic device may select target translation content from the characters in the target image in response to the first input.
[0102] Optionally, the “input trajectory of the first input on the target image” may be considered as a valid input trajectory of the first input.
[0103] In actual implementation, the electronic device may determine a target translation content from the characters of the target image according to the input trajectory of the first input on the target image, and determine another target translation content according to the input trajectory of the first input outside the target image.
[0104] Optionally, the electronic device may recognize characters in the target image using optical character recognition (OCR) technology, particularly characters in the target image that intersect with the input trajectory of the first input. Of course, the electronic device may also recognize characters in the target image using other possible technologies.
[0105] Optionally, after recognizing the characters in the target image, the electronic device may determine target translation content from the characters in the target image according to the input trajectory of the first input.
[0106] In this way, the electronic device can determine the target translation content from the characters in the target image based on the input trajectory of the first input on the target image. That is, the user can trigger the electronic device to select characters from the image for translation by inputting an input that meets their translation needs. Therefore, compared to the solution of selecting characters in the image through the screenshot box, the translation method provided in the embodiment of the present application can improve the accuracy and flexibility of selecting characters in the image, allowing users to conveniently select the translation content.
[0107] Optionally, the above step 103 may include the following step 103a.
[0108] Step 103a: The electronic device displays the translation result corresponding to the target translation content in an area associated with the area where the target translation content is located.
[0109] Optionally, the "area associated with the area where the target translation content is located" may be an area surrounding the area where the target translation content is located. For example, the area associated with the area where the target translation content is located may be an area above, below, to the left, or to the right of the area where the target translation content is located. The terms "up," "down," "left," and "right" are used as an example to illustrate an electronic device displaying an interface to be translated, with the screen facing the user.
[0110] Alternatively, the "region associated with the region where the target translation content is located" is a region that is connected to the region where the target translation content is located. For example, the electronic device displays a dialog box pointing to the target translation content and displays the translation result corresponding to the target translation content in the dialog box.
[0111] Alternatively, the "area associated with the area where the target translation content is located" may be an area specifically used to display translation results, such as a pop-up window, a floating window, or other display area.
[0112] For example, as shown in FIG4 , the electronic device displays a translation interface 40 and displays the translation result corresponding to the target translation content 41 in an area 42 above the target translation content 41 on the translation interface 40. That is, the electronic device can display the translation result corresponding to the target translation content in an area associated with the area where the target translation content is located.
[0113] In this way, since the translation result corresponding to the target translation content can be displayed in an area associated with the area where the target translation content is located, the translation result corresponding to the target translation content can be displayed in the associated area which is convenient for the user to view, thereby improving the flexibility of displaying the translation result.
[0114] Optionally, the above step 103 may further include the following step 103b.
[0115] Step 103b: The electronic device updates and displays the target translation content as a translation result corresponding to the target translation content.
[0116] Optionally, the electronic device updates the target translation content to display its corresponding translation result, which can be understood as follows: 1) When the target translation content is editable content, such as text content, the electronic device can directly replace the target translation content with the translation result corresponding to the target translation content for display. 2) When the target translation content is non-editable content, such as characters in an image, the electronic device can overlay the target translation content with the translation result corresponding to the target translation content, so that the area where the target translation content is located only displays the corresponding translation result.
[0117] Exemplarily, as shown in FIG5(a), the electronic device may display an interface 50 to be translated. If the target translation content is the English word 51 "time" in the interface 50 to be translated, then after the electronic device translates the English word 51 "time", as shown in FIG5(b), the English word 51 "time" may be updated and displayed as the corresponding Chinese translation result 52 "time".
[0118] In this way, since the electronic device can update the target translation content and display it as the translation result corresponding to the target translation content, that is, directly replace or overwrite the target translation content with the translation result corresponding to the target translation content, it is convenient for the user to continue browsing the subsequent content in the interface to be translated in combination with the translation result corresponding to the target translation content, thereby improving the convenience of the user in browsing the content in the interface to be translated.
[0119] Optionally, the first input may be triggered by a smearing operation of the user, and the translation method provided in the embodiment of the present application may further include the following step 106.
[0120] Step 106: The electronic device determines the size of the input track of the first input according to the size of the characters on the interface to be translated.
[0121] Optionally, the first input may be triggered by the user performing a smearing operation on the interface to be translated using a brush tool. That is, when the user performs a smearing operation on the interface to be translated, the electronic device may be triggered to receive the user's first input on the interface to be translated.
[0122] It is understandable that the electronic device can determine the size of the input track of the first input according to the size of the characters on the interface to be translated during the user's first input; thereby, the target translation content can be determined more accurately according to the input track of the first input.
[0123] Optionally, the size of the character in the interface to be translated may be the character height and the character width of the character.
[0124] Optionally, the input trajectory of the first input may include at least one of the following: trajectory length, trajectory width, starting position, ending position, and trajectory direction.
[0125] It should be noted that "the electronic device determines the size of the input trajectory of the first input based on the size of the characters in the interface to be translated" can be understood as the electronic device determines the size of the input trajectory of the first input based on the size of the characters in the interface to be translated determined by the starting position, ending position and trajectory direction of the first input.
[0126] Optionally, during the process of the user performing the first input, the electronic device may adaptively adjust the size of the input track of the first input in real time according to the size of the characters passed by the first input.
[0127] Optionally, when a user smudges with a brush tool, the electronic device can intelligently identify the height of the characters traversed by the brush tool, automatically generate a smudge track that matches the height of the characters traversed by the brush tool, and use this smudge track as the input track of the first input, thereby automatically generating the input track of the first input. In other words, after the user begins smudged on the interface to be translated, the smudge brush can intelligently identify the width and height of the text on the screen, automatically generating a smudge track that matches the width and height of the text, and the electronic device can then determine this smudge track as the input track of the first input.
[0128] Optionally, taking the user performing a smearing operation with a brush tool as an example, the input trajectory of the first input may be adapted to the brush stroke size of the brush tool, and the brush stroke size of the brush tool matches the size of the character that the brush tool passes through.
[0129] For example, assuming that the input trajectory of the first input passes through 5 characters, namely A1 to A5, and the character heights of A1 to A3 are h1, the character height of A4 is h2, and the character height of A5 is A3, then when the electronic device displays the input trajectory of the first input, a trajectory with a track width of h1 can be displayed on A1 to A3, a trajectory with a track width of h2 can be displayed on A4, and a trajectory with a track width of h3 can be displayed on A5.
[0130] It is understood that after the electronic device determines the input trajectory of the first input, the target translation content can be determined based on the input trajectory of the first input. For the description of the target translation content, please refer to the relevant description in the above embodiment. To avoid repetition, it will not be repeated here.
[0131] Optionally, the above embodiment is illustrated by taking the example that the stroke size of the brush tool is the same as the size of the character that the brush tool passes through. In actual implementation, the stroke size of the brush tool can also be any of the following: (1) the default stroke size of the electronic device, (2) the stroke size preset by the user.
[0132] It can be understood that in (1) and (2) above, different pen stroke sizes can enable the electronic device to determine different target translation contents.
[0133] For example, assuming the size of the characters on the interface to be translated is h1, then the user uses a brush tool to scribble on a row of the interface to be translated, i.e., the electronic device receives a first input. If the brush tool's stroke size is h1, then the electronic device can, in response to the first input, determine, based on the size of the characters passed by the scribing operation, that the size of the input trajectory of the first input is adapted to the size of the characters in the row, and determine the characters in the row as target translation content based on the input trajectory of the first input. Alternatively, if the brush tool's stroke size is 3*h1, then the electronic device can, in response to the first input, determine, based on the size of the characters passed by the scribing operation, that the size of the input trajectory of the first input includes: the size of the row and the sizes of the two adjacent rows, and determine the characters in the row and the characters in the two adjacent rows as target translation content based on the input trajectory of the first input. In other words, the larger the brush tool's stroke size, the larger the size of the input trajectory of the first input, and thus the electronic device selects more characters on the interface to be translated.
[0134] In this way, since the size of the input track of the first input can be determined according to the size of the characters on the interface to be translated, when the sizes of the characters on the interface to be translated are different, the electronic device can determine different input tracks, thereby flexibly and accurately selecting the target translation content.
[0135] Optionally, the electronic device may translate the target translation content if a target condition is met. The target condition includes any one of the following:
[0136] Receiving user input to the translation control, such as the third input described below;
[0137] No other input is received within a preset time period after the first input is received.
[0138] Optionally, the preset duration may be a default duration of the electronic device or may be pre-set by the user. This embodiment of the present application does not impose any specific limitation.
[0139] For the description of the translation control, please refer to the relevant description of the translation control in the following embodiments. To avoid repetition, it is not described here.
[0140] In this way, since the electronic device can initiate a translation request and translate the target translation content after receiving the user's input to the translation control, or if no other input is received within a preset period of time after receiving the first input, the electronic device can initiate a translation request after completing the selection of all characters that need to be translated, thereby improving the flexibility of translation.
[0141] Optionally, there are multiple target translation contents. Before step 103, the translation method provided in the embodiment of the present application may further include step 107, and step 103 may include step 103c.
[0142] Step 107: The electronic device receives a third input from the user.
[0143] Step 103c: The electronic device displays translation results corresponding to the plurality of target translation contents in response to the third input.
[0144] In the embodiment of the present application, the third input may be an input by a user triggering a translation request.
[0145] Optionally, the electronic device may display a translation control in the to-be-translated interface when in translation mode. For example, the third input may be any possible input such as a long press input or a click input of the translation control by the user, which is not specifically limited in the present embodiment.
[0146] In an embodiment of the present application, after the electronic device determines multiple target translation contents based on the input trajectory of the first input, it can receive and respond to the user's third input to the translation control, translate the multiple target translation contents, and display the translation results corresponding to the multiple target translation contents.
[0147] Optionally, the translation control may include a first state and a second state. The first state is an unavailable or grayed-out state, in which the electronic device does not respond to user input to the translation control; the second state is an available or highlighted state, in which the electronic device can respond to user input to the translation control. It is understood that the electronic device receiving the user's third input may specifically include: the electronic device receiving the user's input to the translation control in the second state.
[0148] Optionally, the plurality of target translation contents may be a plurality of contents whose display positions are continuous or discontinuous in the interface to be translated, for example, each content may be at least one character whose display position is continuous in the interface to be translated.
[0149] For example, as shown in FIG2(b), the multiple target translation contents may include the target translation content "The Queen sat sewing by her window" determined based on input trajectory 21 and the target translation content "time" determined based on input trajectory 22. In other words, for the multiple target translation contents determined, the user can click the "Translate" button, i.e., the translation control, to trigger the electronic device to translate the multiple target translation contents with one click and display the corresponding translation results for the user's convenience.
[0150] It is understandable that after the user has determined or selected the target translation content, the user can trigger the electronic device to translate all the selected content through a third input.
[0151] In an embodiment of the present application, when there are multiple target translation contents, the electronic device can simultaneously translate the multiple target translation contents in response to the third input, and display the translation results corresponding to the multiple target translation contents respectively.
[0152] Exemplarily, as shown in FIG2( b), the electronic device can determine the target translation content “time” based on the input trajectory 22, and determine the target translation content “The Queen sat sewing by her window” based on the input trajectory 21. The electronic device can then receive a click input from the user on the translation control 23, that is, the electronic device receives the user's third input, and the electronic device can translate the multiple target translation contents in response to the third input, and display the translation results corresponding to the multiple target translation contents respectively.
[0153] In this way, since the electronic device can display the translation results corresponding to multiple target translation contents through the third input, the electronic device can translate all the determined target translation contents when receiving the input of the user triggering the translation of the target translation content. Therefore, the electronic device can translate the selected content after completing the selection of all the content that needs to be translated, thereby improving the accuracy of the translation.
[0154] Optionally, after the above step 103, the translation method provided in the embodiment of the present application may further include the following steps 108 and 109.
[0155] Step 108: The electronic device receives a fourth input from the user.
[0156] Step 109: In response to the fourth input, the electronic device cancels displaying the translation result corresponding to the target translation content.
[0157] In the embodiment of the present application, the fourth input may be an input for the user to trigger the resumption of display of the target translation content.
[0158] Exemplarily, the fourth input may be any possible input such as a long press input, a sliding input, etc. of the area where the translation result corresponding to the target translation content is located by the user, to trigger the restoration of the display of the target translation content.
[0159] Optionally, the electronic device may display a view original text control in the interface to be translated, and after receiving a fourth input from the user to the view original text control, restore the display of the original target translation content in the interface to be translated.
[0160] Exemplarily, the fourth input may also be any possible input such as a long press input or a click input of the view original text control by the user, which is not specifically limited in the embodiment of the present application.
[0161] Optionally, after the electronic device cancels displaying the translation result corresponding to the target translation content, the original target translation content is displayed on the to-be-translated interface.
[0162] Exemplarily, as shown in FIG5(b), after updating and displaying the target translation content 51 "time" as the translation result 52 "time" corresponding to the target translation content, the electronic device may receive and respond to the user's click input on the "View Original Text" control 53. As shown in FIG5(a), the electronic device may cancel the display of the translation result 52 "time" corresponding to the target translation content on the to-be-translated interface 50 and restore the display of the target translation content 51 "time".
[0163] Further optionally, for translation results corresponding to multiple target translation contents displayed on the electronic device, the fourth input may be an input of a translation result corresponding to one of the translation results corresponding to the multiple target translation contents, so as to resume display of the one target translation content.
[0164] For example, assume that the electronic device displays translation result 1 corresponding to target translation content 1, translation result 2 corresponding to target translation content 2, and translation result 3 corresponding to target translation content 3. The user can perform an upward or downward sliding input on translation result 2 corresponding to target translation content 2. That is, the electronic device receives and responds to the user's fourth input, cancels the display of translation result 2 corresponding to target translation content 2, thereby restoring the display of target translation content 2, and maintains the display of translation result 1 corresponding to target translation content 1 and translation result 3 corresponding to target translation content 3.
[0165] In this way, since the electronic device can receive and respond to the user's fourth input and cancel the display of the translation result corresponding to the target translation content, the user's input can be used to trigger the restoration of the display of the target translation content, thereby making it convenient for the user to view the content in the original interface to be translated.
[0166] Optionally, in a first possible manner, the above step 102 may be specifically implemented through the following step 102e.
[0167] Step 102e: In response to the first input, the electronic device determines, according to the input trajectory of the first input, characters that intersect with the input trajectory or the paragraph where the characters that intersect with the input trajectory are located as target translation content.
[0168] In this way, since the characters intersecting with the input trajectory or the paragraph containing the characters intersecting with the input trajectory can be determined as target translation content according to the input trajectory of the first input, the flexibility of selecting content in the interface to be translated can be improved.
[0169] Optionally, the above step 102e can be implemented through the following steps A and B, or can be implemented through the following steps A and C.
[0170] Step A: The electronic device determines the magnitude relationship between the first angle and the preset angle in response to the first input.
[0171] The first angle is the angle between the trajectory direction of the input trajectory of the first input and the character arrangement direction; and the character arrangement direction is the character arrangement direction in the paragraph passed by the input trajectory.
[0172] In an embodiment of the present application, after receiving a first input, the electronic device may first determine the trajectory direction of the first input and the direction of character arrangement in the paragraph through which the input trajectory passes; and determine a first angle between the trajectory direction and the character arrangement direction. The electronic device then compares the magnitude of the first angle with a preset angle. If the first angle is less than the preset angle, the electronic device proceeds to step B below; if the angle is greater than or equal to the preset angle, the electronic device proceeds to step C below.
[0173] In the embodiment of the present application, “the direction in which characters in the paragraph passed by the input track of the first input” refers to the direction in which adjacent characters in the paragraph are arranged.
[0174] For example, the character arrangement direction may be from left to right, from top to bottom, from lower left corner to upper right corner, from lower right corner to upper left corner, clockwise or counterclockwise, etc.
[0175] Among them, up, down, left, right, lower right corner, upper left corner, upper right corner, lower left corner, clockwise, counterclockwise, etc. are all illustrated by the example of the electronic device displaying the target image when the screen of the electronic device is facing the user.
[0176] Optionally, if the first angle is less than a preset angle, it can be indicated that the first input was input in the direction of character arrangement, and the input trajectory of the first input is in the same direction as the character arrangement direction; that is, the characters that the user needs to recognize and select are the characters passed by the input trajectory. If the first angle is greater than or equal to the preset angle, it can be indicated that the trajectory direction of the input trajectory is different from the character arrangement direction; that is, the characters that the user needs to recognize and select are all characters in the paragraph passed by the input trajectory.
[0177] Further optionally, when the first angle is smaller than a preset angle, the electronic device can correct the input trajectory, thereby avoiding character selection errors caused by user hand tremors, that is, improving the anti-shake capability of the first input.
[0178] Further optionally, the electronic device may display the corrected input track so that the user can view the selected content.
[0179] Optionally, the preset angle may be a default angle of the electronic device, may be pre-set by the user, or may be obtained by the electronic device based on historical usage records, which is not specifically limited in the embodiments of the present application.
[0180] Step B: The electronic device determines characters that intersect with the input trajectory of the first input as target translation content.
[0181] Step C: The electronic device determines all characters in the paragraph that intersects with the input trajectory of the first input as target translation content.
[0182] Optionally, the electronic device may determine the paragraph that the input trajectory passes through according to the starting position and the ending position of the input trajectory of the first input, and recognize and select all characters in the paragraph.
[0183] In this way, since the electronic device can determine the characters that intersect with the input trajectory as target translation content when the angle between the trajectory direction of the input trajectory and the character arrangement direction is less than a preset angle; or, when the angle between the trajectory direction of the input trajectory and the character arrangement direction is greater than or equal to the preset angle, all characters in the paragraph that intersects with the input trajectory are determined as target translation content, the user can trigger the electronic device to select different characters in the interface to be translated as target translation content through input in different trajectory directions, thereby improving the flexibility and accuracy of selecting characters in the interface to be translated.
[0184] Optionally, in a second possible manner, the above step 102 may be specifically implemented through the following step 102f.
[0185] Step 102f: In response to the first input, the electronic device determines all characters in the sentence where the input trace of the first input starts or all characters in the paragraph where the input trace of the first input starts as target translation content according to the input form of the first input.
[0186] The input form of the first input may be: a first input form or a second input form.
[0187] The first input form and the second input form may be different input forms.
[0188] Optionally, the first input form and the second input form may be default for the electronic device or may be preset by the user.
[0189] The first input form and the second input form can be any different input forms, and the applicant does not impose any limitation on this.
[0190] For example, the first input form may be a click input, and the second input form may be a double-click input. For another example, the first input form may be a long press input, and the second input form may be a re-press input.
[0191] In this way, since all characters in the sentence where the starting position of the input track is located or all characters in the paragraph where the starting position of the input track is located can be determined as target translation content according to the input form of the first input, the flexibility of selecting characters in the interface to be translated can be improved.
[0192] Optionally, the above step 102f can be specifically implemented through the following step D or step E.
[0193] Step D: In response to the first input, when the input form of the first input is the first input form, the electronic device determines all characters in the sentence containing the characters that intersect with the starting position of the input trajectory of the first input as target translation content.
[0194] Step E: When the input form of the first input is the second input form, the electronic device determines all characters in the paragraph containing the characters that intersect with the starting position of the input trajectory of the first input as target translation content.
[0195] The translation method provided in the embodiments of the present application is described below with reference to specific examples.
[0196] For example, assuming that the first input form is click input and the second input form is double-click input, then:
[0197] If the electronic device receives a click input from the user on the target image of the interface to be translated, that is, the input form of the first input is a click input, the electronic device can determine all characters in the sentence containing the characters that intersect with the starting position of the input trajectory of the first input as target translation content.
[0198] If the electronic device receives a double-click input from the user on the target image of the interface to be translated, that is, the input form of the first input is a double-click input, the electronic device can determine all characters in the paragraph where the characters intersect with the starting position of the input trajectory of the first input as target translation content.
[0199] It should be noted that, when the input form of the first input is a click input, a double-click input, or a re-press input, the starting position of the input track may also be referred to as the input position.
[0200] In this way, since the electronic device can determine the target translation content based on the input form of the first input, the user can trigger the electronic device to accurately select the target translation content they need to translate through different forms of first input according to their actual translation needs. This can improve the flexibility and accuracy of selecting the translation content in the translation interface.
[0201] Optionally, before the above step 101, the translation method provided in the embodiment of the present application may further include the following step 110; after the above step 102, the translation method provided in the embodiment of the present application may further include the following step 111.
[0202] Step 110: The electronic device displays a mask on the interface to be translated.
[0203] Optionally, when the electronic device is in the local translation mode, the electronic device may display a mask with a preset transparency on the interface to be translated.
[0204] It should be noted that the mask is equivalent to a cover, and its function is to lock the content in the interface to be translated so that the selected target translation content can be highlighted later.
[0205] Step 111: The electronic device removes the mask on the target translation content.
[0206] In the embodiment of the present application, after the electronic device determines the target translation content, it can remove the mask displayed on the target translation content.
[0207] Optionally, the electronic device may display the input track of the first input or highlight the target translation content by canceling the display mask.
[0208] It is understandable that after the electronic device cancels the mask on the target translation content, the mask is still displayed in the interface to be translated except for the area where the target translation content is located, so as to highlight the target translation content.
[0209] Optionally, after displaying the overlay on the interface to be translated, the electronic device may display a first prompt, such as "Scribble to select translation content." The first prompt may guide the user to scribble on the content on the interface to be translated, that is, to perform a first input, so that the electronic device determines at least one character on the interface to be translated as the target translation content based on the input trajectory of the first input.
[0210] Optionally, after displaying the overlay on the interface to be translated, the electronic device may display a second prompt, such as "Pinch to adjust image size." This second prompt guides the user to adjust the display size of the interface to be translated based on actual translation needs, allowing the electronic device to more accurately select the target translation content in the interface to be translated based on the input trajectory of the first input.
[0211] Of course, in actual implementation, the electronic device may also automatically adjust the display size of the interface to be translated according to the display size and display position of the characters in the interface to be translated, such as enlarging the interface to be translated.
[0212] In this way, since the electronic device can display a mask on the interface to be translated, and after the electronic device determines the target translation content in the interface to be translated according to the input trajectory of the first input, the mask on the target translation content is cancelled, the target translation content determined according to the input trajectory of the first input can be highlighted, so that the user can quickly check whether the content determined by the electronic device meets his translation needs.
[0213] Optionally, after the above step 111, the translation method provided in the embodiment of the present application may further include the following steps 112 and 113.
[0214] Step 112: The electronic device receives a fifth input from the user.
[0215] Step 113: In response to the fifth input, the electronic device deselects at least one character in the target translation content and displays a mask on the at least one character.
[0216] Alternatively, the fifth input may be a user input on the translation interface. Alternatively, the fifth input may be a user input to an undo control (e.g., the "Undo" control 24 in FIG. 2( b)) or a clear control (e.g., the "Clear" control 25 in FIG. 2( b)). The undo control may be used to unselect at least one character in the target translation content according to the order in which the characters were selected, and the clear control may be used to deselect all selected characters.
[0217] Optionally, when the fifth input is the user's input on the interface to be translated, the electronic device can deselect any of the following items in the target translation content based on the input trajectory of the fifth input: characters that intersect with the input trajectory, sentences where the characters that intersect with the input trajectory are located, and paragraphs where the characters that intersect with the input trajectory are located.
[0218] Optionally, the fifth input may be a touch input or an air gesture input by the user on at least one character of the target translation content.
[0219] The translation method provided in the embodiments of the present application is described below.
[0220] For example, assuming that the target translation content includes 6 characters selected in sequence, then:
[0221] If the user clicks on the undo control, that is, the electronic device receives the fifth input, the electronic device can, in response to the fifth input, unselect the last selected character among the six characters, that is, at least one character in the target translation content, and display a mask on the at least one character.
[0222] If the user clicks on the clear control, that is, the electronic device receives the fifth input, the electronic device can deselect the six characters in response to the fifth input and display a mask on the six characters.
[0223] In this way, after the electronic device determines the target translation content, the user can use the fifth input to trigger the electronic device to deselect at least one character in the target translation content and restore the overlay display on the at least one character. Therefore, if the user discovers that the electronic device has selected multiple characters or incorrectly selected characters, the user can use the fifth input to trigger the electronic device to correct the selected characters, thereby improving the accuracy of character selection in the interface to be translated. This allows the electronic device to avoid the impact of multiple or incorrect character selection on the accuracy of the translation result, thereby improving the accuracy of the translation of the content in the interface to be translated.
[0224] Optionally, after the above step 103, the translation method provided in the embodiment of the present application may further include the following steps 114 and 115.
[0225] Step 114: The electronic device receives a sixth input from the user.
[0226] Step 115: The electronic device performs a target operation corresponding to the sixth input in response to the sixth input.
[0227] The target operation may include at least one of the following: copying the translation result corresponding to the target translation content, playing the translation result of the target translation content, and displaying other translation results of the target translation content.
[0228] For example, after receiving the first input, the electronic device may display a floating window 60, as shown in FIG6 , and display the target translation content 61, the translation 62 corresponding to the target translation content, i.e., the translation result, a "copy original text" control 63, a "copy translation" control 64, a "read original text" control 65, a "read translation" control 66, a "view more interpretations" control 67, a "close this floating window" control 68, and a "translation direction" control 69 in the floating window 60. Then:
[0229] (1) The user can click the "Copy Original" control 63 or the "Copy Translation" control 64 to trigger the electronic device to save the target translation content or the translation of the target translation content to the clipboard, so that the target translation content or the translation of the target translation content can be pasted into various applications in the electronic device before being overwritten by the next copied content;
[0230] (2) The user can click on the "View more interpretations" control 67 to trigger the electronic device to display the translation result interface of the translation application, and the user can view more interpretations related to the above-mentioned target translation content on the translation result interface; for example, assuming that the target translation content is "searched", and the translation of "searched" is: "search", then the translation result interface can include "search; search; look for; search; think, ponder (answers to questions, etc.)".
[0231] (3) The user can click the "Close this floating window" control 68 to trigger the electronic device to cancel the display of the floating window, so as to restore the target translation content in the translation interface to a state where the target translation content is selected;
[0232] (4) The user can also click on the “Translation Language” control 69 to trigger the electronic device to translate the target translation content into other languages and display the corresponding translation.
[0233] Optionally, the electronic device may also receive input from the user to scale the floating window, and adjust the size and display position of the floating window.
[0234] Optionally, when the display size of the translation result exceeds the display size of the floating window, the electronic device may trigger the electronic device to slide and display all the translation results by inputting into the scroll bar of the floating window.
[0235] The translation method provided in the embodiments of the present application is illustrated below with specific examples.
[0236] For example, as shown in FIG7 , the translation method provided in the embodiment of the present application may include the following steps 701 to 708 .
[0237] Step 701: The electronic device receives and responds to a user input to a local translation mode control, controlling the interface to be translated to enter a local translation mode.
[0238] Optionally, the user selects the local translation mode in the function mode of the global translation floating window panel of the electronic device. The electronic device receives the user's input and controls the interface to be translated to enter the local translation mode.
[0239] Step 702: The electronic device displays a prompt text for the smearing operation.
[0240] Optionally, when the user enters the local translation mode for the first time, the image and text on the current screen of the electronic device can be locked, and the electronic device can display a prompt text "Single-finger smear to select translation content" to guide the user to use their finger to directly smear the content in the interface to be translated to select the target translation content, that is, the content to be translated.
[0241] Optionally, the electronic device may also display a prompt text of “pair-finger zoom to adjust image size” to guide the user to adjust the image size according to the graphic style so as to more accurately paint the selected content.
[0242] Optionally, when the user enters the local translation mode regularly, that is, not for the first time, the electronic device may prompt the user to "scrub the content to be translated", and the prompt disappears after smudging.
[0243] Optionally, other areas of the prompt text may be masked with a gray layer to guide the user to focus on the prompt text information.
[0244] Step 703: The electronic device receives and responds to the user's input of smearing the target translation area in the to-be-translated interface, and selects character content in the target translation area.
[0245] Optionally, the target translation area may be an area where the target translation content is located, and the target translation content may be character content that the user requires to be translated.
[0246] Optionally, after the user starts smearing the target translation area in the to-be-translated interface, the smearing trajectory may be consistent with the finger trajectory.
[0247] Optionally, the electronic device can support the user to simultaneously mark multiple target translation areas and simultaneously translate all the content selected by the user. For example, if the user simultaneously selects the characters at the beginning and the end of a paragraph, the electronic device can simultaneously translate the characters at the beginning and the end of the paragraph.
[0248] Optionally, the user can click on a character in the to-be-translated interface to select the character and the sentence or paragraph in which the character is located for translation, thereby improving the convenience of selecting local content.
[0249] Step 704: The electronic device determines whether a user input for canceling or clearing a control is received.
[0250] Optionally, the user can independently determine whether to accurately paint the selected target translation area. If the target translation area is not accurately painted, the user can re-paint the target translation area by inputting an undo control or a clear control on the electronic device.
[0251] Optionally, before the user smears the target translation area, the translation function of the electronic device can be grayed out and unavailable; after the user smears the target translation area, the translation function of the electronic device is highlighted and available to guide the user to initiate a translation request after completing the smearing.
[0252] Step 705: When the electronic device receives the user's input on the cancel control, it cancels the selection of the target character according to the order in which the characters were selected; when the electronic device receives the user's input on the clear control, it cancels the selection of all selected characters.
[0253] Optionally, if the user mistakenly paints over the target translation area, they can use the undo or clear controls to undo the last paint operation or clear all paint operations, allowing them to more accurately select the target translation area. The user can then adjust the brush size and continue painting.
[0254] Optionally, the user can adjust the brush stroke size and continue painting. If the user adjusts the brush, the brush stroke size changes accordingly. Further, if the user changes the brush size, the electronic device can remember the user's selection, and the changed brush stroke size can be the default state for future brush strokes.
[0255] Further optionally, the electronic device may add a smart smear brush that can adapt its width and height according to the current character height, thereby effectively improving the accuracy of text height recognition so as to more accurately smear the target translation area.
[0256] Step 706: The electronic device initiates a translation request without receiving any input from the user to cancel or clear the control.
[0257] Optionally, after selecting the character content in the target translation area, the electronic device can set the translation function to be highlighted and available, and the user can click the translation button to trigger the electronic device to initiate a translation request.
[0258] Optionally, the electronic device may perform OCR translation of the image in the background to obtain character content in the target translation area.
[0259] Step 707: The electronic device displays a pop-up window of the translation result.
[0260] Optionally, after the electronic device initiates a translation request, a translation floating window may pop up at the bottom of the screen page.
[0261] Optionally, the floating window may support displaying the translated original text, the translated text, and its copying and reading functions, and may support viewing more interpretation results.
[0262] For example, if the user clicks "View more translation results", the electronic device can jump to the translation result page of the translator; if the user clicks back or uses a back gesture, the electronic device can be controlled to return to the translation floating window page.
[0263] As another example, if the user clicks the "Copy" button, the electronic device can save the "translation" to the clipboard and paste it in various system applications before the next copy content is overwritten; if the user clicks the close button in the upper right corner of the floating window, the floating window can be closed and the character content in the target translation area can be returned to the selected state; if the user drags the translation floating window handle, the electronic device can scale the floating window. When the display size of the translation result exceeds the upper limit of the display size of the floating window, the electronic device can slide the content in the form of a transparent bar.
[0264] Optionally, users can long-press characters in the target translation area, and the electronic device can simultaneously select and translate multiple target translation areas with one click. The electronic device can also display the translated text directly over the original text, facilitating user comparison and viewing, optimizing the user's immersive reading experience, and improving the overall efficiency of presenting translation results for characters in the target translation area.
[0265] Step 708: After receiving the input returned by the user, the electronic device exits the selection state, exits the local translation mode, and ends the translation.
[0266] For other descriptions in step 701 to step 708, please refer to the relevant descriptions in the above embodiments. In order to avoid repetition, they are not repeated here.
[0267] An embodiment of the present application provides a translation method. Since target translation content to be translated can be determined in the interface to be translated based on an input trajectory input by a user on the interface to be translated, and a translation result corresponding to the target translation content can be displayed, the target translation content to be translated can be determined in the interface to be translated based on an input trajectory input by a user on the interface to be translated, so that the user can conveniently select the translation content to be translated.
[0268] The translation method provided in the embodiment of the present application can be executed by a translation device. In the embodiment of the present application, the translation device provided in the embodiment of the present application is described by taking the translation method executed by the translation device as an example.
[0269] FIG8 shows a possible structural diagram of a translation device involved in an embodiment of the present application. As shown in FIG8 , the translation device 80 may include: a receiving module 81 , a determining module 82 , and a display module 83 .
[0270] Among them, the receiving module 81 is used to receive a first input to the translation interface; the determining module 82 is used to determine the target translation content according to the input trajectory of the first input in response to the first input received by the receiving module 81; and the display module 83 is used to display the translation result corresponding to the target translation content determined by the determining module 82.
[0271] In a possible implementation, the receiving module 81 is further configured to receive a second input of the interface to be translated before receiving the first input of the interface to be translated;
[0272] The determining module 82 is further configured to determine a translation mode in response to the second input received by the receiving module 81;
[0273] The determination module 82 is specifically configured to:
[0274] In response to the first input, when the translation mode is the word mode, determining characters that intersect with the input trajectory of the first input as target translation content;
[0275] In response to the first input, when the translation mode is sentence mode, determining the sentence containing the characters intersecting with the input trajectory of the first input as the target translation content;
[0276] In response to the first input, when the translation mode is the paragraph mode, the paragraph where the characters intersecting with the input trajectory of the first input are located is determined as the target translation content.
[0277] In a possible implementation, the first input is triggered by a smearing operation of the user;
[0278] The determination module 82 is further configured to determine the size of the input track of the first input according to the size of the characters on the interface to be translated.
[0279] In a possible implementation, the interface to be translated includes a target image;
[0280] The receiving module 81 is specifically configured to receive a first input of a target image;
[0281] The determination module 82 is specifically configured to, in response to the first input, determine target translation content from the characters in the target image according to an input trajectory of the first input on the target image.
[0282] In a possible implementation, the display module 83 is specifically configured to display the translation result corresponding to the target translation content in an area associated with the area where the target translation content is located.
[0283] In a possible implementation, there are multiple target translation contents.
[0284] The receiving module 81 is further configured to receive a third input before the display module 83 displays the translation result corresponding to the target translation content;
[0285] The display module 83 is specifically configured to display translation results corresponding to a plurality of target translation contents in response to the third input.
[0286] In a possible implementation, the receiving module 81 is further configured to receive a fourth input after the display module 83 displays the translation result corresponding to the target translation content;
[0287] The display module 83 is further configured to cancel displaying the translation result corresponding to the target translation content in response to the fourth input.
[0288] The embodiment of the present application provides a translation device, which can determine the target translation content to be translated in the interface to be translated according to the input trajectory input by the user on the interface to be translated, so that the user can conveniently select the translation content to be translated.
[0289] The translation device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a palmtop computer, an in-vehicle electronic device, a mobile internet device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc., and can also be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., and the embodiment of the present application does not specifically limit it.
[0290] The translation device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0291] The translation device provided in the embodiment of the present application can implement each process implemented in the above-mentioned translation method embodiment and achieve the same technical effect. To avoid repetition, it will not be described here.
[0292] Optionally, as shown in Figure 9, an embodiment of the present application also provides an electronic device 900, including a processor 901 and a memory 902, wherein the memory 902 stores a program or instruction that can be run on the processor 901. When the program or instruction is executed by the processor 901, the various steps of the above-mentioned translation method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0293] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0294] FIG10 is a schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application.
[0295] The electronic device 1000 includes but is not limited to components such as a radio frequency unit 1001 , a network module 1002 , an audio output unit 1003 , an input unit 1004 , a sensor 1005 , a display unit 1006 , a user input unit 1007 , an interface unit 1008 , a memory 1009 , and a processor 1010 .
[0296] Those skilled in the art will appreciate that the electronic device 1000 may further include a power source (such as a battery) to power various components. The power source may be logically connected to the processor 1010 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The electronic device structure shown in FIG10 does not limit the electronic device. The electronic device may include more or fewer components than shown, or may combine certain components or arrange the components differently, which will not be described in detail here.
[0297] Among them, the user input unit 1007 is used to receive a first input to the translation interface; the processor 1010 is used to determine the target translation content according to the input trajectory of the first input in response to the first input received by the user input unit 1007; the display unit 1006 is used to display the translation result corresponding to the target translation content determined by the processor 1010.
[0298] Optionally, the user input unit 1007 is further configured to receive a second input on the interface to be translated before receiving the first input on the interface to be translated;
[0299] The processor 1010 is further configured to determine a translation mode in response to a second input received by the user input unit 1007;
[0300] The processor 1010 is specifically configured to:
[0301] In response to the first input, when the translation mode is the word mode, determining characters that intersect with the input trajectory of the first input as target translation content;
[0302] In response to the first input, when the translation mode is sentence mode, determining the sentence containing the characters intersecting with the input trajectory of the first input as the target translation content;
[0303] In response to the first input, when the translation mode is the paragraph mode, the paragraph where the characters intersecting with the input trajectory of the first input are located is determined as the target translation content.
[0304] Optionally, the first input is triggered by a smearing operation of the user;
[0305] The processor 1010 is further configured to determine the size of the input track of the first input according to the size of the characters on the interface to be translated.
[0306] Optionally, the interface to be translated includes a target image;
[0307] The user input unit 1007 is specifically configured to receive a first input of a target image;
[0308] The processor 1010 is specifically configured to, in response to a first input, determine target translation content from characters in the target image according to an input trajectory of the first input on the target image.
[0309] Optionally, the display unit 1006 is specifically configured to display the translation result corresponding to the target translation content in an area associated with the area where the target translation content is located.
[0310] Optionally, there are multiple target translation contents.
[0311] The user input unit 1007 is further configured to receive a third input before the display unit 1006 displays the translation result corresponding to the target translation content;
[0312] The display unit 1006 is specifically configured to display translation results corresponding to a plurality of target translation contents in response to the third input.
[0313] Optionally, the user input unit 1007 is further configured to receive a fourth input after the display unit 1006 displays the translation result corresponding to the target translation content;
[0314] The display unit 1006 is further configured to cancel displaying the translation result corresponding to the target translation content in response to a fourth input.
[0315] An embodiment of the present application provides an electronic device that can determine target translation content to be translated in the interface to be translated based on an input trajectory input by the user on the interface to be translated, so that the user can conveniently select the translation content to be translated.
[0316] It should be understood that in an embodiment of the present application, the input unit 1004 may include a graphics processing unit (GPU) 10041 and a microphone 10042, and the graphics processor 10041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes a touch panel 10071 and at least one of other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include two parts: a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and an operating stick, which will not be repeated here.
[0317] The memory 1009 can be used to store software programs and various data. The memory 1009 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, applications or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 1009 may include a volatile memory or a non-volatile memory, or the memory 1009 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM), and a direct memory bus random access memory (DRRAM). The memory 1009 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0318] Processor 1010 may include one or more processing units. Optionally, processor 1010 integrates an application processor and a modem processor. The application processor primarily handles operations related to the operating system, user interface, and application programs, while the modem processor primarily processes wireless communication signals, such as a baseband processor. It is understood that the modem processor may not be integrated into processor 1010.
[0319] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned translation method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0320] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0321] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned translation method embodiment and achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0322] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0323] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned translation method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0324] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0325] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0326] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
Claims
1. A translation method, comprising: Receiving a first input of an interface to be translated; In response to the first input, determining target translation content according to an input trajectory of the first input; The translation result corresponding to the target translation content is displayed.
2. The method according to claim 1, wherein: Before the step of receiving the first input of the interface to be translated, the method further includes: Receiving a second input to the interface to be translated; In response to the second input, determining a translation mode; The step of determining target translation content according to an input track of the first input in response to the first input includes: In response to the first input, when the translation mode is a word mode, determining characters that intersect with an input trajectory of the first input as the target translation content; In response to the first input, when the translation mode is a sentence mode, determining the sentence containing the characters intersecting with the input trajectory of the first input as the target translation content; In response to the first input, when the translation mode is the paragraph mode, the paragraph where the characters intersecting with the input track of the first input are located is determined as the target translation content.
3. The method according to claim 1, wherein: The first input is triggered by a smearing operation of the user; The method further comprises: The size of the input track of the first input is determined according to the size of the characters of the interface to be translated.
4. The method according to claim 1, wherein: The interface to be translated includes a target picture; The receiving a first input of the interface to be translated comprises: Receiving a first input of the target image; The step of determining target translation content according to an input track of the first input in response to the first input includes: In response to the first input, the target translation content is determined from characters of the target image according to an input track of the first input on the target image.
5. The method according to claim 1, wherein: The displaying of the translation result corresponding to the target translation content includes: In an area associated with the area where the target translation content is located, a translation result corresponding to the target translation content is displayed.
6. The method according to claim 1, wherein: The displaying of the translation result corresponding to the target translation content includes: The target translation content is updated and displayed as a translation result corresponding to the target translation content.
7. The method according to claim 1, wherein: The number of the target translation contents is multiple; Before the step of displaying the translation result corresponding to the target translation content, the method further includes: receiving a third input; The displaying of the translation result corresponding to the target translation content includes: In response to the third input, translation results corresponding to a plurality of the target translation contents are displayed.
8. The method according to any one of claims 5 to 7, wherein: After the step of displaying the translation result corresponding to the target translation content, the method further includes: receiving a fourth input; In response to the fourth input, the display of the translation result corresponding to the target translation content is cancelled.
9. A translation device, comprising: Receiving module, determining module and display module; The receiving module is used to receive a first input of the interface to be translated; The determining module is configured to determine target translation content according to an input track of the first input in response to the first input received by the receiving module; The display module is used to display the translation result corresponding to the target translation content determined by the determination module.
10. The device according to claim 9, wherein: The receiving module is further configured to receive a second input to the interface to be translated before receiving a first input to the interface to be translated; The determining module is further configured to determine a translation mode in response to the second input received by the receiving module; The determination module is specifically used for: In response to the first input, when the translation mode is a word mode, determining characters that intersect with an input trajectory of the first input as the target translation content; In response to the first input, when the translation mode is a sentence mode, determining the sentence containing the characters intersecting with the input trajectory of the first input as the target translation content; In response to the first input, when the translation mode is the paragraph mode, the paragraph where the characters intersecting with the input track of the first input are located is determined as the target translation content.
11. The device according to claim 9, wherein: The first input is triggered by a smearing operation of the user; The determination module is further configured to determine the size of the input track of the first input according to the size of the characters of the interface to be translated.
12. The device according to claim 9, wherein: The interface to be translated includes a target picture; The receiving module is specifically configured to receive a first input of the target image; The determination module is specifically configured to determine the target translation content from the characters of the target image in response to the first input and according to an input track of the first input on the target image.
13. The device according to claim 9, wherein: The display module is specifically configured to display the translation result corresponding to the target translation content in an area associated with the area where the target translation content is located.
14. An electronic device comprising a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the translation method according to any one of claims 1 to 8 are implemented.
15. A readable storage medium storing a program or an instruction, wherein the program or the instruction, when executed by a processor, implements the steps of the translation method according to any one of claims 1 to 8.
16. A chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the steps of the translation method according to any one of claims 1 to 8. 17 . A computer program product, wherein the computer program product is stored in a non-volatile storage medium and is executed by at least one processor to implement the steps of the translation method according to claim 1 .
18. An electronic device, configured to execute the steps of the translation method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Translation method and device, terminal and storage medium
CN107656922A
Picture character translation method, application and computer equipment
CN108182184A
Picture translation method and device, terminal and storage medium
CN108536686A
Translation method and device, electronic equipment and readable storage medium
CN116362264A
Translation method, translation apparatus, and electronic device
WO2022063046A1
