Text information processing method and device, equipment and storage medium

By using a first mapping table and a second mapping table to look up text identifiers and translate text in the application, the problem of low efficiency in multilingual display of the application is solved, and fast and low-cost text information translation and display are achieved.

CN122072640APending Publication Date: 2026-05-22TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2024-11-20
Publication Date
2026-05-22

AI Technical Summary

Technical Problem

In existing technologies, applications are inefficient at processing text information in different languages, requiring developers to manually write or link translation text resource files in the code files, resulting in low efficiency.

Method used

By using a first mapping table and a second mapping table, text information is obtained and the corresponding text identifier and translated text are found in them, enabling fast translation and display of text content without modifying the application code file.

Benefits of technology

It enables rapid adaptation to multiple languages ​​without changing the application code files, providing a low-cost language adaptation solution that requires no specific modifications from developers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122072640A_ABST
    Figure CN122072640A_ABST
Patent Text Reader

Abstract

The invention discloses a text information processing method and device, equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: acquiring text information, a first mapping table and a second mapping table, wherein the text information is used for indicating character contents needing to be rendered by an application program; searching in the first mapping table on the basis of the text information to obtain a first text identifier, wherein the first mapping table comprises at least two development language key value pairs which take the text content of the development language of the application program as keywords and take the text identifier as a data item; a first translation text is searched in the second mapping table based on the first text identifier, the second mapping table comprises at least two translation language key value pairs with the text identifier as a keyword and text content of a translation language as a data item, and the translation language is different from the development language; and rendering and displaying the character content of the first translated text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for processing text information. Background Technology

[0002] With the continuous development of computer technology, the functions of application programs are becoming increasingly diverse.

[0003] In related technologies, in order to meet the needs of users in different regions, applications need to be adapted to display in different languages; for example, during the application development phase, developers need to write or link resource files of translated text in different languages ​​into the text content of the code file.

[0004] However, the processing efficiency of the aforementioned text information is relatively low. Summary of the Invention

[0005] This application provides a method, apparatus, device, and storage medium for processing text information, the technical solution of which is as follows:

[0006] According to one aspect of this application, a method for processing text information is provided, characterized in that the method is executed by a computer device, and the method includes:

[0007] Obtain text information, a first mapping table, and a second mapping table, wherein the text information is used to indicate the character content that the application needs to render;

[0008] The first text identifier is obtained by searching the first mapping table based on the text information. The first mapping table includes at least two key-value pairs in the development language of the application, with the text content in the development language of the application as the keyword and the text identifier as the data item.

[0009] The first translated text is found in the second mapping table based on the first text identifier. The second mapping table includes at least two key-value pairs in the translation language, with the text identifier as the keyword and the text content in the translation language as the data item. The translation language is different from the development language.

[0010] Render and display the character content of the first translated text.

[0011] According to another aspect of this application, a text information processing apparatus is provided, the apparatus comprising:

[0012] The acquisition module is used to acquire text information, a first mapping table, and a second mapping table, wherein the text information is used to indicate the character content that the application needs to render;

[0013] The processing module is used to find a first text identifier in the first mapping table based on the text information. The first mapping table includes at least two key-value pairs in the development language of the application, with the text content in the development language of the application as the keyword and the text identifier as the data item.

[0014] The processing module is further configured to find the first translated text in the second mapping table based on the first text identifier. The second mapping table includes at least two translation language key-value pairs with the text identifier as the keyword and the text content of the translation language as the data item. The translation language is different from the development language.

[0015] The display module is used to render and display the character content of the first translated text.

[0016] In an optional design of this application, the processing module is further configured to:

[0017] Based on the text information, the first development language key-value pair in the first mapping table is obtained. The text information includes the keyword of the first development language key-value pair, and the data item of the first development language key-value pair includes at least two candidate text identifiers.

[0018] The first text identifier is determined from the at least two candidate text identifiers.

[0019] In an optional design of this application, the processing module is further configured to:

[0020] Obtain the associated information of the text information;

[0021] Based on the association information, the first text identifier is determined from the at least two candidate text identifiers, and the data item of the first development language key-value pair includes the candidate association information corresponding to the at least two candidate text identifiers respectively;

[0022] The associated information is used to indicate at least one of the following: the context information of the text information, the display interface where the text information is located, and the display font of the text information in the display interface.

[0023] In an optional design of this application, the acquisition module is further configured to acquire a trie when the search result for the text information in the first mapping table is empty, wherein the trie is a tree-like data structure for searching multiple text characters;

[0024] The processing module is further configured to obtain the second text identifier corresponding to the first branch in the trie, wherein the character sequence on the first branch is a subset of the text information;

[0025] The processing module is further configured to search for the second translated text in the second mapping table based on the second text identifier;

[0026] The processing module is further configured to extract text sub-information from the text information based on the position of the variable placeholder in the first branch, and to obtain the third translated text of the text sub-information;

[0027] The display module is also used to render and display the character content concatenated from the second translated text and the third translated text.

[0028] In an optional design of this application, the processing module is further configured to:

[0029] The third text identifier is obtained by searching the text sub-information in the first mapping table, and the third translated text is obtained by searching the third text identifier in the second mapping table.

[0030] In an optional design of this application, the acquisition module is further configured to acquire at least two template text entries, each of the at least two template text entries including at least one variable placeholder and at least one text character, the variable placeholder being used to indicate the insertion position of the fill text;

[0031] The processing module is further configured to construct the trie by using the variable placeholders and text characters included in the at least two template text entries as candidate nodes;

[0032] Each template text entry includes at least one variable placeholder and at least one text character located on a candidate branch of the trie.

[0033] In an optional design of this application, the acquisition module is further configured to:

[0034] Retrieve the first mapping table and the second mapping table from the cache space;

[0035] Wherein, the difference between the historical lookup time of the key-value pair in the cache space and the current time does not exceed a time threshold, or the number of times the key-value pair in the cache space was looked up in the historical time period before the current time exceeds a number threshold.

[0036] In an optional design of this application, the processing module is further configured to:

[0037] The code file of the application is parsed to obtain a set of code nodes of the application.

[0038] In the set of code nodes, a first subset of nodes belonging to the character type is determined;

[0039] Obtain the strings of each node in the first node subset, and construct text identifiers and translated text for the strings;

[0040] Based on the string and the text identifier, construct the first mapping table;

[0041] Based on the text identifier and the translated text, the second mapping table is constructed.

[0042] In an optional design of this application, the acquisition module is further configured to:

[0043] Obtain the rendering information of the application;

[0044] If the rendered information differs from the historical rendered information at a historical moment, the text information in the rendered information is obtained.

[0045] In an alternative design of this application, the display module is further used for at least one of the following:

[0046] If the difference in display length between the first translated text and the text information exceeds a length threshold, a first prompt message is displayed, which is used to indicate that the display length of the translated language is abnormal.

[0047] If the display position of the first translated text exceeds the component size at its location, a second prompt message is displayed, which is used to indicate that the component size is abnormal;

[0048] If the font size difference between the first translated text and the text information exceeds a size threshold, a third prompt message is displayed, which is used to indicate that the font size of the translated language is abnormal.

