Text display method and device, equipment and storage medium
By designing dynamic templates in instant messaging software, using format controllers and multi-level template references, the multilingual support problem in dynamic scenarios is solved, and low-cost and efficient dynamic text display is achieved.
Patent Information
- Application Number
- CN202411740322.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-04-22
AI Technical Summary
When the existing technology realizes the internationalization of instant messaging software, it is difficult to effectively solve the multilingual support problem in dynamic scenarios, resulting in high development costs and complexity.
By designing dynamic templates for instant messaging software, using format controllers and multi-level template references, dynamic text display is realized. This method parses the sub-dynamic template layer by layer in the total dynamic template, fills the text content until the complete text is obtained, and displays it on the client.
It realizes dynamic text display in multilingual and multi-scenarios, reduces the complexity and development cost of software implementation, and greatly improves the adaptation efficiency of language and scenarios.
Smart Images

Figure CN119861990A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of international instant messaging, and in particular to a text display method, device, equipment and storage medium. Background Art
[0002] In recent years, with the growing demand for global development of enterprises, instant messaging software needs to be internationalized and support multiple languages and localized formats in order to expand its own market and attract users from different regions.
[0003] In the related art, the text contents of various languages in different regions corresponding to the same scene are generally aggregated under a static text tag, and then the text contents are organized in a resource document, which is loaded when the software is running; however, in some special application scenarios, such as when creating a group in a group conversation scenario, messages such as names are involved, which makes it impossible to define such messages as static templates. For the above dynamic scenarios, an optional solution is to define scenario events. A scenario event includes information such as the type of event and related personnel, but it is necessary to write parsing solutions for each event in various languages. Whenever a new language support is added, the client needs to complete the parsing event of the corresponding language. In addition, there are many application scenarios in instant messaging software, and the increase in the number of languages, the number of scenarios and the cost is approximately proportional. The solutions that need to be constructed under multiple languages have increased significantly. Therefore, the development cost and complexity of dynamic solutions under multiple languages were relatively high in the past.
[0004] Based on the above analysis of the development status of this technical field, the existing technology lacks a solution that can replace dynamic information with format control characters and realize dynamic display of text in instant messaging through multi-level references of templates. After a one-time investment, there is no need to update the version in the future to realize the application of dynamic text display in multiple languages and multiple scenarios, which can greatly reduce costs. Summary of the invention
[0005] The object of the present invention is to provide a text display method, device, equipment and storage medium, aiming to solve the above-mentioned problems in the prior art.
[0006] According to a first aspect of an embodiment of the present invention, there is provided a text display method, comprising:
[0007] Obtain the current operation event on the client, and call the total dynamic template corresponding to the operation event, wherein the total dynamic template includes format control characters and template text in each language;
[0008] In the overall dynamic template, it is determined whether the next layer of each format control symbol includes a sub-dynamic template, wherein the sub-dynamic template includes the format control symbol and template text in each language, and the sub-dynamic template is expanded layer by layer until there is no sub-dynamic template at a lower layer;
[0009] Start by filling the text at the bottom layer, fill the current parsing result into the format control symbol of the previous layer, parse layer by layer until the complete text of the total dynamic template is obtained, and display the complete text on the client.
[0010] According to a second aspect of an embodiment of the present invention, there is provided a text display device, comprising:
[0011] The general template calling module is used to obtain the current operation event on the client and call the general dynamic template corresponding to the operation event, wherein the general dynamic template includes format control characters and template text in each language;
[0012] A layer-by-layer calling module is used to determine whether the next layer of each format control symbol in the total dynamic template includes a sub-dynamic template, wherein the sub-dynamic template includes the format control symbol and template text in each language, and is expanded layer by layer until there is no sub-dynamic template at a lower layer;
[0013] The filling and result acquisition module is used to fill the text from the bottom layer, fill the current parsing result into the format control symbol of the upper layer, parse layer by layer until the complete text of the total dynamic template is obtained, and display the complete text on the client.
[0014] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the text display method provided in the first aspect of the present disclosure are implemented.
[0015] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which a program for implementing information transmission is stored, and when the program is executed by a processor, the steps of the text display method provided in the first aspect of the present disclosure are implemented.
[0016] The technical solution provided by the embodiment of the present invention includes the following beneficial effects: designing a complete hierarchical calling relationship of the dynamic template of the instant messaging software, expressing dynamicity through format control symbols, obtaining the parsed result text of the lower layer layer by layer, and realizing the display mode of the localized format through logical analysis, so that the same event is displayed differently on different clients, and then passing the parsed results to the upper layer to realize the display of the final client; the dynamic display based on the template only needs to modify the template itself to add language or new business scenarios, and there is no need for the client to re-release a new version, which reduces the complexity and development cost of software implementation and greatly improves the adaptation efficiency of language and scenarios.
[0017] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0019] Figure 1 is a flowchart of a text display method according to an embodiment of the present invention;
[0020] Figure 2 It is a schematic diagram of a total dynamic template under a friend invitation according to an embodiment of the present invention;
[0021] Figure 3 is a schematic diagram of a total dynamic template under a group invitation according to an embodiment of the present invention;
[0022] Figure 4 is a schematic diagram of a hierarchical architecture of an embodiment of the present invention;
[0023] Figure 5 is a schematic diagram of a text display device according to an embodiment of the present invention;
[0024] Figure 6 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the protection scope of the text.
[0026] Method Embodiment
[0027] According to an embodiment of the present invention, a text display method is provided. Figure 1 is a flowchart of a text display method according to an embodiment of the present invention. Figure 1 As shown, the text display method according to an embodiment of the present invention specifically includes:
[0028] In step S110, the current operation event on the client is obtained, and the overall dynamic template corresponding to the operation event is called, wherein the overall dynamic template includes format control characters and template texts in each language, specifically including:
[0029] A multi-level dynamic template relationship of an operation event is established in advance, which is composed of a general dynamic template and sub-dynamic templates. When the operation event is not complicated or there is no personalized display for different user terminals, only the general dynamic template may be included;
[0030] Get the text label of the operation event, and use the text label to get the corresponding total dynamic template from the YAML file used for storage. The dynamic template is stored in the YAML file instead of in the client. The client can load the dynamic template each time it starts. The total dynamic template consists of formatted text composed of multiple entries. Each entry corresponds to an operation event description in a language. The meanings and required format control symbols of each entry are consistent, but the languages are different and the order may be different.
[0031] Figure 2 is a schematic diagram of a total dynamic template under a friend invitation according to an embodiment of the present invention, such as Figure 2 As shown in the figure, the total dynamic template is stored in the background. The text tag "msg.invite.msg" marks the operation event as a message when a user initiates a friend request to another user. The language tag is a string, such as "zh-Hans" for Chinese, "zh-Hant" for Traditional Chinese, "en" for English, "fr" for French, and "default" for the default language. When the client displays text content, if the current language is not within the scope of the template definition, "default" is used by default. You can also use default to simplify the expression. For example, in the capacity template "capacity.gb", only the French unit of capacity is "Go", and the other languages' units of capacity are all "GB". The definition of "capacity.gb" is as follows. The grammatical effect is that only French is Go, and the rest are GB:
[0032] "capacity.gb":
[0033] Default: "%s GB"
[0034] fr:"%s Go"
[0035] Dynamic content is controlled by format control characters, and template text is the static text part. The format control characters are in the form of "%[1]s", "%[2]s", etc. "%[1]s" represents the first parameter filled when parsing the template, that is, the first fill-in text, and so on. The same parameter may appear multiple times in an entry, which will result in repeated instantiation of multiple identical parameters. The introduction of positional format control characters can solve the above problem, so the number of parameters is less than or equal to the number of spaces to be filled.
[0036] Figure 3 is a schematic diagram of a total dynamic template under a group invitation according to an embodiment of the present invention, such as Figure 3 As shown, the text label is "group.invite.members". The entry may also include code logic to implement parsing of more complex content. The present invention takes inviting people to join the group chat as an embodiment for detailed description. Instant messaging software has the concept of organization, which is used to represent an agency, company or team. Users of different organizations are external contacts to each other. If the newly joined person belongs to a different organization from the current client user, it is necessary to trigger the display of the name of the other organization, while people in the same organization can only see the name. In addition, when the number of invited people exceeds a certain number, the number of people can be counted or the name behind it can be omitted as "etc.". "if gt%[3]s 100" means if the value of %[3]s is greater than 100, that is, the threshold is defined as 100. The code logic can be customized according to actual needs.
[0037] Since everyone in the group can receive this invitation message, if the server calculates and generates all messages, assuming that the group members belong to N organizations, internationalization needs need to be translated into M ways. If the traditional method is used, there may be N×M parsing methods, which will cause huge pressure on the database. If methods such as message events are used, the client also needs to adapt to a new version, which greatly increases the cost.
[0038] In the embodiment of the present invention, the first format control character indicates the name of the inviter, the second format control character indicates the name of the invitee, and the third format control character indicates the number of people. Due to organizational differences, the content related to the name may be displayed differently for users of different clients, requiring further logical judgment, and the invitee may not be the same, so the information of each invitee needs to be merged and filled in uniformly, and the number of invitees can be determined when the invitation operation event is generated. Therefore, the first format control character and the second format control character require further sub-dynamic templates to generate the required information, while the third format control character can be directly filled with fill-in text of specific numbers;
[0039] The invitation event in the embodiment of the present invention is that Zhang San invites Li Si and Wang Wu to join the group chat. Zhang San and Wang Wu belong to organization A, and Li Si belongs to organization B.
[0040] In step S120, it is determined in the overall dynamic template whether the next layer of each format control symbol includes a sub-dynamic template, wherein the sub-dynamic template includes the format control symbol and template text in each language, and is expanded layer by layer until there is no sub-dynamic template at a lower layer, specifically including:
[0041] Figure 4 is a schematic diagram of the hierarchical architecture of an embodiment of the present invention, such as Figure 4As shown in the figure, the complete design framework for group invitations is shown. The overall dynamic template name is "group.invite.members", which is the 0th layer. The sub-dynamic template "dup" is used to define the logic of merging multiple invitees. The definition is as follows:
[0042] "dup":
[0043] zh-Hans:"%[1]s、%[2]s"
[0044] zh-Hant:"%[1]s,%[2]s"
[0045] zh-Hant-HK:"%[1]s,%[2]s"
[0046] en:"%[1]s,%[2]s"
[0047] fr:"%[1]s,%[2]s"
[0048] The use of dup sub-dynamic template can better cope with the situation where the main content remains unchanged but the number of parameters changes; preferably, the first parameter of dup can also be dup itself to achieve an uncertain number of people or other types of repetitions, and any length can be processed through unlimited recursion.
[0049] The child dynamic template "staff.name.with.org" is used to define the logic of extending the name and organization information. The definition is as follows:
[0050] "staff.name.with.org":
[0051] default:"{{if eq%[1]s.SelfOid}}%[2]s{{else}}%[2]s(%[3]s){{end}}"
[0052] Since this template is processed the same way in different languages, only the default template is defined without language definition. "{{if eq...}}" is the template syntax of golang, which is used to determine whether the following two parameters %[1]s and .SelfOid are equal. %[1]s indicates that the organization ID of the inviter or invitee needs to be displayed on the client, .SelfOid indicates the organization ID of the current user, %[2]s indicates a name without organization information, and %[3]s indicates a name with organization information. The definition of staff.name.with.org means that if the organization ID of the current user is the same as that of the user related to a certain operation event, the organization information of the user does not need to be displayed in the client of the current user.
[0053] The first layer staff.name.with.org is used to process the extended name of the inviter, and in the second layer, each staff.name.with.org under the dup template is used to process the extended name of each invitee. In the embodiment of the present invention, there are two invitees.
[0054] In the embodiment of the present invention, group.invite.members is used as the entry point and expanded downward layer by layer in a tree structure. If the lower layer is filled with text, the downward expansion stops until all leaf nodes of the hierarchical structure are of the type filled with text, and a tree-like hierarchical structure is obtained by expanding layer by layer.
[0055] In step S130, starting from filling text at the bottom layer, the current parsing result is filled into the format control symbol of the upper layer, and parsed layer by layer until the complete text of the total dynamic template is obtained, and the complete text is displayed on the client, which specifically includes:
[0056] Obtain the data of the fill text that can be directly obtained initially from the server, and directly fill the character type text into the corresponding format control symbol as the current parsing result, that is, directly obtain the content of the character type text as the parsing result, and actually no complex parsing means are required;
[0057] Fill the parsing results of the bottom leaf nodes into the upper layer staff.name.with.org respectively, and parse them again in the upper layer. Whether it is a sub-dynamic template or a common character type parameter, the parsing results are all common text, but the sub-dynamic template includes more complex processing logic;
[0058] Fill the parsing results into the format control symbols of the current language corresponding entry in the child dynamic template, including:
[0059] The code under the corresponding entry is obtained through the conditional judgment method of the current language name. If it does not exist, the code under the default setting entry is obtained, and the parsing result is filled into the format control character in the code. In the embodiment of the present invention, the corresponding organization ID, name and organization name are filled into staff.name.with.org. The content of the leaf node can be directly assigned by the server. Since only default is defined, it can be directly filled in;
[0060] The parsing results obtained by executing the code corresponding to the entry include:
[0061] Based on the organizational relationship between the user of the current client and other colleagues of the operation event, the parsing result in the local format on the current client is obtained by executing the filled code, wherein the parsing result is different for different clients;
[0062] Integrate multiple parsing results of the same type by executing the filled code.
[0063] In the embodiment of the present invention, the parsing uses the Sprintf function in the fmt package in the golang language. The function definition is: func Sprintf(format string, a...any) string, where format represents a formatting entry composed of a format control character and template text, a represents a variable-length parameter, ... indicates that the parameter can be multiple, and any indicates that any parameter can be of any type. The specific data of the parameter is related to the number of format control characters to be filled in the formatting entry;
[0064] Taking the perspective of Zhang San as an example, the form after the third-layer filling is:
[0065] {{if eq 2.SelfOid}}Li Si{{else}}Li Si(B){{end}}
[0066] {{if eq 1.SelfOid}}Wang Wu{{else}}Wang Wu(A){{end}}
[0067] In the embodiment of the present invention, the value of.SelfOid is Zhang San's organization ID, which is 1. The process of the third-layer filling and parsing is as follows:
[0068] arg2 := fmt.Sprintf(“{{ifeq %[1]s.SelfOid}}%[2]s{{else}}%[2]s(%[3]s){{end}}”, “2”, “Li Si”, “B”)
[0069] arg3 := fmt.Sprintf(“{{ifeq %[1]s.SelfOid}}%[2]s{{else}}%[2]s(%[3]s){{end}}”, “1”, “Wang Wu”, “A”)
[0070] Zhang San's organization ID is not equal to Li Si's organization ID. Therefore, the result output by arg2 is Li Si(B). Zhang San's organization ID is equal to Wang Wu's organization ID, and the result output by arg3 is Wang Wu. Based on the above logic, the same template can be used to achieve the localized format display corresponding to each client. In the embodiment of the present invention, the format control character is in the code and can be parsed after filling;
[0071] After the third-layer filling and parsing is completed, the process of the second-layer filling and parsing is as follows:
[0072] arg1:=fmt.Sprintf("{{if eq%[1]s.SelfOid}}%[2]s{{else}}%[2]s(%[3]s){{end}}", "1", "Zhang San", "A")
[0073] arg4:=fmt.Sprintf("%[1]s,%[2]s",arg2,arg3)
[0074] The output result of arg1 is Zhang San, and the output of arg4 is Li Si (B) and Wang Wu, that is, the two parameters of both invitees are merged through dup;
[0075] In each layer of processing, if a sub-dynamic template is processed, then in each layer of the sub-dynamic template, the corresponding fill text of the next layer is obtained, and the fill text is filled into the format control symbol of the current language corresponding entry in the sub-dynamic template, and the parsing result is obtained by executing the code corresponding to the entry. After the code parsing is completed, the required text form is formed. If a character type parameter is processed, the text content is directly filled into the corresponding format control symbol as the parsing result, and each parsing result is passed to the upper-level sub-dynamic template, and parsed layer by layer until the parsing result is passed to the total dynamic template, and the parsing of the total dynamic template is completed; that is, it is sufficient to parse directly from the leaf node of the tree structure to the root node;
[0076] In dynamic templates, the order of format control characters corresponds to the order of parameters;
[0077] In the last level of filling and parsing, you only need to fill arg1, arg2 and the number of invitees parameter 2 into the total dynamic template group.invite.members, and fill it under the entry corresponding to the Chinese "zh-Hans". The parsing process is as follows:
[0078] fmt.Sprintf("%[1]s added %[2]s {{if gt %[3]s 100}} and %[3]s people {{end}} to the group", arg1, arg4, "3")
[0079] Since the number of invitees 2 is not greater than 100, the final display on Zhang San's client is: Zhang San added Li Si (B) and Wang Wu to the group;
[0080] Similarly, it is displayed on Li Si's client as: Zhang San (A) added Li Si and Wang Wu (A) to the group; it is displayed on Wang Wu's client as: Zhang San added Li Si (B) and Wang Wu to the group; the display on other user terminals is based on their organization ID. The text display method set in the embodiment of the present invention makes the texts seen by users of different organizations different.
[0081] In the embodiment of the present invention, in order to avoid waiting time and improve efficiency, it is necessary to fill in the analysis layer by layer, that is, it is necessary to start from the third layer and move upward layer by layer. Although the corresponding staff.name.with.org can be filled after the information of Zhang San in the second layer is obtained, if the result of arg1 is obtained first, more time is required in the upper layer to wait for the filling of other format control characters. Preferably, for the case of using the same parameters, the caching technology can be used to achieve the purpose of eliminating repeated calculations and reducing waiting time.
[0082] The method further comprises:
[0083] In step S130, according to actual needs, add general dynamic templates corresponding to operation events in other business scenarios; for the same operation event, add entries in different languages to the general dynamic template, store the updated general dynamic template in the corresponding YAML file, and overwrite the corresponding old file.
[0084] The general dynamic template is equivalent to an entry, and the lower-level dynamic templates and leaf nodes are also part of the hierarchical structure. Therefore, adding entries in different languages to the general dynamic template is equivalent to adaptively adding language entries to other sub-dynamic templates. When adding new languages and business scenarios, there is no need to re-release new versions to support them. When you need to add support for a certain language, you only need to add new language tags and corresponding entries to the corresponding templates. When adding business scenarios, define the formatted entry format corresponding to the scenario, organize the content into resource files, and load the client once during initialization. When adding new language types or events, unified parsing logic can be used to solve them.
[0085] To sum up, in response to the existing problems, the text display method of this invention designs a complete hierarchical calling relationship of the dynamic template of the instant messaging software. The dynamic nature is represented by the format control symbol in the dynamic template, and the entries of the corresponding language are obtained through the language tag; in the process of displaying the dynamic text on the client, it is necessary to obtain the parsed result text of the lower layer layer by layer, and realize the display method of the localized format through logical analysis, so that the same event is displayed differently on different clients, and then the parsed result is passed to the upper layer to realize the final client display; the dynamic template is implemented based on the template syntax function in the text / temple package in the Golang language, and the logical analysis is implemented based on the basic processing logic in the Golang language, which is easy to implement; the dynamic display based on the template only needs to modify the template itself to add a language or a new business scenario, and there is no need for the client to re-release a new version, which reduces the complexity and development cost of software implementation and greatly improves the adaptation efficiency of languages and scenarios.
[0086] Device Embodiment
[0087] According to an embodiment of the present invention, a text display device is provided. Figure 5 Schematic diagram of a device according to an embodiment of the present invention. Figure 5 As shown, the text display device according to the embodiment of the present invention specifically includes:
[0088] The general template calling module 50 is used to obtain the current operation event on the client and call the general dynamic template corresponding to the operation event, wherein the general dynamic template includes format control characters and template text in each language, and is specifically used for:
[0089] Get the text label of the operation event, and use the text label to get the corresponding total dynamic template from the YAML file used for storage.
[0090] The layer-by-layer calling module 52 is used to determine whether the layer below each format control symbol in the total dynamic template includes a sub-dynamic template, wherein the sub-dynamic template includes the format control symbol and template text in each language, and expands layer by layer until there is no sub-dynamic template at a lower layer;
[0091] The filling and result obtaining module 54 is used to fill the text from the bottom layer, fill the current parsing result into the format control symbol of the upper layer, parse layer by layer until the complete text of the total dynamic template is obtained, and display the complete text on the client, specifically for:
[0092] In each layer of processing, if the current processing type is a sub-dynamic template, the parsing result passed by the next layer is obtained, and the parsing result is filled into the format control symbol of the current language corresponding entry in the sub-dynamic template. The current parsing result is obtained by executing the code corresponding to the entry. If the current processing type is fill text, the character type text is directly filled into the corresponding format control symbol as the current parsing result;
[0093] The parsing results are passed to the upper-level sub-dynamic template, and the parsing is performed layer by layer until the parsing results are passed to the main dynamic template. After the main dynamic template is parsed, the parsing results are filled into the format control symbol of the current language corresponding entry in the sub-dynamic template. Specifically include:
[0094] The code under the corresponding entry is obtained through the conditional judgment method of the current language name. If it does not exist, the code under the default setting entry is obtained, and the parsing result is filled into the format control character in the code.
[0095] The parsing results obtained by executing the code corresponding to the entry include:
[0096] Based on the organizational relationship between the user of the current client and other colleagues of the operation event, the parsing result in the local format on the current client is obtained by executing the filled code, wherein the parsing result is different for different clients;
[0097] Consolidate multiple parsing results of the same type by executing the filled code.
[0098] The device further comprises:
[0099] The update module 56 is used to add the total dynamic template corresponding to the operation events in other business scenarios according to actual needs; for the same operation event, add entries in different languages to the total dynamic template, store the updated total dynamic template in the corresponding YAML file, and overwrite the corresponding old file.
[0100] To sum up, in response to the existing problems, the text display device of this invention designs a complete hierarchical calling relationship of the dynamic template of the instant messaging software. The dynamic nature is expressed by the format control symbol in the dynamic template, and the entries of the corresponding language are obtained by the language tag; in the process of displaying the dynamic text on the client, it is necessary to obtain the parsed result text of the lower layer layer by layer, and realize the display method of the localized format through logical analysis, so that the same event is displayed differently on different clients, and then the parsed results are passed to the upper layer to realize the final client display; the dynamic template is implemented based on the template syntax function in the text / temple package in the Golang language, and the logical analysis is implemented based on the basic processing logic in the Golang language, which is easy to implement; the dynamic display based on the template only needs to modify the template itself to add the language or new business scenario, and there is no need for the client to re-release the new version, which reduces the complexity and development cost of software implementation and greatly improves the adaptation efficiency of language and scenario.
[0101] Electronic device embodiment
[0102] Figure 6 6 is a schematic diagram of an electronic device according to an embodiment of the present invention. The electronic device 600 may include at least one processor 610 and a memory 620. The processor 610 may execute instructions stored in the memory 620. The processor 610 is connected to the memory 620 through a data bus. In addition to the memory 620, the processor 610 may also be connected to an input device 630, an output device 640, and a communication device 650 through a data bus.
[0103] The processor 610 may be any conventional processor, such as a commercially available CPU. The processor may also include a graphics processor (Graphic Process Unit, GPU), a field programmable gate array (Field Programmable Gate Array, FPGA), a system on chip (System on Chip, SOC), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC) or a combination thereof.
[0104] The memory 620 may be implemented by any type of volatile or nonvolatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0105] In the embodiment of the present disclosure, executable instructions are stored in the memory 620, and the processor 610 can read the executable instructions from the memory 620 and execute the instructions to implement all or part of the steps of any text display method in the above exemplary embodiments.
[0106] Computer Readable Storage Medium Embodiments
[0107] In addition to the above-mentioned methods and devices, the exemplary embodiments of the present disclosure may also be a computer program product or a computer-readable storage medium storing the computer program product, wherein the computer product includes computer program instructions that can be executed by a processor to implement all or part of the steps described in the text display method of any one of the above-mentioned exemplary embodiments.
[0108] The computer program product may be written in any combination of one or more programming languages to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages such as Java, C++, etc., and also conventional procedural programming languages such as "C" language or similar programming languages and scripting languages (e.g., Python). The program code may be executed entirely on the user computing device, partially on the user computing device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0109] Computer readable storage media can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of readable storage media include: a static random access memory (SRAM) with one or more wires electrically connected, an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk or an optical disk, or any suitable combination of the above.
[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A text display method, characterized in that: include: Acquire the current operation event on the client, and call the general dynamic template corresponding to the operation event, wherein the general dynamic template includes format control characters and template text in each language; In the total dynamic template, determining whether a layer below each format control symbol includes a sub-dynamic template, wherein the sub-dynamic template includes a format control symbol and a template text in each language, and expanding layer by layer until there is no sub-dynamic template at a lower layer; Start by filling the text from the bottom layer, fill the current parsing result into the format control symbol of the upper layer, parse layer by layer until the complete text of the total dynamic template is obtained, and display the complete text on the client.
2. The method according to claim 1, characterized in that The method further comprises: According to actual needs, add general dynamic templates corresponding to operation events in other business scenarios; for the same operation event, add entries in different languages to the general dynamic template, store the updated general dynamic template in the corresponding YAML file, and overwrite the corresponding old file.
3. The method according to claim 1, characterized in that: The obtaining of the current operation event on the client and calling the total dynamic template corresponding to the operation event specifically includes: A text label of the operation event is obtained, and a corresponding total dynamic template is obtained from a YAML file for storage through the text label.
4. The method according to claim 1, characterized in that: The method starts from filling text at the bottom layer, fills the current parsing result into the format control symbol of the upper layer, and parses layer by layer until the complete text of the total dynamic template is obtained. Specifically, it includes: In each layer of processing, if the current processing type is a sub-dynamic template, the parsing result passed by the next layer is obtained, and the parsing result is filled into the format control symbol of the entry corresponding to the current language in the sub-dynamic template. The current parsing result is obtained by executing the code corresponding to the entry. If the current processing type is fill text, the character type text is directly filled into the corresponding format control symbol as the current parsing result; Each parsing result is passed to the upper-level sub-dynamic template, and parsed layer by layer until the parsing result is passed to the total dynamic template, and the total dynamic template is parsed to obtain the complete text.
5. The method according to claim 4, characterized in that The step of filling the parsing result into the format control symbol of the entry corresponding to the current language in the child dynamic template specifically includes: The code under the corresponding entry is obtained through the conditional judgment method of the current language name. If it does not exist, the code under the default setting entry is obtained, and the parsing result is filled into the format control character in the code.
6. The method according to claim 4, characterized in that The obtaining of the current parsing result by executing the code corresponding to the entry specifically includes: Based on the organizational relationship between the user of the current client and other colleagues of the operation event, the parsing result in the local format on the current client is obtained by executing the filled code, wherein the parsing result is different for different clients; Consolidate multiple parsing results of the same type by executing the filled code.
7. A text display device, characterized in that: include: A general template calling module, used for obtaining the current operation event on the client, and calling the general dynamic template corresponding to the operation event, wherein the general dynamic template includes format control characters and template text in each language; A layer-by-layer calling module is used to determine whether the next layer of each format control symbol in the total dynamic template includes a sub-dynamic template, wherein the sub-dynamic template includes the format control symbol and template text in each language, and is expanded layer by layer until there is no sub-dynamic template at a lower layer; The filling and result obtaining module is used to fill the text from the bottom layer, fill the current parsing result into the format control symbol of the upper layer, parse layer by layer until the complete text of the total dynamic template is obtained, and display the complete text on the client.
8. The device according to claim 7, characterized in that The device further comprises: The update module is used to add the total dynamic template corresponding to the operation events in other business scenarios according to actual needs; for the same operation event, add entries in different languages to the total dynamic template, store the updated total dynamic template in the corresponding YAML file, and overwrite the corresponding old file.
9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the text display method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an implementation program for information transmission, and when the program is executed by a processor, the steps of the text display method according to any one of claims 1 to 6 are implemented.