Configuration file translation method and device, equipment and storage medium
By constructing a terminology dictionary and format parsing, combined with large-scale model translation technology, the issues of translation consistency and format integrity of i18n configuration files in cybersecurity SaaS platforms were resolved, achieving efficient and accurate translation results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU DBAPPSECURITY CO LTD
- Filing Date
- 2026-02-03
- Publication Date
- 2026-05-12
AI Technical Summary
Existing technologies struggle to efficiently and accurately translate structured i18n configuration files, especially in cybersecurity SaaS platforms, where inconsistencies in terminology, formatting errors, and incremental update challenges exist.
By acquiring user translation instructions, a terminology dictionary is built and format information is parsed. A large model is used to generate translation content, and a reflection engine is used to optimize the translation results, ensuring terminology consistency and format integrity.
It achieves efficient and accurate translation of i18n configuration files, ensuring the usability of translated files and meeting multilingual adaptation requirements, while reducing the cost and risk of iterative updates.
Smart Images

Figure CN122021673A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of document translation technology, and in particular to a method, apparatus, device, and storage medium for translating configuration files. Background Technology
[0002] With the globalization of software development, overseas applications, especially cybersecurity SaaS (Software as a Service) platforms, need to support multilingual adaptation. i18n (Internationalization) configuration files have become the core carrier for managing multilingual documentation. These files often exist in key-value pair format and frequently contain nested structures, code placeholders, and other formatting elements. Furthermore, the cybersecurity field has extremely high requirements for the accuracy and consistency of translations of specialized terminology.
[0003] In existing technologies, traditional API (Application Programming Interface) translation and manual polishing solutions complete the work by machine translation of the initial draft and human proofreading. However, because translation tasks are performed in batches and by different people, there is a lack of unified terminology standards, resulting in multiple translations of the same technical term. Translators are often unfamiliar with technical details, which can easily lead to mistranslation or damage to format elements, causing program errors. Furthermore, incremental updates face the dilemma of "translating only the changed content and losing context" or "the cost of full translation is too high." While using LLM (Large Language Model) translation is more convenient, it is limited by the probabilistic generation characteristics of large models. Terminology consistency cannot be guaranteed when translating across batches, format protection relies on prompts and is not reliable enough, and there is also the possibility of mistranslating configuration file keys or changing the file structure, which also makes it difficult to solve the incremental update problem. The translation of i18n configuration files must simultaneously meet the requirements of 100% consistent terminology, complete and undamaged format, unchanged configuration structure, and efficient incremental updates. Existing technologies all deal with this with a "text translation" approach, which cannot meet the above requirements.
[0004] In conclusion, how to efficiently, accurately, and securely translate structured i18n configuration files is a pressing technical problem that needs to be solved. Summary of the Invention
[0005] In view of this, the purpose of this invention is to provide a method, apparatus, device, and storage medium for translating configuration files, which can efficiently, accurately, and securely translate structured i18n configuration files. The specific solution is as follows: Firstly, this application provides a method for translating configuration files, including: Obtain the target translation instruction initiated by the user, and determine the initial content to be translated in the initial internationalization configuration file based on the target translation instruction; Obtain the terminology dictionary corresponding to the initial internationalization configuration file; the terminology dictionary is a dictionary built based on the first term and the second term in the initial internationalization configuration file, the first term is not translated, and the second term is uniformly translated into the same translation; The target format information in the initial content is parsed, and target prompt words are generated based on the initial content, the terminology dictionary, and the target format information; The target big model is used to generate an initial translation corresponding to the initial content based on the target prompt words, and the target internationalization configuration file is determined by translating the initial internationalization configuration file based on the initial translation.
[0006] Optionally, the target translation instruction can be a full translation or an incremental translation; Accordingly, determining the initial content to be translated in the initial internationalization configuration file based on the target translation instructions includes: If the target translation instruction is a full translation, then the initial internationalization configuration file is directly determined as the initial content; If the target translation instruction is an incremental translation, then the initial internationalization configuration file and the translation file are compared, and the initial content is determined based on the comparison result; the translation file is the latest translation file obtained by translating the initial internationalization configuration file.
[0007] Optionally, determining the initial content based on the comparison results includes: Based on the comparison results, determine whether the translated file is missing content from the initial internationalization configuration file; if so, determine the corresponding missing content from the initial internationalization configuration file. Determine whether there are any changes in the initial internationalization configuration file; if so, determine the corresponding changes from the initial internationalization configuration file. The initial content is determined based on the missing content and the changed content.
[0008] Optionally, before obtaining the terminology dictionary corresponding to the initial internationalization configuration file, the method further includes: The initial internationalization configuration file is analyzed using the target large model to detect the first term and the second term in the initial internationalization configuration file; Generate a unified translation corresponding to the second term, and construct the terminology dictionary based on the first term, the second term, and the unified translation corresponding to the second term.
[0009] Optionally, parsing the target format information in the initial content includes: The target format information in the initial content is parsed using a preset regular expression or a preset format parser; the target format information includes placeholders, HTML tags, URL tags, and Markdown tags.
[0010] Optionally, the step of generating the initial translation corresponding to the initial content based on the target prompt word using the target big model includes: The initial content is translated using the target large model to generate corresponding translated content; The target big model is used to evaluate the translation content based on the target prompt words, and corresponding improvement suggestions are generated based on the evaluation results. The initial translation corresponding to the initial content is generated based on the evaluation results and the improvement suggestions. Accordingly, the process of translating the initial content using the target large model to generate corresponding translated content includes: If the target translation instruction is a full translation, then the initial content is directly translated using the target large model to generate the translated content; If the target translation instruction is incremental translation, then the context corresponding to the initial content in the initial internationalization configuration file is determined, and the initial content is translated based on the context using the target big model to generate the translated content.
[0011] Optionally, before determining the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation, the method further includes: Verify whether the format information of the initial translation is consistent with the target format information, so that when the format information of the initial translation is consistent with the target format information, determine the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation; Accordingly, determining the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation includes: If the target translation instruction is a full translation, then the initial translation is directly determined as the target internationalization configuration file; If the target translation instruction is an incremental translation, then based on the comparison result between the initial internationalization configuration file and the translation file, it is determined whether there is redundant content in the translation file; If there is redundant content in the translation file, the redundant content is deleted from the translation file to obtain an updated translation file, and the updated translation file and the initial translation are merged to obtain the target internationalization configuration file; If there is no redundant content in the translation file, the translation file and the initial translation are directly merged to obtain the target internationalization configuration file.
[0012] Secondly, this application provides a configuration file translation apparatus, comprising: The target translation instruction acquisition module is used to acquire the target translation instruction initiated by the user and determine the initial content to be translated in the initial internationalization configuration file based on the target translation instruction; The terminology dictionary acquisition module is used to acquire the terminology dictionary corresponding to the initial internationalization configuration file; the terminology dictionary is a dictionary built based on the first term and the second term in the initial internationalization configuration file, the first term is not translated, and the second term is uniformly translated into the same translation; The target prompt word generation module is used to parse the target format information in the initial content and generate target prompt words based on the initial content, the terminology dictionary and the target format information; The target internationalization configuration file determination module is used to generate an initial translation corresponding to the initial content based on the target prompt words using the target big model, and to determine the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation.
[0013] Thirdly, this application provides an electronic device, comprising: Memory, used to store computer programs; A processor is used to execute the computer program to implement the aforementioned configuration file translation method.
[0014] Fourthly, this application provides a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned configuration file translation method.
[0015] In this application, the following steps are taken: First, a target translation instruction initiated by the user is obtained, and the initial content to be translated in the initial internationalization configuration file is determined based on the target translation instruction. Then, a terminology dictionary corresponding to the initial internationalization configuration file is obtained. This terminology dictionary is constructed based on the first and second terms in the initial internationalization configuration file, where the first term is not translated, and the second term is uniformly translated into the same term. Next, the target format information in the initial content is parsed, and target prompt words are generated based on the initial content, the terminology dictionary, and the target format information. Finally, an initial translation corresponding to the initial content is generated using a target big model based on the target prompt words, and the target internationalization configuration file obtained by translating the initial internationalization configuration file is determined based on the initial translation. As can be seen, this application first obtains the user's target translation instruction and determines the initial content to be translated in the initial internationalization configuration file according to the target translation instruction. Then, a terminology dictionary corresponding to the initial internationalization configuration file is obtained. This terminology dictionary is constructed based on the first term in the initial internationalization configuration file that does not need to be translated and the second term that needs to be uniformly translated into the same term, ensuring the standardized use of professional terminology. Then, the target format information in the initial content is parsed, and target prompt words are generated by combining the initial content, the terminology dictionary, and the target format information to clarify the translation rules and format requirements. Finally, the target big model is used to generate the initial translation corresponding to the initial content based on the target prompts. Based on the initial translation, a target internationalization configuration file that meets the structural requirements and has a complete format is obtained. In this way, this application uses translation instructions to accurately determine the initial content to be translated in the initial internationalization configuration file, standardizes the use of terminology through a terminology dictionary, and parses the target format information in the initial content. Then, using the initial content, terminology dictionary, and target format information, target prompts are customized. The target big model is then used to accurately generate the initial translation corresponding to the initial content based on the target prompts. This effectively avoids problems such as inconsistent terminology and error-prone formatting in traditional translation, significantly improving the accuracy and efficiency of configuration file translation, while ensuring the usability of the translated files, adapting to the multilingual adaptation needs of overseas applications, especially cybersecurity products, and reducing the cost and risk of iterative updates. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0017] Figure 1 A flowchart of a configuration file translation method provided in this application; Figure 2A flowchart illustrating a specific configuration file translation method provided in this application; Figure 3 A schematic diagram of a configuration file translation device provided in this application; Figure 4 This application provides a structural diagram of an electronic device. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] In the context of globalization in software development, overseas applications, especially cybersecurity SaaS platforms, need to support multilingual adaptation. i18n configuration files have become the core carrier for managing multilingual documentation. These files often exist in key-value pair format and frequently contain nested structures, code placeholders, and other formatting elements. Furthermore, the cybersecurity field demands extremely high accuracy and consistency in the translation of specialized terminology. Current technologies, such as traditional API translation and manual proofreading, rely on machine translation of initial drafts and manual review. However, due to the batch and individual nature of translation tasks and the lack of unified terminology standards, multiple translations of the same specialized term can occur. Translators are often unfamiliar with technical details, easily mistranslating or damaging formatting elements, leading to program errors. Incremental updates also face the dilemma of either "translating only changed content and losing context" or "excessively high cost of full translation." While using LLM translation directly is more convenient, it is limited by the probabilistic generation characteristics of large models, making it difficult to guarantee terminology consistency across batches. Format protection relies on prompts, which are unreliable, and may also mistranslate configuration file keys or alter the file structure, similarly failing to solve the incremental update problem. The translation of i18n configuration files must simultaneously meet the requirements of 100% consistent terminology, complete and undamaged format, unchanged configuration structure, and efficient incremental updates. Existing technologies all address this with a "text translation" approach, which cannot meet these requirements. Therefore, this application provides a configuration file translation solution that can efficiently, accurately, and securely translate i18n configuration files.
[0020] See Figure 1 As shown, this embodiment of the invention discloses a configuration file translation method, which may include: Step S11: Obtain the target translation instruction initiated by the user, and determine the initial content to be translated in the initial internationalization configuration file based on the target translation instruction.
[0021] In this embodiment, a user-initiated target translation command is first obtained. This command controls whether the initial internationalization configuration file is translated fully or incrementally. Then, based on the target translation command, the initial content to be translated in the initial internationalization configuration file is determined. Specifically, if the target translation command is for full translation, the initial internationalization configuration file is directly determined as the initial content. If the target translation command is for incremental translation, the initial internationalization configuration file and the translated file are compared, and the initial content is determined based on the comparison result. The translated file is the latest translated file obtained from translating the initial internationalization configuration file. Specifically, if the target translation command is for full translation, the entire initial internationalization configuration file is used as the initial content to be translated; if the target translation command is for incremental translation, the initial internationalization configuration file and the latest translated file are compared, and the initial content to be translated in the initial internationalization configuration file is determined based on the comparison result.
[0022] In one specific implementation, in order to determine the initial content to be translated during incremental translation, the specific process may include: first, based on the comparison results, determining whether the translated file is missing content from the initial internationalization configuration file; if so, determining the corresponding missing content from the initial internationalization configuration file; then, determining whether there is any changed content in the initial internationalization configuration file; if so, determining the corresponding changed content from the initial internationalization configuration file; finally, determining the initial content based on the missing content and the changed content.
[0023] Specifically, the comparison results between the initial internationalization configuration file and the latest translation file are shown below: Add key: If the initial internationalization configuration file exists but the translation file does not, then there is missing content, marked as "needs translation"; Modify key: If the value of the initial internationalization configuration file changes, there is a change, marked as "needs to be retranslated"; Delete key: If the initial internationalization configuration file has been deleted but the translation file still exists, there is redundant content, which is marked as "auto-delete". Unchanged key: If the values in the initial internationalization configuration file and the translation file both exist and have not changed, then it is marked as "Preserve original translation".
[0024] In this way, only the keys marked as "need to be translated" and "need to be re - translated" are used as the initial content, and only the missing content and changed content are translated to save translation costs and time. It should be noted that the core logic in this embodiment is to process "key - value" pairs. For different file formats, such as JSON, YAML, properties, XML, etc., different file parsers can be replaced to determine the initial content to be translated, and different recombiners can be replaced to determine the final translated file.
[0025] Step S12: Obtain the terminology dictionary corresponding to the initial internationalization configuration file; the terminology dictionary is a dictionary constructed based on the first terms and second terms in the initial internationalization configuration file, where the first terms are not translated, and the second terms are uniformly translated into the same translation.
[0026] In this embodiment, a terminology manager is designed. By actively managing the terminology dictionary, it ensures with 100% consistency in the translation of professional terms across all batches and all languages. To construct the terminology dictionary, the specific process can include: First, use the target large - model to analyze the initial internationalization configuration file to detect the first terms and the second terms in the initial internationalization configuration file; then generate the unified translation corresponding to the second terms, and construct the terminology dictionary based on the first terms, the second terms, and the unified translation corresponding to the second terms.
[0027] Specifically, call the LLM to analyze the initial internationalization configuration file, such as en.json, and automatically detect two types of terms in the initial internationalization configuration file, as follows: The first terms, that is, reserved terms: words that should never be translated, such as technical standards CVE, SAML; The second terms, that is, consistency terms: business vocabulary that must be uniformly translated, such as vulnerability, hreat, incident, ZeroTrust, etc.
[0028] After that, generate the unified translation corresponding to the second terms, such as {"vulnerability": "漏洞", "threat":"威胁", "ZeroTrust": "零信任"}, and save the first terms, the second terms, and the unified translation corresponding to the second terms as a manually editable terminology dictionary file, such as terminology.json.
[0029] Step S13: Parse the target format information in the initial content, and generate a target prompt word based on the initial content, the terminology dictionary, and the target format information.
[0030] In this embodiment, a format protector is designed to protect non-text elements contained in the configuration file values and reduce translation errors. First, the target format information in the initial content should be parsed. The specific process may include: using a preset regular expression or a preset format parser to parse the target format information in the initial content; the target format information includes placeholders, HTML tags, URL tags, and Markdown tags. Specifically, before translation, a preset regular expression or a preset format parser is used to extract all format elements that need to be protected in the initial content to obtain the target format information. Supported formats are as follows: (1) Placeholders: {var}, {{count}}, %s, etc.
[0031] (2) HTML tags: , wait.
[0032] (3) URL tags and Markdown tags.
[0033] For example, for the initial content: "Found {count} vulnerabilities! See" list The target format information is extracted as: {count}. 、 .
[0034] It should be noted that this embodiment can generate target prompts based on initial content, a terminology dictionary, and target format information. Specifically, target format information is injected into the target prompt, Prompt, explicitly requiring the LLM to retain these format elements as is. A terminology dictionary is also injected into the target prompt, serving as a translation rule that the LLM must strictly adhere to. An example of a Prompt is shown below: [Terminology Dictionary - Must be strictly followed] - vulnerability → vulnerability (uniform translation, no other words may be used) - threat → threat (uniform translation, no other words may be used) - CVE → CVE (reserved, do not translate), [Initial Content]...etc.
[0035] The translation effect of LLM: ensure that "New vulnerability found" is always translated as "discover new vulnerabilities" rather than "discover new weaknesses".
[0036] Step S14: Use the target big model to generate the initial translation corresponding to the initial content based on the target prompt words, and determine the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation.
[0037] In this embodiment, a reflection engine is designed to output a high-quality translation through three steps: translation, reflection, and improvement. To utilize the target big model to generate an initial translation based on target prompts, the specific process may include: first, translating the initial content using the target big model to generate corresponding translated content; then, evaluating the translated content using the target big model based on the target prompts, generating corresponding improvement suggestions based on the evaluation results, and finally generating the initial translation based on the evaluation results and the improvement suggestions.
[0038] It should be noted that, in order to utilize the target large model to translate the initial content and generate the corresponding translated content, in one specific implementation, if the target translation instruction is a full translation, the initial content is directly translated using the target large model to generate the translated content; in another specific implementation, if the target translation instruction is an incremental translation, the context corresponding to the initial content in the initial internationalization configuration file is determined, and the initial content is translated using the target large model based on the context to generate the translated content.
[0039] Specifically, if the target translation instruction is full translation, directly use the target large model to translate the initial content to generate the translation content. If the target translation instruction is incremental translation, to solve the problem of "lost context" in incremental translation, when translating the initial content, the context of the initial content in the initial internationalization configuration file, that is, the content "not modified around" the initial content in the initial internationalization configuration file, needs to be used as a reference and input into the LLM to help understand the context, so as to use the target large model to translate the initial content based on the context to generate the translation content. For example: "Welcome to {app_name}", submit it to the LLM to generate the translation content: "Welcome to use {app_name}". Then, call the same LLM or other LLM again to reflect on the translation content: switch the role to "expert reviewer", and use the target prompt as the reflection prompt, asking the LLM to review the translation content, evaluate the translation content from four dimensions of accuracy, fluency, style, and terminology, and generate improvement suggestions based on the evaluation results, such as: Style: Can be improved; Although "Welcome to use" is accurately translated, "Welcome to" can better convey a warm and friendly welcome atmosphere... etc. Finally, improve the translation content: use the evaluation results and improvement suggestions as the context, and use the LLM to generate the initial translation corresponding to the initial content.
[0040] In this embodiment, before determining the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation, it may further include: verifying whether the format information of the initial translation is consistent with the target format information, so that when the format information of the initial translation is consistent with the target format information, determining the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation.
[0041] Specifically, obtain the initial translation output by the LLM, for example: "Found {count} vulnerabilities! View List ". Automatically verify whether the format information of the initial translation is exactly the same as the target format information, and when they are the same, determine the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation; if they are not the same, such as {count} is missing, automatically retry.
[0042] In a specific implementation manner, the specific process of determining the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation may be: if the target translation instruction is full translation, directly determine the initial translation as the target internationalization configuration file.
[0043] In another specific implementation, the target internationalization configuration file is determined based on the initial translation. The specific process may include: if the target translation instruction is incremental translation, then based on the comparison results between the initial internationalization configuration file and the translation file, it is determined whether there is redundant content in the translation file; if there is redundant content in the translation file, the redundant content is deleted from the translation file to obtain an updated translation file, and the updated translation file and the initial translation are merged to obtain the target internationalization configuration file; if there is no redundant content in the translation file, the translation file and the initial translation are directly merged to obtain the target internationalization configuration file.
[0044] It should be noted that, see Figure 2 As shown, an AI Agentic system is designed to translate internationalization configuration files. The translation process may specifically include: 1. The user initiates a translation request (full or incremental).
[0045] 2. In the case of incremental translation, the incremental translator performs comparative analysis to determine the initial content to be translated.
[0046] 3. Terminology Manager: Loads the cybersecurity & product terminology dictionary.
[0047] 4. Format protector: Parses the initial content to be translated, extracts format elements, and obtains format information.
[0048] 5. Combine the initial content to be translated, the terminology dictionary, and formatting information into a Prompt.
[0049] 6. The reflection engine performs three steps: "translation → reflection → improvement" to output high-quality translations.
[0050] 7. Format protector, which verifies the format of the translation.
[0051] 8. Generate the target configuration file by merging all translations, or by merging them with the retained old translations.
[0052] In this way, the reflection engine designed in this embodiment simulates the review process of human experts through a "translation-reflection-improvement" cycle, which can proactively discover and correct awkward expressions and stylistic issues in the translated content; the terminology manager designed in this embodiment forces the LLM to use unified terminology through "automatic detection, generation of terminology dictionary, and prompt injection", which fundamentally solves the problem of inconsistent cybersecurity terminology and improves the professionalism of the product; the format protector designed in this embodiment ensures 100% integrity of format information through a closed loop of "extracting format information, prompt injection, and verifying format information", which guarantees that the translated configuration file is "safe and usable" in engineering.
[0053] As can be seen from the above, this embodiment first obtains the user-initiated target translation instruction and determines the initial content to be translated in the initial internationalization configuration file based on the target translation instruction; then, it obtains the terminology dictionary corresponding to the initial internationalization configuration file; the terminology dictionary is a dictionary constructed based on the first term and the second term in the initial internationalization configuration file, where the first term is not translated, and the second term is uniformly translated into the same translation; subsequently, it parses the target format information in the initial content and generates target prompt words based on the initial content, the terminology dictionary, and the target format information; finally, it uses a target big model to generate the initial translation corresponding to the initial content based on the target prompt words, and determines the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation. As can be seen from the above, this embodiment first obtains the user's target translation instruction and determines the initial content to be translated in the initial internationalization configuration file based on the target translation instruction. Then, it obtains the terminology dictionary corresponding to the initial internationalization configuration file, which is constructed based on the first term in the initial internationalization configuration file that does not need to be translated and the second term that needs to be uniformly translated into the same translation, ensuring the standardized and consistent use of professional terminology. Subsequently, the target format information in the initial content is parsed, and then target prompts are generated by combining the initial content, terminology dictionary, and target format information to clarify the translation rules and format requirements. Finally, the target big model is used to generate the initial translation corresponding to the initial content based on the target prompts, and the target internationalization configuration file that meets the structural requirements and has a complete format is obtained based on the initial translation. In this way, this embodiment uses translation instructions to accurately determine the initial content to be translated in the initial internationalization configuration file, standardizes the use of terminology through a terminology dictionary, and parses the target format information in the initial content. Then, the target prompts are customized with the initial content, terminology dictionary, and target format information, and the target big model is used to accurately generate the initial translation corresponding to the initial content based on the target prompts. This effectively avoids problems such as inconsistent terminology and easy formatting errors in traditional translation, greatly improves the accuracy and efficiency of configuration file translation, and ensures the usability of the translated file, adapting to the multilingual adaptation needs of overseas applications, especially network security products, and reducing the cost and risk of iterative updates.
[0054] Accordingly, see Figure 3 As shown in the embodiments of this application, a configuration file translation device is also provided, which may include: The target translation instruction acquisition module 11 is used to acquire the target translation instruction initiated by the user and determine the initial content to be translated in the initial internationalization configuration file based on the target translation instruction; The terminology dictionary acquisition module 12 is used to acquire the terminology dictionary corresponding to the initial internationalization configuration file; the terminology dictionary is a dictionary built based on the first term and the second term in the initial internationalization configuration file, the first term is not translated, and the second term is uniformly translated into the same translation; The target prompt word generation module 13 is used to parse the target format information in the initial content and generate target prompt words based on the initial content, the terminology dictionary and the target format information; The target internationalization configuration file determination module 14 is used to generate an initial translation corresponding to the initial content based on the target prompt words using the target big model, and to determine the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation.
[0055] In some specific implementations, the target translation instruction is a full translation or an incremental translation; Accordingly, the target translation instruction acquisition module 11 may include: The first initial content determination submodule is used to directly determine the initial internationalization configuration file as the initial content if the target translation instruction is a full translation. The second initial content determination submodule is used to compare the initial internationalization configuration file and the translation file if the target translation instruction is an incremental translation, and determine the initial content based on the comparison result; the translation file is the latest translation file obtained by translating the initial internationalization configuration file.
[0056] In some specific implementations, the second initial content determination submodule may include: The missing content determination unit is used to determine, based on the comparison result, whether the translated file is missing content from the initial internationalization configuration file; if so, to determine the corresponding missing content from the initial internationalization configuration file. The change content determination unit is used to determine whether there is any changed content in the initial internationalization configuration file; if so, it determines the corresponding changed content from the initial internationalization configuration file. The second initial content determination unit is used to determine the initial content based on the missing content and the changed content.
[0057] In some specific embodiments, the configuration file translation device may further include: The terminology detection module is used to analyze the initial internationalization configuration file using the target large model to detect the first term and the second term in the initial internationalization configuration file; The terminology dictionary construction module is used to generate a unified translation corresponding to the second term, and to construct the terminology dictionary based on the first term, the second term, and the unified translation corresponding to the second term.
[0058] In some specific embodiments, the target prompt word generation module 13 may include: The target format information parsing unit is used to parse the target format information in the initial content using a preset regular expression or a preset format parser; the target format information includes placeholders, HTML tags, URL tags, and Markdown tags.
[0059] In some specific embodiments, the target internationalization configuration file determination module 14 may include: The translation content generation submodule is used to translate the initial content using the target large model to generate corresponding translated content; The initial translation generation submodule is used to evaluate the translation content based on the target prompt words using the target big model, generate corresponding improvement suggestions based on the evaluation results, and generate the initial translation corresponding to the initial content based on the evaluation results and the improvement suggestions. Accordingly, the translation content generation submodule may include: The translation content generation unit is used to directly translate the initial content using the target large model if the target translation instruction is a full translation, so as to generate the translated content. The context determination unit is used to determine the context corresponding to the initial content in the initial internationalization configuration file if the target translation instruction is an incremental translation, and to translate the initial content based on the context using the target big model to generate the translated content.
[0060] In some specific embodiments, the configuration file translation device may further include: A format information verification unit is used to verify whether the format information of the initial translation is consistent with the target format information, so that when the format information of the initial translation is consistent with the target format information, the target internationalization configuration file obtained by translating the initial internationalization configuration file is determined based on the initial translation. Accordingly, the target internationalization configuration file determination module 14 may include: The target internationalization configuration file determination unit is used to directly determine the initial translation as the target internationalization configuration file if the target translation instruction is a full translation. A redundant content determination unit is used to determine whether there is redundant content in the translation file based on the comparison result between the initial internationalization configuration file and the translation file if the target translation instruction is an incremental translation. The redundant content deletion unit is used to delete the redundant content from the translation file if there is redundant content in the translation file to obtain an updated translation file, and to merge the updated translation file and the initial translation to obtain the target internationalization configuration file. The translation merging unit is used to directly merge the translation file and the initial translation if there is no redundant content in the translation file, so as to obtain the target internationalization configuration file.
[0061] Furthermore, embodiments of this application also disclose an electronic device, Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the configuration file translation method disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0062] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0063] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0064] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the configuration file translation method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0065] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned disclosed configuration file translation method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0066] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0067] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0068] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0069] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0070] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for translating configuration files, characterized in that, include: Obtain the target translation instruction initiated by the user, and determine the initial content to be translated in the initial internationalization configuration file based on the target translation instruction; Obtain the terminology dictionary corresponding to the initial internationalization configuration file; the terminology dictionary is a dictionary built based on the first term and the second term in the initial internationalization configuration file, the first term is not translated, and the second term is uniformly translated into the same translation; The target format information in the initial content is parsed, and target prompt words are generated based on the initial content, the terminology dictionary, and the target format information; The target big model is used to generate an initial translation corresponding to the initial content based on the target prompt words, and the target internationalization configuration file is determined by translating the initial internationalization configuration file based on the initial translation.
2. The configuration file translation method according to claim 1, characterized in that, The target translation instruction is either full translation or incremental translation; Accordingly, determining the initial content to be translated in the initial internationalization configuration file based on the target translation instructions includes: If the target translation instruction is a full translation, then the initial internationalization configuration file is directly determined as the initial content; If the target translation instruction is an incremental translation, then the initial internationalization configuration file and the translation file are compared, and the initial content is determined based on the comparison result; the translation file is the latest translation file obtained by translating the initial internationalization configuration file.
3. The configuration file translation method according to claim 2, characterized in that, Determining the initial content based on the comparison results includes: Based on the comparison results, determine whether the translated file is missing content from the initial internationalization configuration file; if so, determine the corresponding missing content from the initial internationalization configuration file. Determine whether there are any changes in the initial internationalization configuration file; if so, determine the corresponding changes from the initial internationalization configuration file. The initial content is determined based on the missing content and the changed content.
4. The configuration file translation method according to claim 1, characterized in that, Before obtaining the terminology dictionary corresponding to the initial internationalization configuration file, the process also includes: The initial internationalization configuration file is analyzed using the target large model to detect the first term and the second term in the initial internationalization configuration file; Generate a unified translation corresponding to the second term, and construct the terminology dictionary based on the first term, the second term, and the unified translation corresponding to the second term.
5. The configuration file translation method according to claim 1, characterized in that, The parsing of the target format information in the initial content includes: The target format information in the initial content is parsed using a preset regular expression or a preset format parser; the target format information includes placeholders, HTML tags, URL tags, and Markdown tags.
6. The configuration file translation method according to any one of claims 1 to 5, characterized in that, The process of generating an initial translation corresponding to the initial content based on the target prompt words using a target large model includes: The initial content is translated using the target large model to generate corresponding translated content; The target big model is used to evaluate the translation content based on the target prompt words, and corresponding improvement suggestions are generated based on the evaluation results. The initial translation corresponding to the initial content is generated based on the evaluation results and the improvement suggestions. Accordingly, the process of translating the initial content using the target large model to generate corresponding translated content includes: If the target translation instruction is a full translation, then the initial content is directly translated using the target large model to generate the translated content; If the target translation instruction is incremental translation, then the context corresponding to the initial content in the initial internationalization configuration file is determined, and the initial content is translated based on the context using the target big model to generate the translated content.
7. The configuration file translation method according to claim 3, characterized in that, Before determining the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation, the method further includes: Verify whether the format information of the initial translation is consistent with the target format information, so that when the format information of the initial translation is consistent with the target format information, determine the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation; Accordingly, determining the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation includes: If the target translation instruction is a full translation, then the initial translation is directly determined as the target internationalization configuration file; If the target translation instruction is an incremental translation, then based on the comparison result between the initial internationalization configuration file and the translation file, it is determined whether there is redundant content in the translation file; If there is redundant content in the translation file, the redundant content is deleted from the translation file to obtain an updated translation file, and the updated translation file and the initial translation are merged to obtain the target internationalization configuration file; If there is no redundant content in the translation file, the translation file and the initial translation are directly merged to obtain the target internationalization configuration file.
8. A configuration file translation device, characterized in that, include: The target translation instruction acquisition module is used to acquire the target translation instruction initiated by the user and determine the initial content to be translated in the initial internationalization configuration file based on the target translation instruction; The terminology dictionary acquisition module is used to acquire the terminology dictionary corresponding to the initial internationalization configuration file; the terminology dictionary is a dictionary built based on the first term and the second term in the initial internationalization configuration file, the first term is not translated, and the second term is uniformly translated into the same translation; The target prompt word generation module is used to parse the target format information in the initial content and generate target prompt words based on the initial content, the terminology dictionary and the target format information; The target internationalization configuration file determination module is used to generate an initial translation corresponding to the initial content based on the target prompt words using the target big model, and to determine the target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation.
9. An electronic device, characterized in that, The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the configuration file translation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store computer programs, which, when executed by a processor, implement the configuration file translation method as described in any one of claims 1 to 7.