[0049] If the alignment between the first translated text and the text information is different, a fourth prompt message is displayed, which is used to indicate that the alignment of the translated language is abnormal.

[0050] According to another aspect of this application, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the at least one instruction, the at least one program, the code set or instruction set being loaded and executed by the processor to implement the text information processing method as described above.

[0051] According to another aspect of this application, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, code set, or instruction set is stored therein, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the text information processing method described above.

[0052] According to another aspect of this application, a computer program product is provided, the computer program product including computer instructions stored in a computer-readable storage medium, wherein a processor reads from the computer-readable storage medium and executes the computer instructions to implement the text information processing method described above.

[0053] The beneficial effects of the technical solution provided in this application include at least the following:

[0054] By using the first and second mapping tables, the translated text of the text information can be found. By obtaining the first and second mapping tables, the translated text of the text information to be displayed can be obtained without changing the application's code file. This provides a fast way to display characters in the translated language for applications that do not support multilingual display. It can achieve the display of characters in the translated language without developers having to modify the application to meet specific specifications, and provides a low-cost language adaptation solution. Attached Figure Description

[0055] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0056] Figure 1 This is a schematic diagram of a computer system provided in an exemplary embodiment of this application;

[0057] Figure 2 This is a schematic diagram of a text information processing method provided in an exemplary embodiment of this application;

[0058] Figure 3 This is a flowchart of a text information processing method provided in an exemplary embodiment of this application;

[0059] Figure 4 This is a flowchart of a text information processing method provided in an exemplary embodiment of this application;

[0060] Figure 5 This is a flowchart of a text information processing method provided in an exemplary embodiment of this application;

[0061] Figure 6 This is a flowchart of a text information processing method provided in an exemplary embodiment of this application;

[0062] Figure 7 This is a schematic diagram of a trie provided in an exemplary embodiment of this application;

[0063] Figure 8 This is a flowchart of a text information processing method provided in an exemplary embodiment of this application;

[0064] Figure 9 This is a flowchart of a text information processing method provided in an exemplary embodiment of this application;

[0065] Figure 10 This is a flowchart of a text information processing method provided in an exemplary embodiment of this application;

[0066] Figure 11 This is a structural block diagram of a text information processing apparatus provided in an exemplary embodiment of this application;

[0067] Figure 12 This is a structural block diagram of a server provided in an exemplary embodiment of this application.

[0068] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. Detailed Implementation

[0069] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0070] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0071] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The singular forms “a,” “the,” and “the” as used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.

[0072] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the first and second text information mapping tables involved in this application were obtained with full authorization.

[0073] It should be understood that although the terms first, second, etc., may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, a first parameter may also be referred to as a second parameter without departing from the scope of this disclosure, and similarly, a second parameter may also be referred to as a first parameter. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0074] Figure 1 A schematic diagram of a computer system provided in one embodiment of this application is shown. This computer system can implement a system architecture for a text information processing method. The computer system may include: a terminal 100 and a server 200.

[0075] Terminal 100 can be an electronic device such as a mobile phone, tablet computer, or PC (Personal Computer). A client application for the target application can be installed and run on terminal 100. This target application is an application that provides text information processing functions. The type of application is not limited; it can be at least one of the following types: game application, office application, payment application, instant messaging application, etc. Furthermore, this application does not limit the form of the target application, including but not limited to apps (applications), mini-programs, etc., installed on terminal 100, and it can also be in web page form.

[0076] Server 200 can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services. Server 200 can be the backend server for the aforementioned target application, used to provide backend services to the clients of the target application.

[0077] The text information processing method provided in this application embodiment can be executed by a computer device, which refers to an electronic device with data computing, processing, and storage capabilities. Figure 1Taking the implementation environment of the scheme shown as an example, the text information processing method can be executed by the terminal 100 (such as the client of the target application installed and running in the terminal 100 executing the text information processing method), or by the server 200 executing the text information processing method, or by the terminal 100 and the server 200 interacting and cooperating to execute it. This application does not limit this.

[0078] Furthermore, the technical solution of this application can be combined with blockchain technology. For example, in the text information processing method disclosed in this application, some data involved (such as the first mapping table, the second mapping table, etc.) can be stored on the blockchain. The terminal 100 and the server 200 can communicate through a network, such as a wired or wireless network.

[0079] Figure 2 A schematic diagram of a text information processing method provided in an exemplary embodiment of this application is shown.

[0080] In one example, for the first text information 312, the text content of the first text information 312 is: Welcome back; the first text identifier 314 is found in the first mapping table 402 based on the first text information 312; the first text identifier 314 is: 9288ar. The first mapping table 402 includes multiple development language key-value pairs, which use the text content of the application's development language as the keyword and the text identifier as the data item.

[0081] The first translated text 316 is retrieved from the second mapping table 404 based on the first text identifier 314; the first translated text 316 is: welcome back. The character content of the first translated text 316 is rendered and displayed. The second mapping table 404 includes at least two translation language key-value pairs, where the translation language key-value pairs use the text identifier as the key and the text content of the translation language as the data item.

[0082] In another example, for the second text information 322, the text content is: Find a trapped rabbit within four steps. The search result for the second text information 322 in the first mapping table 402 is empty 324.

[0083] For example, the information in the first mapping table 402 is constructed based on the application's code (or code file). Since the text information that needs to be displayed in the application is diverse, the code will not exhaustively list all the text information that needs to be displayed; it can be recorded as template text. During the construction of the first mapping table, only template text exists: "Find [var3] which is trapped within [var1] steps"; the template text is different from the second text information 322, resulting in an empty search result for the second text information 322.

[0084] Get the trie 410, which is a tree-like data structure used to search for multiple text characters.

[0085] Trie 410 includes a first branch 411, a second branch 412, and a third branch 413; taking the first branch 411 as an example, the character content starting from the root node is the character content of the template text. Here, [var] is a variable placeholder reserved in the template text for filling text. The variable placeholder belongs to a separate node in trie 410 and can match one or more characters. For the node corresponding to a character, each node can correspond to one or more characters. Each branch of trie 410 has a corresponding text identifier.

[0086] Obtain the second text identifier 325 corresponding to the first branch 411 in the trie 410; the first branch 411 in the trie 410 matches the second text information 322. For example, if the variable placeholder matches one or more characters in the second text information 322, the character sequence on the first branch 411 is the same as the remaining characters in the second text information 322; for example, the character sequence on the first branch 411 is a subset of the second text information 322.

[0087] The second translated text 326 is found in the second mapping table 404 based on the second text identifier 325; the second translated text 326 is: Find[var2]trapped[var3]within[var1]steps.

[0088] Based on the position of the variable placeholder (e.g., [var]) in the first branch 411 of the trie 410, extract text sub-information 332 from the second text information 322, and obtain the third translated text 336 of the text sub-information 332; text sub-information 332 includes four, one, and rabbit; the third translated text 336 includes four, one, and rabbit. Concatenate the second translated text 326 and the third translated text 336 to obtain the concatenated text 328: Find one trapped rabbit within foursteps. Render and display the character content of the concatenated text 328.

