International prompt processing method and device, electronic equipment and storage medium
By receiving the form submitted by the user and using the preset framework for global verification, obtaining the prompt code and joint unique key, and obtaining the prompt from the database, the problem that the prompt cannot be dynamically refreshed and the coding conflict in the existing technology is solved, and improves the efficiency The prompt effect and maintainability of internationalized prompts.
Patent Information
- Application Number
- CN202411113802.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-10-29
AI Technical Summary
The existing international prompt processing method cannot dynamically refresh the text, making it difficult for developers to quickly understand the meaning of the description. When developing multiple requirements, it is easy to cause prompt encoding conflicts and reuse, affecting the prompt effect.
By receiving the form submitted by the user, using the preset framework for global verification, generating exception information and extracting the prompt code, obtaining the joint unique key according to the language, obtaining the prompt from the database, and maintaining the prompt data in the database to achieve dynamic refresh and avoid coding conflicts.
It is possible to dynamically refresh prompts without restarting the project, preventing coding conflicts and improving the prompt effect and maintainability of prompts.
Smart Images

Figure CN118862833A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of prompt language, and in particular to an internationalized prompt language processing method, device, electronic device and storage medium. Background Art
[0002] In actual scenarios, the enterprise's overseas systems need to be used by different users in different countries, so the language display needs to be switched according to the user's preferences. For example, a US business wants to see English when using the system. Businesses in China want to see Chinese. As for the back-end validation prompts, such as filling out a form and verifying that the fields cannot be empty, the industry generally uses the Java validation + Spring IL8N solution to implement multi-language configuration and switching.
[0003] According to the default il8n solution, texts in different languages are maintained in configuration files, such as message_zh_CN.properties and message_en_US.properties files, using the key and value format, and then maintaining the corresponding key encoding in the code. However, this approach has the following disadvantages:
[0004] 1. The corresponding text cannot be refreshed dynamically. For example, after a prompt text is launched, if it is found that the English description is not accurate enough and needs to be modified, the configuration file needs to be modified, repackaged, and the system needs to be republished for it to take effect.
[0005] 2. Maintain the corresponding key code in the code. Developers cannot quickly know the meaning of this description and need to jump to the configuration file to understand the corresponding text.
[0006] 3. When multiple requirements are developed at the same time, different developers define key codes in different development branches and are likely to use the same code, but each has a different copy, which can easily lead to repeated use of code. In this case, the conflict can only be discovered when the code is merged into the main branch online, and the code needs to be constantly adjusted to prevent reuse. Summary of the invention
[0007] The present invention provides an internationalized prompt language processing method, device, electronic device and storage medium, which are used to solve the technical problem that the existing internationalized prompt language has a poor prompt effect.
[0008] The present invention provides an internationalized prompt processing method, comprising:
[0009] receiving a form submitted by a user, wherein the form carries a language selected by the user;
[0010] Performing global validation on the form through a preset framework;
[0011] When the verification fails, an exception message is generated;
[0012] When the language is not Chinese, extracting a prompt code from the abnormal information;
[0013] Obtaining a joint unique key of the prompt code according to the language;
[0014] Acquire the prompt word corresponding to the prompt word code from a preset database according to the joint unique key;
[0015] The prompt is output.
[0016] Optionally, the step of performing global verification processing on the form through a preset framework includes:
[0017] Verify through a preset framework whether the target field of the form meets the preset conditions;
[0018] If the target field does not meet the preset condition, the verification is determined to have failed;
[0019] If the target field meets the preset condition, the verification is determined to be successful.
[0020] Optionally, it also includes:
[0021] When the language is Chinese, extracting annotations from the abnormal information;
[0022] Acquire the Chinese prompt in the annotation and output the Chinese prompt.
[0023] Optionally, it also includes:
[0024] When the global check passes, the business execution logic of the form is obtained and executed.
[0025] Optionally, it also includes:
[0026] When the prompt modification operation is triggered, the prompt data in the preset database is queried through the preset interface;
[0027] The joint unique key is overwritten with the prompt data.
[0028] Optionally, it also includes:
[0029] When the prompt insertion operation is triggered, the initial prompt code and prompt text inserted by the developer are received;
[0030] Determining whether the initial prompt code exists according to the language of the prompt text;
[0031] If it does not exist, a unique key is generated using the initial prompt code and the prompt text;
[0032] If it exists, the initial prompt code is adjusted, and the process returns to the step of determining whether the initial prompt code exists according to the language of the prompt text.
[0033] The present invention also provides an internationalized prompt processing device, comprising:
[0034] A form receiving module, used to receive a form submitted by a user, wherein the form carries a language selected by the user;
[0035] A global validation processing module is used to perform global validation processing on the form through a preset framework;
[0036] An exception information generation module is used to generate exception information when the verification fails;
[0037] A prompt code extraction module, used for extracting the prompt code from the abnormal information when the language is not Chinese;
[0038] A joint unique key acquisition module, used for acquiring the joint unique key of the prompt code according to the language;
[0039] A prompt acquisition module, used for acquiring the prompt corresponding to the prompt code from a preset database according to the joint unique key;
[0040] The output module is used to output the prompt.
[0041] Optionally, the global verification processing module includes:
[0042] The condition judgment submodule is used to check whether the target field of the form meets the preset conditions through a preset framework;
[0043] A failure determination submodule, used to determine that the verification has failed if the target field does not meet a preset condition;
[0044] The success determination submodule is used to determine that the verification is successful if the target field meets the preset conditions.
[0045] The present invention also provides an electronic device, the device comprising a processor and a memory:
[0046] The memory is used to store program code and transmit the program code to the processor;
[0047] The processor is used to execute any one of the above-mentioned internationalized prompt processing methods according to the instructions in the program code.
[0048] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program codes, and the program codes are used to execute the internationalized prompt language processing method as described in any one of the above items.
[0049] It can be seen from the above technical scheme that the present invention has the following advantages: the present invention discloses an international prompt processing method, and specifically discloses: receiving a form submitted by a user, the form carrying the language selected by the user; performing global verification processing on the form through a preset framework; generating an exception message when the verification fails; extracting the prompt code from the exception message when the language is not Chinese; obtaining the joint unique key of the prompt code according to the language; obtaining the prompt corresponding to the prompt code from a preset database according to the joint unique key; outputting the prompt. The present invention performs global verification on the form to determine whether to generate a prompt. The present invention also constructs a joint unique key between the prompt code and the prompt, so that when the form verification fails, the prompt corresponding to the prompt code is obtained through the joint unique key. At the same time, the prompt is maintained by using a database, so that it can be dynamically refreshed without restarting the project, and at the same time effectively prevents the problem of reusing the same prompt code in the development stage, avoids prompt errors caused by repeated prompt codes, and improves the prompt effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention 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 of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0051] Figure 1 A flowchart of a method for processing internationalized prompts provided by an embodiment of the present invention;
[0052] Figure 2 A flowchart of a method for processing internationalized prompts provided by another embodiment of the present invention;
[0053] Figure 3 A structural block diagram of an internationalized prompt processing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0054] The embodiments of the present invention provide a method, device, electronic device and storage medium for processing internationalized prompts, which are used to solve the technical problem that the prompt effect of existing internationalized prompts is poor.
[0055] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0056] See also Figure 1 , Figure 1 A flowchart of a method for processing internationalized prompts provided by an embodiment of the present invention.
[0057] The present invention provides an internationalized prompt processing method, which may specifically include the following steps:
[0058] Step 101, receiving a form submitted by a user, the form carrying a language selected by the user;
[0059] In an embodiment of the present invention, when a user submits an application in the system, the system can determine whether the form is filled out in a standard manner based on the form submitted by the user, so as to determine whether a corresponding prompt needs to be output. Taking a leave application as an example, a user can submit a leave application form with a language.
[0060] To meet the needs of prompts in different languages, the form can carry the language selected by the user. After reading the form content, the system can return prompts to the user in this language.
[0061] In the specific implementation, in order to realize the above process, in the development stage, you can write an interface method to receive the submission of the application form according to the normal back-end interface logic, and at the same time have a request object to receive the content in the form. Taking leave as an example, it includes receiving the leave start time, leave end time, leave requester, leave reason, etc.
[0062] Step 102, performing global verification processing on the form through a preset framework;
[0063] Step 103, when the verification fails, an exception message is generated;
[0064] In an embodiment of the present invention, the preset framework may be a Java validation framework. After receiving the form, a global validation process may be performed through the Java validation framework to determine whether there are any exceptions in the form filling. At the global level, if the validation fails, the Java validation will throw a MethodArgumentNotValidException exception and obtain the exception information.
[0065] Step 104, when the language is not Chinese, extract the prompt code from the abnormal information;
[0066] When the language is not Chinese, a prompt code may be extracted from the exception information. The prompt code may be a string of digits identifying the prompt, such as 1000001.
[0067] Step 105, obtaining a joint unique key of the prompt code according to the language;
[0068] Step 106, obtaining the prompt word corresponding to the prompt word code from the preset database according to the joint unique key;
[0069] When multiple requirements are being developed simultaneously, different developers will define key codes in different development branches, and it is easy for them to use the same code, but each has a different text, which can easily lead to repeated codes. In this case, the conflict can only be discovered when the code is merged into the main branch online, and the code needs to be constantly adjusted to prevent repeated use.
[0070] In the embodiment of the present invention, each prompt code will form a joint unique key with a prompt text according to the language during the development process to avoid repeated use of the prompt code. Therefore, when the system determines the language and prompt code, the prompt corresponding to the prompt code can be obtained based on the joint unique key.
[0071] In addition, in the prior art, according to the default il8n scheme, texts in different languages are maintained in the configuration file, using the key and value format, and then the corresponding key code is maintained in the code. However, this scheme cannot dynamically refresh the corresponding text. For example, after a prompt is launched, if it is found that the English description is not accurate enough and needs to be modified, the configuration file needs to be modified, repackaged, and the system needs to be republished to take effect. In view of this, the embodiment of the present invention maintains the prompt in the database. When the prompt needs to be modified, the prompt in the database can be modified directly without modifying the configuration file and republishing the system.
[0072] Step 107: output a prompt.
[0073] After obtaining the prompt, the prompt can be output to the front end for display.
[0074] The present invention performs a global check on the form to determine whether to generate a prompt. The present invention also constructs a joint unique key between the prompt code and the prompt, so that when the form check fails, the prompt in the corresponding language corresponding to the prompt code is obtained through the joint unique key. At the same time, the prompt is maintained by using a database to achieve dynamic refresh without restarting the project. At the same time, the problem of repeatedly using the same prompt code in the development stage is effectively prevented, prompt errors caused by repeated prompt codes are avoided, and the prompt effect of the prompt is improved.
[0075] See also Figure 2 , Figure 2 This is a flowchart of a method for processing internationalized prompts provided by another embodiment of the present invention. Specifically, the following steps may be included:
[0076] Step 201, receiving a form submitted by a user, the form carrying a language selected by the user;
[0077] Step 201 is the same as step 101. For details, please refer to the description of step 101, which will not be repeated here.
[0078] Step 202, verifying whether the target field of the form meets the preset conditions through the preset framework;
[0079] Step 203: If the target field does not meet the preset condition, it is determined that the verification fails;
[0080] Step 204, if the target field is not empty, it is determined that the verification is successful;
[0081] In the embodiment of the present invention, a Java validation framework can be used to perform global validation on the received form to determine whether there are any abnormalities in the form filling.
[0082] Take the leave form as an example. There is a field for the reason for leave, which is a required field. The preset condition is whether this field is empty. If the global validation finds that the field is empty, Java validation will throw a MethodArgumentNotValidException.
[0083] When the global check passes, the business execution logic of the form is obtained and executed.
[0084] Step 205, when the verification fails, an exception message is generated;
[0085] Step 206, when the language is not Chinese, extract the prompt code from the abnormal information;
[0086] In the embodiment of the present invention, when the language is not Chinese, the prompt code can be extracted from the abnormal information.
[0087] In a specific implementation, since the default Java validation annotation can only input a message value, this field can be set with Chinese text in non-internationalized projects, and maintained as a prompt code in internationalized projects. At the same time, by default, it does not support the direct expansion of new attribute fields. In internationalized projects, developers will not be able to better understand the corresponding meaning when seeing the digital code. Therefore, in order to enable developers to better read the corresponding Chinese prompts, the embodiment of the present invention customizes the validation annotations and validation processors, creates a new i18nNotBlank annotation to replace the default NotBlank annotation, and adds a new attribute field defaultMessage to set the default Chinese prompt.
[0088] When the language carried by the user form is not Chinese, the prompt code can be extracted from the i18nNotBlank annotation to facilitate obtaining the corresponding prompt through the prompt code.
[0089] Furthermore, when the language is Chinese, the annotation is extracted from the abnormal information; the Chinese prompt in the annotation is obtained, and the Chinese prompt is output.
[0090] In the specific implementation, when the language carried by the user form is Chinese, the default text of the defaultMessage attribute in the annotation is obtained and returned for display.
[0091] Step 207, obtaining a joint unique key of the prompt code according to the language;
[0092] In the embodiment of the present invention, each prompt code will form a joint unique key with a prompt text according to the language during the development process to avoid repeated use of the prompt code. Therefore, when the system determines the language and prompt code, the prompt corresponding to the prompt code can be obtained based on the joint unique key.
[0093] In an example, the generation process of the joint unique key is as follows:
[0094] First, create a new prompt table to store the corresponding prompt text. The core fields in this table are id (auto-increment primary key), locale (language), code (prompt code), value (prompt text). Locale and code are made into a joint unique key to ensure that the same prompt code does not exist in the same language when inserting data. For example, if developer A wants to insert data with language en_US (English), code 1000009, and text "Product name cannot be empty", and developer B also wants to insert data with language en_US (English), code 1000009, and text "Product name length cannot exceed 100", then if developer A successfully inserts data into the table, developer B cannot insert data successfully, and will be prompted that the unique key check fails. At this time, employee B can find out in advance that the code 1000009 already exists, and then auto-increment it to 1000010 for use, so that the code will not be repeated.
[0095] Step 208, obtaining the prompt word corresponding to the prompt word code from the preset database according to the joint unique key;
[0096] The embodiment of the present invention maintains the prompt words in a database. When the prompt words need to be modified, the prompt words in the database can be modified directly without modifying the configuration file and re-publishing the system.
[0097] Step 209: output a prompt.
[0098] After obtaining the prompt, the prompt can be output to the front end for display.
[0099] Furthermore, in the implementation of the present invention, it also includes:
[0100] When the prompt modification operation is triggered, the prompt data in the preset database is queried through the preset interface; the prompt data is used to overwrite the joint unique key.
[0101] In an embodiment of the present invention, an interface can be defined. When this interface is requested, the custom modified java validation loading prompt logic written in the development phase will be called, the prompt data in the database will be re-queried, and the prompt data will be overwritten in the map in the memory to achieve the update effect.
[0102] Furthermore, in the embodiment of the present invention, it also includes:
[0103] S11, when the prompt word insertion operation is triggered, receiving the initial prompt word code and prompt word text inserted by the developer;
[0104] S12, judging whether the initial prompt code exists according to the language of the prompt text;
[0105] S13, if it does not exist, generate a unique key using the initial prompt code and the prompt text;
[0106] S14, if it exists, adjust the initial prompt code, and return to the step of determining whether the initial prompt code exists according to the language of the prompt text.
[0107] The specific process is the same as the process of generating a joint unique key in the above development phase, and will not be repeated here.
[0108] For ease of understanding, the embodiments of the present invention are described below by using specific examples:
[0109] Suppose a user needs to fill out a page form, such as a leave application. There is a field in the leave application form for filling in the reason for leave, and it is a required field.
[0110] During the development phase, according to the normal backend interface logic, an interface method is written to receive the submission of the request application form. At the same time, there is a request object to receive the values in the form, such as the leave start time, leave end time, person taking leave, leave reason, etc.
[0111] In order to verify that the leave reason field cannot be empty, according to the mainstream validation framework of springboot, javavalidation, a custom annotation i18nNotBlank is added to this field. The message in the corresponding configuration annotation is 1000001, and the defaultMessage is "leave reason cannot be empty". At the same time, an English data is configured in the database table, locale = en_US, code = 1000001, value = leave reason can not be empty.
[0112] At the global level, the logic of the Java validation loading prompt will be customized and modified. The default loading is from the properties file. The embodiment of the present invention loads from the customized table into the memory for use. This loading code logic will be loaded into the memory when the project is started and run, and is internally maintained as a Map type key value format, such as 1000001 as a key, leave reason can not be empty as a value, and different languages are placed in different maps.
[0113] At the global level, if the validation fails, Java validation will throw a MethodArgumentNotValidException. At this time, the global aspect @RestControllerAdvice provided by SpringMVC will handle this global validation failure exception. Here, the message parameter of the i18nNotBlank annotation will be obtained according to the thrown exception. At this time, the corresponding prompt can be found from the map of the corresponding language in the third step. If the user chooses the Chinese interface, there is no need to obtain the map data, but the defaultMessage Chinese prompt of the i18nNotBlank annotation is obtained. After obtaining the prompt, it is spliced into a unified format and returned to the front end for display to the user.
[0114] Therefore, in the actual use stage, after the above configuration and global code processing, the whole process is as follows:
[0115] After starting the project, the prompts are loaded into the memory for subsequent verification without being used.
[0116] The user submits the form without filling in the reason for the leave, and the request will carry the page language selected by the user, such as English.
[0117] When the form reaches the backend, the Java validation framework performs global validation and finds that the request reason field is empty. The validation fails and an exception is thrown.
[0118] The global exception section receives the above exception information, extracts the prompt code, finds the corresponding prompt by language, and splices it into a unified format and returns it to the user for display.
[0119] If the user fills in the reason for leave in the form, the verification is passed. After passing, some business logic processing is performed, such as saving the leave information to the database, finding the employee's corresponding superior employee, sending a message notification to the superior employee, and other business logic.
[0120] The present invention performs a global check on the form to determine whether to generate a prompt. The present invention also constructs a joint unique key between the prompt code and the prompt, so that when the form check fails, the prompt in the corresponding language corresponding to the prompt code is obtained through the joint unique key. At the same time, the prompt is maintained by using a database to achieve dynamic refresh without restarting the project. At the same time, the problem of repeatedly using the same prompt code in the development stage is effectively prevented, prompt errors caused by repeated prompt codes are avoided, and the prompt effect of the prompt is improved.
[0121] See also Figure 3 , Figure 3 A structural block diagram of an internationalized prompt processing device provided by an embodiment of the present invention.
[0122] The embodiment of the present invention provides an internationalized prompt processing device, including:
[0123] The form receiving module 301 is used to receive a form submitted by a user, the form carrying the language selected by the user;
[0124] A global validation processing module 302 is used to perform global validation processing on the form through a preset framework;
[0125] The abnormal information generating module 303 is used to generate abnormal information when the verification fails;
[0126] The prompt code extraction module 304 is used to extract the prompt code from the abnormal information when the language is not Chinese;
[0127] A joint unique key acquisition module 305 is used to acquire a joint unique key of the prompt code according to the language;
[0128] A prompt acquisition module 306, used to acquire a prompt corresponding to the prompt code from a preset database according to a joint unique key;
[0129] The output module 307 is used to output prompts.
[0130] In the embodiment of the present invention, the global verification processing module 302 includes:
[0131] The condition judgment submodule is used to check whether the target field of the form meets the preset conditions through the preset framework;
[0132] The failure determination submodule is used to determine that the verification fails if the target field does not meet the preset conditions;
[0133] The success determination submodule is used to determine that the verification is successful if the target field meets the preset conditions.
[0134] In an embodiment of the present invention, it also includes:
[0135] Annotation extraction module, used to extract annotations from exception information when the language is Chinese;
[0136] The Chinese prompt output module is used to obtain the Chinese prompts in the annotations and output the Chinese prompts.
[0137] In an embodiment of the present invention, it also includes:
[0138] The execution module is used to obtain the business execution logic of the form and execute the business execution logic when the global check passes.
[0139] In an embodiment of the present invention, it also includes:
[0140] A modification module, used for querying the prompt word data in the preset database through a preset interface when a prompt word modification operation is triggered;
[0141] Overwrite the union unique key with hint data.
[0142] In an embodiment of the present invention, it also includes:
[0143] An initial prompt code and prompt text receiving module, used to receive the initial prompt code and prompt text inserted by the developer when the prompt insertion operation is triggered;
[0144] A judgment module, used for judging whether the initial prompt code exists according to the language of the prompt text;
[0145] A unique key generation module, used to generate a unique key using the initial prompt code and prompt text if it does not exist;
[0146] The return module is used to adjust the initial prompt code if it exists, and return to the step of determining whether the initial prompt code exists according to the language of the prompt text.
[0147] An embodiment of the present invention further provides an electronic device, the device comprising a processor and a memory:
[0148] The memory is used to store the program code and transmit the program code to the processor;
[0149] The processor is used to execute the internationalized prompt processing method of the embodiment of the present invention according to the instructions in the program code.
[0150] The embodiment of the present invention further provides a computer-readable storage medium, which is used to store program codes, and the program codes are used to execute the internationalized prompt language processing method of the embodiment of the present invention.
[0151] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0152] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0153] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0154] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0155] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0156] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0157] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0158] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0159] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for processing internationalized prompts, characterized in that: include: receiving a form submitted by a user, wherein the form carries a language selected by the user; Performing global validation on the form through a preset framework; When the verification fails, an exception message is generated; When the language is not Chinese, extracting a prompt code from the abnormal information; Obtaining a joint unique key of the prompt code according to the language; Acquire the prompt word corresponding to the prompt word code from a preset database according to the joint unique key; The prompt is output.
2. The method according to claim 1, characterized in that The step of performing global verification processing on the form through a preset framework includes: Verify through a preset framework whether the target field of the form meets the preset conditions; If the target field does not meet the preset condition, the verification is determined to have failed; If the target field meets the preset condition, the verification is determined to be successful.
3. The method according to claim 1, characterized in that Also includes: When the language is Chinese, extracting annotations from the abnormal information; Acquire the Chinese prompt in the annotation and output the Chinese prompt.
4. The method according to claim 1, characterized in that: Also includes: When the global check passes, the business execution logic of the form is obtained and executed.
5. The method according to claim 1, characterized in that Also includes: When the prompt modification operation is triggered, the prompt data in the preset database is queried through the preset interface; The joint unique key is overwritten with the prompt data.
6. The method according to claim 1, characterized in that Also includes: When the prompt insertion operation is triggered, the initial prompt code and prompt text inserted by the developer are received; Determining whether the initial prompt code exists according to the language of the prompt text; If it does not exist, a unique key is generated using the initial prompt code and the prompt text; If it exists, the initial prompt code is adjusted, and the process returns to the step of determining whether the initial prompt code exists according to the language of the prompt text.
7. An internationalized prompt processing device, characterized in that: include: A form receiving module, used to receive a form submitted by a user, wherein the form carries a language selected by the user; A global validation processing module is used to perform global validation processing on the form through a preset framework; An exception information generation module is used to generate exception information when the verification fails; A prompt code extraction module, used for extracting the prompt code from the abnormal information when the language is not Chinese; A joint unique key acquisition module, used for acquiring the joint unique key of the prompt code according to the language; A prompt acquisition module, used for acquiring the prompt corresponding to the prompt code from a preset database according to the joint unique key; The output module is used to output the prompt.
8. The device according to claim 7, characterized in that The global verification processing module includes: The condition judgment submodule is used to check whether the target field of the form meets the preset conditions through a preset framework; A failure determination submodule, used to determine that the verification has failed if the target field does not meet a preset condition; The success determination submodule is used to determine that the verification is successful if the target field meets the preset conditions.
9. An electronic device, characterized in that: The device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the internationalized prompt processing method according to any one of claims 1 to 6 according to the instructions in the program code.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program codes, and the program codes are used to execute the internationalized prompt processing method according to any one of claims 1 to 6.
Citation Information
Cited By
Front-end prompt word configuration method and system
CN119883883A