[0089] The following examples will illustrate the text information processing method.

[0090] Figure 3 A flowchart illustrating a text information processing method provided in an exemplary embodiment of this application is shown. This method can be executed by a computer device. The method includes:

[0091] Step 510: Obtain text information, the first mapping table, and the second mapping table;

[0092] For example, the text information is used to indicate the character content that the application needs to render; for example, the text information can be information in the text format that needs to be rendered directly, or it can be obtained by text recognition from at least one of the information such as images and videos that need to be rendered. This embodiment does not limit this.

[0093] For example, the first mapping table is used to indicate the correspondence between text information and text identifiers in the development language; the second mapping table is used to indicate the correspondence between text information and text identifiers in the translation language.

[0094] Step 520: Obtain the first text identifier based on the text information in the first mapping table;

[0095] Regarding the first mapping table, the first mapping table includes at least two development language key-value pairs, where the development language key-value pairs use the text content of the application's development language as the key and the text identifier as the data item; that is, the first mapping table includes at least two development language key-value pairs where the text content of the application's development language is used as the key and the text identifier as the data item.

[0096] For example, searching for text information in the first mapping table yields a development language key-value pair with the same keyword as the text information. The data item of this development language key-value pair is the first text identifier.

[0097] For example, the first mapping table and the second mapping table are pre-built. The construction process of the first mapping table and the second mapping table will be described separately below.

[0098] Step 530: Find the first translated text in the second mapping table based on the first text identifier;

[0099] Regarding the second mapping table, the second mapping table includes at least two translation language key-value pairs, where the translation language key-value pairs use text identifiers as keywords and the text content of the translation language as data items; that is to say, the first mapping table includes at least two translation language key-value pairs using text identifiers as keywords and the text content of the translation language as data items.

[0100] For example, searching the second mapping table for the first text identifier yields a translation language key-value pair with the same keyword as the first text identifier. The data item of this translation language key-value pair is the first translated text.

[0101] For example, the translation language is different from the development language; the development language is the language used by the users in the application development process. For example, if the application is a game application, the game application is developed for users in a first region to perform virtual competitions; the development language of the game application is the language commonly used by users in the first region; the program code of the application includes character content in the development language, which is the character content that needs to be displayed.

[0102] Step 540: Render and display the character content of the first translated text;

[0103] For example, the character content of the first translated text is the character content displayed when the application displays text content in the translation language; in order to realize the conversion of text information in the development language into the first translated text display in the translation language.

[0104] In summary, the method provided in this embodiment achieves the lookup of translated text information through the first and second mapping tables. By obtaining the first and second mapping tables, the translated text of the text information to be displayed can be obtained without changing the application's code file. This provides a fast way to display characters in translated languages ​​for applications that do not support multilingual display, without requiring developers to modify the application to specific specifications, thus providing a low-cost language adaptation solution.

[0105] Figure 4 A flowchart illustrating a text information processing method provided in an exemplary embodiment of this application is shown. This method can be executed by a computer device. That is, in Figure 3 In the illustrated embodiment, step 520 can be implemented as steps 522 and 524:

[0106] Step 522: Based on the text information, retrieve the first development language key-value pair from the first mapping table;

[0107] For example, searching for text information in the first mapping table yields key-value pairs in the first development language whose keywords match the text information. For example, the text information includes keywords from the key-value pairs in the first development language.

[0108] For example, the data item of the first development language key-value pair includes at least two candidate text identifiers; different candidate text identifiers correspond to different translated texts in the second mapping table, and the different translated texts are different translations of the same information (such as text information) in different contexts.

[0109] In one optional design of this application, the application is a game application based on a Web Graphics Library (WebGL); the search for the first text identifier and the second text identifier in this application is implemented using a program written in C / C++. For example, a WebAssembly (WASM) script is run in JavaScript, where JavaScript loads language pack data from a local or network source and assigns it to the WASM script as a data retrieval dictionary. JavaScript queries the WASM script, and the WASM script provides the translation results for the entries.

[0110] Step 524: Determine the first text identifier from at least two candidate text identifiers;

[0111] As described above, at least two candidate text identifiers correspond to different translation methods of the text information. In one example, the first text identifier is determined randomly from at least two candidate text identifiers; for example, at least two candidate text identifiers correspond to text with the same semantics but different character content in the translated language. Taking a virtual character's dialogue text in an application as an example, determining the first text identifier randomly enables the translation of text information at different times, displaying different character content while maintaining the same semantics. This approximates the randomness of spoken dialogue and avoids the problem of completely identical translated virtual character dialogue text displayed at different times, resulting in rigid interaction with the virtual character. In another example, the first text identifier can also be determined based on the associated information of the text information; this application does not impose any restrictions on this.

[0112] In one alternative implementation, this step can be implemented as follows:

[0113] • Obtain the associated information of the text information;

[0114] For example, the associated information is used to indicate at least one of the following: the context information of the text information, the display interface where the text information is located, the display position of the text information in the display interface, and the display font of the text information in the display interface.

[0115] • Based on the association information, determine the first text identifier from at least two candidate text identifiers;

[0116] For example, the data item of the first development language key-value pair includes candidate association information corresponding to at least two candidate text identifiers; the candidate association information corresponding to the first text identifier is the same as the obtained association information.

[0117] For example, the correspondence between candidate association information and candidate text identifiers is recorded as key-value pairs in the data items of the first development language key-value pair. For example, the candidate association information is used as the keyword and the candidate text identifier is used as the data item to construct the association key-value pair. The data item of the first development language key-value pair includes at least two association key-value pairs, where the association information is the same as the keyword of the first association key-value pair, and the first text identifier is the data item of the first association key-value pair.

[0118] For example, the relevant information is contextual information; taking the translation language as English as an example.

[0119] If the preceding text information is empty or contains a period, the text information is the text information at the beginning of the sentence. The first text identifier is determined based on the associated information. The first translated text that the first text identifier looks up in the second mapping table is a text character with the first letter capitalized.

[0120] When the preceding text information is a text character, the text information is the sentence text information in the sentence. The first text identifier is determined based on the association information. The first translated text that the first text identifier looks up in the second mapping table is a lowercase text character.

[0121] For example, regarding the display interface where the associated information is text information, let's take English as an example;

[0122] When the text information is displayed on the home screen of the application, the text content on the home screen is the title content of the application. The first text identifier is determined based on the associated information. The first translated text found in the second mapping table by the first text identifier is a text character in uppercase format, in order to match the need for uppercase characters in the title content for highlighting.

[0123] When the display interface containing the text information is a sub-interface that is displayed after being redirected from the homepage interface, the text content in the sub-interface is the application's introductory text. The first text identifier is determined based on the associated information. The first translated text that is looked up in the second mapping table by the first text identifier is a text character that is not in full uppercase format, in order to match the display requirements of the introductory text to be easy to read.

[0124] For example, consider the font used to display text information related to the association.

[0125] When the text information is displayed in a rounded or cartoon font, the text information is language text for a child's age role. The first text identifier is determined based on the associated information. The first translated text found in the second mapping table contains interjections for the child's age role.

[0126] When the text information is displayed in handwritten font, the text information is the character's handwritten text. The first text identifier is determined based on the associated information. The first translated text found in the second mapping table by the first text identifier conforms to the written expression of a letter format.

[0127] In summary, the method provided in this embodiment achieves the lookup of translated text information through the first and second mapping tables. By obtaining the first and second mapping tables, the translated text information to be displayed can be obtained without changing the application's code file. The data items of the first development language key-value pair include at least two candidate text identifiers, which can adapt to scenarios where different translation methods are used for the same text. It provides a fast way to display characters in the translated language for applications that do not support multilingual display. It can achieve the display of characters in the translated language without developers having to modify the application to meet specific specifications, and provides a low-cost language adaptation solution.

[0128] Figure 5 A flowchart illustrating a text information processing method provided in an exemplary embodiment of this application is shown. This method can be executed by a computer device. That is, in Figure 3 Based on the illustrated embodiment, steps 552 to 560 are also included:

[0129] Step 552: If the search result for text information in the first mapping table is empty, obtain the trie;

[0130] For example, if the search result for text information in the first mapping table is empty, it means that the first text content does not exist in the first mapping table. In one example, the reason why the search result for text information in the first mapping table is empty is that the text information is a combination of template text and filler text.

[0131] For example, the information in the first mapping table is constructed based on the application's code (or code file). Since the text information that needs to be displayed in the application is diverse, the code will not exhaustively list all the text information that needs to be displayed; it can be recorded in the form of template text. For example, in the application's check-in function, the information displayed when the user completes the first day's check-in is: "Congratulations, you have completed the first day's check-in this month"; the information displayed when the user completes the second day's check-in is: "Congratulations, you have completed the second day's check-in this month". It can be seen that the above text information has common parts, as well as content that changes over time or with the user's human-computer interaction. The code uses template text to indicate the position of the fixed text that needs to be always displayed and the position of the fill text that needs to change, for example: "Congratulations, you have completed the % day's check-in this month", where "[var]" is a variable placeholder for the fill text, indicating the position of the fill text.

[0132] For example, during the construction of the first mapping table, only template text exists, such as "Congratulations, you have completed the check-in for the [var]th day of this month," but the actual "Congratulations, you have completed the check-in for the first day of this month" displayed when the user uses the application does not exist, resulting in the search results for text information in the first mapping table being empty.

[0133] For example, a trie is a tree-like data structure used to look up multiple text characters; each branch in the trie corresponds to a text identifier. The process of determining the text identifier will be described in detail below.

[0134] Step 554: Obtain the second text identifier corresponding to the first branch in the trie;

[0135] For example, candidate nodes in the trie correspond to variable placeholders or text characters; variable placeholders can match one or more characters in the text information. For example, the variable placeholders in the first branch are matched against one or more characters in the text information, and the character sequence on the first branch matches the remaining characters in the text information; for example, the character sequence on the first branch is a subset of the text information.

[0136] For example, each branch in the trie has a corresponding text identifier, and the text identifier corresponding to the first branch found in the trie based on the text information is the second text identifier.

[0137] Step 556: Find the second translated text in the second mapping table based on the second text identifier;

[0138] For example, the second mapping table includes at least two translation language key-value pairs, where the translation language key-value pairs use text identifiers as keywords and the text content of the translation language as data items.

[0139] For example, searching for the second text identifier in the second mapping table yields a translation language key-value pair with the same keyword as the second text identifier. The data item of this translation language key-value pair is the second translated text.

[0140] Step 558: Based on the position of the variable placeholder in the first branch, extract the text sub-information from the text information, and obtain the third translated text of the text sub-information;

[0141] For example, a variable placeholder matches one or more characters in the text information, and the position of the variable placeholder in the first branch is the padding position of the text information. For example, extracting a sub-text from the text information is the one or more characters matched by the variable placeholder.

[0142] For example, the third translated text is information that translates textual sub-information into the target language. For example, the third translated text can be obtained through real-time translation or through pre-translation.

[0143] In one alternative implementation, the third-party translated text is obtained as follows:

[0144] • The third text identifier is obtained by searching the text sub-information in the first mapping table, and the third translated text is obtained by searching the third text identifier in the second mapping table.

[0145] For example, searching the text sub-information in the first mapping table yields a development language key-value pair whose keyword matches the text sub-information. The data item of this development language key-value pair is the third text identifier. Searching the third text identifier in the second mapping table yields a translation language key-value pair whose keyword matches the third text identifier. The data item of this translation language key-value pair is the third translated text.

[0146] Step 560: Render and display the character content concatenated from the second and third translated texts;

[0147] For example, the character content concatenated from the second and third translated texts is the character content displayed when the application displays text content in the translated language; this achieves the conversion of text information in the development language into character content for display in the translated language.

[0148] For example, the third translated text is inserted into the second translated text to obtain the displayed content of the text information in the target language. In the second translated text, there are variable placeholders to indicate the position where the translated text is inserted. The third translated text is then inserted into the position of the variable placeholders to obtain the displayed content of the text information in the target language.

[0149] In summary, the method provided in this embodiment, by obtaining a trie, enables the confirmation and display of the translated text of text information when the search result for text information in the first mapping table is empty; it can adapt to scenarios where the text information to be displayed in an application is diverse, and the code program does not exhaustively list all the text information to be displayed, but records it in the form of template text; it provides a fast way to display characters in a translated language for applications that do not support multilingual display, without requiring developers to modify the application to specific specifications, and provides a low-cost language adaptation solution.

[0150] Next, the process of constructing a trie will be introduced. Figure 5 Based on the illustrated embodiments, it is possible to and Figure 6 The steps shown are combined to form a new embodiment. Figure 6A flowchart illustrating a text information processing method provided in an exemplary embodiment of this application is shown. The method includes:

[0151] Step 505a: Obtain at least two template text entries;

[0152] For example, template text entries are a method of recording text because the text information that needs to be displayed in an application is diverse, and the code program will not exhaustively list all the text information that needs to be displayed. In one example, a template text entry corresponds to the template string node (TemplateLiteral) in the application's code file.

[0153] Each of the at least two template text entries includes at least one variable placeholder and at least one text character, the variable placeholder being used to indicate the insertion position of the fill text;

[0154] Step 505b: Construct a trie by using the variable placeholders and text characters included in at least two template text entries as candidate nodes;

[0155] For example, the root node of the trie corresponds to the starting position of the template text entry, and at least one first-level child node directly connected to the root node corresponds to one or more characters in the first sentence of the template text entry. For example, if one or more characters in the first sentence of the first and second template text entries are the same, they correspond to the same first-level child node in the trie; if one or more characters in the first sentence of the third and fourth template text entries are different, they correspond to two different first-level child nodes in the trie. Child nodes are connected to the lower level of the first-level child node according to the character order in the template text entry until the end of the template text entry. The leaf nodes of the trie correspond to the ending position of the template text entry.

[0156] For example, starting from the root node of the trie and following the connection order between candidate nodes to the leaf node at the end of the trie, the sequence of variable placeholders and text characters corresponding to each candidate node constitutes a template text term. For example, each template text term includes at least one variable placeholder and at least one text character located on a candidate branch of the trie.

[0157] Figure 7 A schematic diagram of a trie provided in an exemplary embodiment of this application is shown. Trie 410 is a tree-like data structure used to look up multiple text characters. Trie 410 includes a first branch 411, a second branch 412, and a third branch 413.

[0158] The template text for the first branch 411 is: Find [var3] which is trapped within [var2] steps; the template text for the second branch 412 is: Congratulations on checking in on [var1] day; the template text for the third branch 413 is: Congratulations on passing the level of [var1] progress.

[0159] Since the template text entries corresponding to the second branch 412 and the third branch 413 have the same character content at the beginning of the sentence, namely "Congratulations", there is a shared node 412a between the second branch 412 and the third branch 413 in the trie 410.

[0160] In summary, the method provided in this embodiment offers a scheme for constructing the number of fields based on template text entries, determining the variable placeholders in the template text entries as independent nodes in the trie; by obtaining the trie, it achieves the confirmation and display of the translated text of the text information when the search result for the text information in the first mapping table is empty; it can adapt to scenarios where the text information to be displayed in the application is diverse, and the code program does not exhaustively list all the text information to be displayed, but records it in the form of template text; it provides a fast way to display characters in the translated language for applications that do not support multilingual display, without requiring developers to modify the application to specific specifications, and provides a low-cost language adaptation solution.

[0161] Next, the text information, the first mapping table, and the second mapping table in step 510 will be further described below.

[0162] Figure 8 A flowchart illustrating a text information processing method provided in an exemplary embodiment of this application is shown. This method can be executed by a computer device. That is, in Figure 3 In the illustrated embodiment, step 510 can be implemented as steps 512, 514, and 516:

[0163] Step 512: Obtain the application's rendering information;

[0164] For example, rendering information is information to be processed obtained by the rendering component of the computer device running the application (such as the game engine of a game application), or information processed by the rendering component.

[0165] For example, rendering information can be obtained by adding proxies or calling hook functions. Taking a game application developed using the Cocos Creator engine as an example, the game engine provides a Label component to display text characters. For instance, the Label component uses proxies or object definition properties (Object.defineProperty) to capture the rendered text content, i.e., obtain rendering information. The Unity game engine provides a Text component, which captures the rendered text content through lifecycle callbacks, i.e., obtains rendering information.

[0166] Step 514: If the rendered information differs from the historical rendered information at a historical moment, obtain the text information in the rendered information;

[0167] For example, if the rendered information differs from the historical rendered information at a given time, the text to be displayed in the application may change. For example, when the rendered information is modified or processed by the rendering component, the text information within the rendered information is retrieved; this text information represents the text characters that need to be translated when the application's display changes.

[0168] Step 516: Obtain the first mapping table and the second mapping table from the cache space;

[0169] For example, cache space is a storage space that stores cache information in a cache replacement manner, such as Least Recently Used (LRU) cache, so that when the cache space is insufficient, the least recently used data in the cache space is replaced with new data to be cached.

[0170] For example, as described above, the first mapping table includes at least two key-value pairs for the development language; the second mapping table includes at least two key-value pairs for the translation language. The difference between the historical lookup time and the current time of a key-value pair retrieved from the cache space does not exceed a time threshold, or the number of times a key-value pair in the cache space has been looked up in the historical time period prior to the current time exceeds a frequency threshold. This ensures that the first and second mapping tables stored in the cache space include recently used and / or frequently used key-value pairs.

[0171] In one example, the text information is obtained according to the methods described in steps 512 and 514, while the methods for obtaining the first mapping table and the second mapping table are not limited; in another example, the first mapping table and the second mapping table are obtained according to the method described in step 516, while the method for obtaining the text information is not limited. It should be noted that this application does not restrict the timing of obtaining any two of the text information, the first mapping table, and the second mapping table.

[0172] In summary, the method provided in this embodiment ensures that text information is obtained even when the rendered information differs from the historical rendered information at a given time, thus guaranteeing the translation of the text information into the target language. Furthermore, by obtaining the first and second mapping tables from the cache space, the efficiency of obtaining the first and second mapping tables is improved, reducing the time required to translate the text information and preventing display stuttering in the application. This method provides a fast way to display characters in the target language for applications that do not support multilingual display, eliminating the need for developers to modify the application to specific specifications, and offering a low-cost language adaptation solution.

[0173] Next, the construction process of the first and second mapping tables will be introduced. Figure 3 Based on the illustrated embodiments, it is possible to and Figure 9 The steps shown are combined to form a new embodiment. Figure 9 A flowchart illustrating a text information processing method provided in an exemplary embodiment of this application is shown. The method includes:

[0174] Step 502a: Parse the application's code file to obtain the application's code node set;

[0175] For example, the application's code files are built by developers to implement the application's functions, such as implementing virtual competition functions in a game application or social functions in an instant messaging software.

[0176] A code node set includes at least two code nodes. A code node is at least one of the variables, code operations, code control structures, etc., in a code file. For example, a code node is a node in an Abstract Syntax Tree (AST). An AST is an abstract representation of a code file, representing the syntactic structure of a programming language in a tree-like format.

[0177] In one example, the file is parsed into an ESTree structure using the ESTree tool. For example, the esprima library can be used to parse javascript (.js) code files, and @typescript-eslint / typescript-estree can be used to parse typescript (.ts) code files.

[0178] Step 502b: In the set of code nodes, determine the first subset of nodes that belong to the character type;

[0179] For example, the first subset of nodes includes the text characters that need to be displayed in the application; for example, the first subset of nodes is obtained by searching within the set of code nodes.

[0180] For example, recursively traversing all nodes in the code file ESTree, the first subset of nodes includes the following three types of nodes: literal nodes, binary expression nodes, and template string nodes.

[0181] Step 502c: Obtain the strings of each node in the first node subset, and construct text identifiers and translated text for the strings;

[0182] For example, for literal nodes, the text information within the node is collected directly. For binary expression nodes, the strings joined by the nodes are collected, with the non-string parts of the joins replaced by variable placeholders, and the variable positions are recorded. For template string nodes, the text information within the node is collected, along with the variable parts replaced by placeholders, and the variable positions are recorded.

[0183] For example, the collected text information is filtered using regular expressions to determine if it belongs to the development language, thus obtaining the strings of each node in the first node subset. For example, the text identifier of the string is the result of a hash algorithm calculated from the string input, such as processing the string using the Message Digest Algorithm 5 (MD5). For example, the translated text is the translation result of the strings of each node from the development language to the target language.

[0184] Step 502d: Construct the first mapping table based on the string and text identifier;

[0185] Regarding the first mapping table, the first mapping table includes at least two development language key-value pairs, where the development language key-value pairs use the text content of the application's development language as the key and the text identifier as the data item; that is, the first mapping table includes at least two development language key-value pairs where the text content of the application's development language is used as the key and the text identifier as the data item.

[0186] Step 502e: Construct a second mapping table based on the text identifier and the translated text;

[0187] Regarding the second mapping table, the second mapping table includes at least two translation language key-value pairs, where the translation language key-value pairs use text identifiers as keywords and the text content of the translation language as data items; that is to say, the first mapping table includes at least two translation language key-value pairs using text identifiers as keywords and the text content of the translation language as data items.

[0188] In summary, the method provided in this embodiment achieves the lookup of translated text information through the first and second mapping tables. By obtaining the first and second mapping tables, the translated text of the text information to be displayed can be obtained without changing the application's code file. This provides a fast way to display characters in translated languages ​​for applications that do not support multilingual display, without requiring developers to modify the application to specific specifications, thus providing a low-cost language adaptation solution.

[0189] Figure 10 A flowchart illustrating a text information processing method provided in an exemplary embodiment of this application is shown. This method can be executed by a computer device. That is, in Figure 3 Based on the illustrated embodiment, at least one of steps 565a, 565b, 565c, and 565d is also included:

[0190] Step 565a: If the difference in display length between the first translated text and the text information exceeds the length threshold, display the first prompt message;

[0191] For example, the first prompt message is used to indicate an abnormal display length in the translated language; when the difference in display length between the first translated text and the text information exceeds a length threshold, the difference in text display length is caused by the difference between the translated language and the development language. By displaying the first prompt message, the application developers are notified of the text display length difference during the application's development or testing phase, prompting them to determine whether the layout of the application's display interface needs to be adjusted.

[0192] Step 565b: If the display position of the first translated text exceeds the size of the component at that position, display the second prompt message;

[0193] For example, the second prompt message is used to indicate an abnormal component size; when the display position of the first translated text exceeds the component size at its location, due to differences between the translation language and the development language, the first translated text in the translation language may contain too many characters, causing the text to display beyond the component size. By displaying the second prompt message, the application developers are alerted to the component size discrepancy during the application's development or testing phase, prompting them to adjust the component size.

[0194] Step 565c: If the font size difference between the first translated text and the text information exceeds the size threshold, display a third prompt message;

[0195] For example, the third prompt message is used to indicate an abnormal font size in the translated language; when the font size difference between the first translated text and the text information exceeds a size threshold, since the first translated text is translated from the text information, the font used in the rendering process differs from the original font of the text information. By displaying the third prompt message, the application developers are alerted to the component font difference during the application development or testing phase, prompting them to adjust the rendering process of the first translated text.

[0196] Step 565d: If the alignment between the first translated text and the text information is different, display the fourth prompt message;

[0197] For example, the fourth prompt message is used to indicate an alignment error in the translated language. When the alignment of the first translated text and the original text information differs, since the first translated text is translated from the original text information, the font alignment during rendering differs from the original text information. By displaying the fourth prompt message, developers are alerted during application development or testing to the discrepancy in component alignment, prompting them to adjust the rendering process of the first translated text.

[0198] In summary, the method provided in this embodiment displays a prompt message when the display of the first translated text is abnormal, prompting developers to adjust the text rendering process or the size of application components during the application development or testing phase. This provides a fast way to display characters in translated languages ​​for applications that do not support multilingual display, without requiring developers to modify the application to specific specifications, thus providing a low-cost language adaptation solution.

[0199] In one application scenario of this application, the application is a game application that provides a virtual environment. The text information is the descriptive text provided by the game application about the virtual environment, such as text information on virtual items within the virtual environment; text information in the game application's settings interface, team interface, preparation interface, etc.; this application does not restrict the display position of the descriptive text within the game application. Correspondingly:

[0200] • Obtain the introductory text, the first mapping table, and the second mapping table;

[0201] For example, the introductory text is used to indicate the character content that the game application needs to render; for example, the first mapping table is used to indicate the correspondence between the introductory text and text identifiers in the development language; the second mapping table is used to indicate the correspondence between the introductory text and text identifiers in the translation language.

[0202] Optionally, this step can be implemented as follows:

[0203] Retrieve the first and second mapping tables from the cache space;

[0204] Specifically, the difference between the historical lookup time and the current time of the key-value pair in the cache space does not exceed the time threshold, or the number of times the key-value pair in the cache space was looked up in the historical time period before the current time exceeds the number of times threshold.

[0205] Optionally, this step can be implemented as follows:

[0206] Obtain rendering information from the game application;

[0207] When the rendered information differs from the historical rendered information at a given time, retrieve the introductory text from the rendered information.

[0208] Optionally, the construction of the first mapping table and the second mapping table also includes:

[0209] The code files of the game application are parsed to obtain a set of code nodes for the game application.

[0210] In the set of code nodes, identify the first subset of nodes that belong to the character type;

[0211] Retrieve the strings of each node in the first node subset, and construct text identifiers and translated text for the strings;

[0212] Construct the first mapping table based on string and text identifiers;

[0213] A second mapping table is constructed based on the text identifier and the translated text.

[0214] • The first text identifier is obtained by searching the introductory text in the first mapping table;

[0215] Regarding the first mapping table, the first mapping table includes at least two development language key-value pairs, where the development language key-value pairs use the text content of the game application's development language as the key and the text identifier as the data item; that is, the first mapping table includes at least two development language key-value pairs where the text content of the game application's development language is used as the key and the text identifier as the data item.

[0216] Optionally, this step can be implemented as follows:

[0217] The first development language key-value pair is obtained from the first mapping table based on the introductory text. The introductory text includes the keyword of the first development language key-value pair, and the data item of the first development language key-value pair includes at least two candidate text identifiers.

[0218] The first text identifier is determined from at least two candidate text identifiers.

[0219] Furthermore, obtain the associated information of the introductory text;

[0220] Based on the association information, the first text identifier is determined from at least two candidate text identifiers, and the data item of the first development language key-value pair includes the candidate association information corresponding to the at least two candidate text identifiers respectively;

[0221] The associated information is used to indicate at least one of the following: the context information of the descriptive text, the display interface in which the descriptive text is located, and the display font of the descriptive text in the display interface.

[0222] • The first translated text is obtained by searching the second mapping table based on the first text identifier;

[0223] Regarding the second mapping table, it includes at least two translation language key-value pairs, where each pair uses a text identifier as the key and the text content of the translation language as the data item. In other words, the first mapping table includes at least two translation language key-value pairs where the text identifier is the key and the text content of the translation language is the data item. For example, the translation language is different from the development language.

[0224] • Render and display the character content of the first translated text;

[0225] For example, the character content of the first translated text is the character content displayed when the game application displays text content in the translated language; in order to realize the conversion of the introductory text in the development language into the first translated text in the translated language for display.

[0226] In one alternative implementation, it also includes:

[0227] If the search result for the introductory text in the first mapping table is empty, obtain the trie, which is a tree-like data structure used to search for multiple text characters;

[0228] Get the second text identifier corresponding to the first branch in the trie. The character sequence on the first branch is a subset of the descriptive text.

[0229] The second translated text is obtained by searching the second text identifier in the second mapping table.

[0230] Based on the position of the variable placeholder in the first branch, extract text sub-information from the introductory text, and obtain the third translated text of the text sub-information;

[0231] Render and display the character content concatenated from the second and third translated texts.

[0232] In one alternative implementation, the third text identifier is obtained by searching for text sub-information in the first mapping table, and the third translated text is obtained by searching for the third text identifier in the second mapping table.

[0233] In one alternative implementation, it also includes:

[0234] Obtain at least two template text entries, each of which includes at least one variable placeholder and at least one text character, the variable placeholder being used to indicate the insertion position of the fill text;

[0235] A trie is constructed by using at least two template text entries, including variable placeholders and text characters, as candidate nodes.

[0236] Each template text entry includes at least one variable placeholder and at least one text character located on a candidate branch of the trie.

[0237] One alternative implementation also includes at least one of the following:

[0238] If the difference in display length between the first translated text and the introductory text exceeds a length threshold, a first prompt message will be displayed to indicate an abnormal display length in the translated language.

[0239] If the display position of the first translated text exceeds the component size at its location, a second prompt message is displayed to indicate that the component size is abnormal.

[0240] If the font size difference between the first translated text and the introductory text exceeds the size threshold, a third prompt message will be displayed. The third prompt message is used to indicate that the font size of the translated language is abnormal.

[0241] If the alignment of the first translated text and the introductory text is different, a fourth prompt message is displayed to indicate an alignment error in the translated language.

[0242] Those skilled in the art will understand that the above embodiments can be implemented independently, or the above embodiments can be freely combined to create new embodiments to implement the text information processing method of this application.

[0243] Figure 11 A structural block diagram of a text information processing apparatus provided in an exemplary embodiment of this application is shown. The apparatus includes:

[0244] The acquisition module 810 is used to acquire text information, a first mapping table, and a second mapping table, wherein the text information is used to indicate the character content that the application needs to render;

[0245] Processing module 820 is used to search for a first text identifier in the first mapping table based on the text information. The first mapping table includes at least two key-value pairs in the development language of the application, with the text content in the development language of the application as the keyword and the text identifier as the data item.

[0246] The processing module 820 is further configured to find the first translated text in the second mapping table based on the first text identifier. The second mapping table includes at least two translation language key-value pairs with the text identifier as the keyword and the text content of the translation language as the data item. The translation language is different from the development language.

[0247] Display module 830 is used to render and display the character content of the first translated text.

[0248] In an optional implementation of this embodiment, the processing module 820 is further configured to:

[0249] Based on the text information, the first development language key-value pair in the first mapping table is obtained. The text information includes the keyword of the first development language key-value pair, and the data item of the first development language key-value pair includes at least two candidate text identifiers.

[0250] The first text identifier is determined from the at least two candidate text identifiers.

[0251] In an optional implementation of this embodiment, the processing module 820 is further configured to:

[0252] Obtain the associated information of the text information;

[0253] Based on the association information, the first text identifier is determined from the at least two candidate text identifiers, and the data item of the first development language key-value pair includes the candidate association information corresponding to the at least two candidate text identifiers respectively;

[0254] The associated information is used to indicate at least one of the following: the context information of the text information, the display interface where the text information is located, and the display font of the text information in the display interface.

[0255] In an optional implementation of this embodiment, the acquisition module 810 is further configured to acquire a trie when the search result for the text information in the first mapping table is empty. The trie is a tree-like data structure used to search for multiple text characters.

[0256] The processing module 820 is further configured to obtain the second text identifier corresponding to the first branch in the trie, wherein the character sequence on the first branch is a subset of the text information;

[0257] The processing module 820 is further configured to search for the second translated text in the second mapping table based on the second text identifier;

[0258] The processing module 820 is further configured to extract text sub-information from the text information based on the position of the variable placeholder in the first branch in the first branch, and to obtain the third translated text of the text sub-information;

[0259] The display module 830 is also used to render and display the character content concatenated from the second translated text and the third translated text.

[0260] In an optional implementation of this embodiment, the processing module 820 is further configured to:

[0261] The third text identifier is obtained by searching the text sub-information in the first mapping table, and the third translated text is obtained by searching the third text identifier in the second mapping table.

[0262] In an optional implementation of this embodiment, the acquisition module 810 is further configured to acquire at least two template text entries, each of the at least two template text entries including at least one variable placeholder and at least one text character, wherein the variable placeholder is used to indicate the insertion position of the fill text;

[0263] The processing module 820 is further configured to construct the trie by using the variable placeholders and text characters included in the at least two template text entries as candidate nodes;

[0264] Each template text entry includes at least one variable placeholder and at least one text character located on a candidate branch of the trie.

[0265] In an optional implementation of this embodiment, the acquisition module 810 is further configured to:

[0266] Retrieve the first mapping table and the second mapping table from the cache space;

[0267] Wherein, the difference between the historical lookup time of the key-value pair in the cache space and the current time does not exceed a time threshold, or the number of times the key-value pair in the cache space was looked up in the historical time period before the current time exceeds a number threshold.

[0268] In an optional implementation of this embodiment, the processing module 820 is further configured to:

[0269] The code file of the application is parsed to obtain a set of code nodes for the application.

[0270] In the set of code nodes, a first subset of nodes belonging to the character type is determined;

[0271] Obtain the strings of each node in the first node subset, and construct text identifiers and translated text for the strings;

[0272] Based on the string and the text identifier, construct the first mapping table;

[0273] Based on the text identifier and the translated text, the second mapping table is constructed.

[0274] In an optional implementation of this embodiment, the acquisition module 810 is further configured to:

[0275] Obtain the rendering information of the application;

[0276] If the rendered information differs from the historical rendered information at a historical moment, the text information in the rendered information is obtained.

[0277] In an optional implementation of this embodiment, the display module 830 is further configured to perform at least one of the following:

[0278] If the difference in display length between the first translated text and the text information exceeds a length threshold, a first prompt message is displayed, which is used to indicate that the display length of the translated language is abnormal.

[0279] If the display position of the first translated text exceeds the component size at its location, a second prompt message is displayed, which is used to indicate that the component size is abnormal;

[0280] If the font size difference between the first translated text and the text information exceeds a size threshold, a third prompt message is displayed, which is used to indicate that the font size of the translated language is abnormal.

[0281] If the alignment between the first translated text and the text information is different, a fourth prompt message is displayed, which is used to indicate that the alignment of the translated language is abnormal.

[0282] It should be noted that the device provided in the above embodiments is only illustrated by the division of the above functional modules when implementing its functions. In actual applications, the above functions can be assigned to different functional modules according to actual needs, that is, the content structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0283] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments of the relevant method; the technical effects achieved by each module performing its operation are the same as the technical effects in the embodiments of the relevant method, and will not be elaborated here.

[0284] This application also provides a computer device, which includes a processor and a memory, wherein the memory stores a computer program; the processor is used to execute the computer program in the memory to implement the text information processing method provided in the above method embodiments.

[0285] Alternatively, the computer device is a server. For example, Figure 12 This is a structural block diagram of a server provided in an exemplary embodiment of this application.

[0286] Typically, server 2300 includes a processor 2301 and memory 2302.

[0287] Processor 2301 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 2301 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). Processor 2301 may also include a main processor and a coprocessor. The main processor, also known as a central processing unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 2301 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 2301 may also include an Artificial Intelligence (AI) processor, which is used to handle computational operations related to machine learning.

[0288] The memory 2302 may include one or more computer-readable storage media, which may be non-transitory. The memory 2302 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 2302 is used to store at least one instruction, which is executed by the processor 2301 to implement the text information processing method provided in the method embodiments of this application.

[0289] In some embodiments, the server 2300 may optionally include an input interface 2303 and an output interface 2304. The processor 2301, memory 2302, and input interfaces 2303 and 2304 can be connected via a bus or signal lines. Various peripheral devices can be connected to the input interfaces 2303 and 2304 via a bus, signal lines, or a circuit board. The input interfaces 2303 and 2304 can be used to connect at least one input / output (I / O) related peripheral device to the processor 2301 and memory 2302. In some embodiments, the processor 2301, memory 2302, and input interfaces 2303 and 2304 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 2301, memory 2302, and input interfaces 2303 and 2304 can be implemented on separate chips or circuit boards, and this application embodiment does not limit this.

[0290] Those skilled in the art will understand that the structure shown above does not constitute a limitation on server 2300, and may include more or fewer components than shown, or combine certain components, or employ different component arrangements.

[0291] In an exemplary embodiment, a chip is also provided, the chip including programmable logic circuitry and / or program instructions, which, when the chip is run on a computer device, are used to implement the text information processing method described above.

[0292] In an exemplary embodiment, a computer program product is also provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions to implement the text information processing methods provided in the above-described method embodiments.

[0293] In an exemplary embodiment, a computer-readable storage medium is also provided, which stores a computer program that is loaded and executed by a processor to implement the text information processing method provided in the above-described method embodiments.

[0294] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0295] Those skilled in the art will recognize that the functions described in the embodiments of this application in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transfer of a computer program from one place to another. Storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0296] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method for processing text information, characterized in that, The method is performed by a computer device, and the method includes: Obtain text information, a first mapping table, and a second mapping table, wherein the text information is used to indicate the character content that the application needs to render; The first text identifier is obtained by searching the first mapping table based on the text information. The first mapping table includes at least two key-value pairs in the development language of the application, with the text content in the development language of the application as the keyword and the text identifier as the data item. The first translated text is found in the second mapping table based on the first text identifier. The second mapping table includes at least two key-value pairs in the translation language, with the text identifier as the keyword and the text content in the translation language as the data item. The translation language is different from the development language. Render and display the character content of the first translated text.

2. The method according to claim 1, characterized in that, The step of finding the first text identifier in the first mapping table based on the text information includes: Based on the text information, the first development language key-value pair in the first mapping table is obtained. The text information includes the keyword of the first development language key-value pair, and the data item of the first development language key-value pair includes at least two candidate text identifiers. The first text identifier is determined from the at least two candidate text identifiers.

3. The method according to claim 2, characterized in that, Determining the first text identifier from the at least two candidate text identifiers includes: Obtain the associated information of the text information; Based on the association information, the first text identifier is determined from the at least two candidate text identifiers, and the data item of the first development language key-value pair includes the candidate association information corresponding to the at least two candidate text identifiers respectively; The associated information is used to indicate at least one of the following: the context information of the text information, the display interface where the text information is located, and the display font of the text information in the display interface.

4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: If the search result for the text information in the first mapping table is empty, a trie is obtained. The trie is a tree-like data structure used to search for multiple text characters. Obtain the second text identifier corresponding to the first branch in the trie, where the character sequence on the first branch is a subset of the text information; The second translated text is obtained by searching the second mapping table based on the second text identifier; Based on the position of the variable placeholder in the first branch, extract text sub-information from the text information, and obtain the third translated text of the text sub-information; Render and display the character content concatenated from the second and third translated texts.

5. The method according to claim 4, characterized in that, The third translated text for obtaining the text sub-information includes: The third text identifier is obtained by searching the text sub-information in the first mapping table, and the third translated text is obtained by searching the third text identifier in the second mapping table.

6. The method according to claim 4, characterized in that, The method further includes: Obtain at least two template text entries, each of the at least two template text entries including at least one variable placeholder and at least one text character, the variable placeholder being used to indicate the insertion position of the fill text; The trie is constructed by using the variable placeholders and text characters included in the at least two template text entries as candidate nodes; Each template text entry includes at least one variable placeholder and at least one text character located on a candidate branch of the trie.

7. The method according to any one of claims 1 to 3, characterized in that, The process of obtaining the first mapping table and the second mapping table includes: Retrieve the first mapping table and the second mapping table from the cache space; Wherein, the difference between the historical lookup time of the key-value pair in the cache space and the current time does not exceed a time threshold, or the number of times the key-value pair in the cache space was looked up in the historical time period before the current time exceeds a number threshold.

8. The method according to any one of claims 1 to 3, characterized in that, The method further includes: The code file of the application is parsed to obtain a set of code nodes for the application. Within the set of code nodes, a first subset of nodes belonging to the character type is identified; Obtain the strings of each node in the first node subset, and construct text identifiers and translated text for the strings; Based on the string and the text identifier, construct the first mapping table; Based on the text identifier and the translated text, the second mapping table is constructed.

9. The method according to any one of claims 1 to 3, characterized in that, The acquisition of text information includes: Obtain the rendering information of the application; If the rendered information differs from the historical rendered information at a historical moment, the text information in the rendered information is obtained.

10. The method according to any one of claims 1 to 3, characterized in that, The method further includes at least one of the following: If the difference in display length between the first translated text and the text information exceeds a length threshold, a first prompt message is displayed, which is used to indicate that the display length of the translated language is abnormal. If the display position of the first translated text exceeds the component size at its location, a second prompt message is displayed, which is used to indicate that the component size is abnormal; If the font size difference between the first translated text and the text information exceeds a size threshold, a third prompt message is displayed, which is used to indicate that the font size of the translated language is abnormal. If the alignment between the first translated text and the text information is different, a fourth prompt message is displayed, which is used to indicate that the alignment of the translated language is abnormal.

11. A text information processing apparatus, characterized in that, The device includes: The acquisition module is used to acquire text information, a first mapping table, and a second mapping table, wherein the text information is used to indicate the character content that the application needs to render; The processing module is used to find a first text identifier in the first mapping table based on the text information. The first mapping table includes at least two key-value pairs in the development language of the application, with the text content in the development language of the application as the keyword and the text identifier as the data item. The processing module is further configured to find the first translated text in the second mapping table based on the first text identifier. The second mapping table includes at least two translation language key-value pairs with the text identifier as the keyword and the text content of the translation language as the data item. The translation language is different from the development language. The display module is used to render and display the character content of the first translated text.

12. A computer device, characterized in that, The computer device includes: a processor and a memory, wherein the memory stores at least one program; the processor is configured to execute the at least one program in the memory to implement the text information processing method as described in any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that, The readable storage medium stores executable instructions, which are loaded and executed by a processor to implement the text information processing method as described in any one of claims 1 to 10.

14. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium. The processor reads and executes the computer instructions from the computer-readable storage medium to implement the text information processing method as described in any one of claims 1 to 10.