Search

CN-122021673-A - Configuration file translation method, device, equipment and storage medium

CN122021673ACN 122021673 ACN122021673 ACN 122021673ACN-122021673-A

Abstract

The application discloses a configuration file translation method, a device, equipment and a storage medium, which relate to the technical field of file translation and comprise the steps of obtaining a target translation instruction initiated by a user and determining initial contents to be translated in an initial internationalized configuration file based on the target translation instruction; the method comprises the steps of obtaining a term dictionary corresponding to an initial internationalization configuration file, wherein the term dictionary is a dictionary constructed based on first terms and second terms in the initial internationalization configuration file, the first terms are not translated, the second terms are translated into identical translations in a unified mode, analyzing target format information in initial contents and generating target prompt words based on the initial contents, the term dictionary and the target format information, generating initial translations corresponding to the initial contents based on the target prompt words by utilizing a target large model, and determining target internationalization configuration files obtained by translating the initial internationalization configuration file based on the initial translations. The method can efficiently, accurately and safely complete the translation of the structured i18n configuration file.

Inventors

  • ZHANG DELIN
  • DU DONGFANG
  • LIU BO

Assignees

  • 杭州安恒信息技术股份有限公司

Dates

Publication Date
20260512
Application Date
20260203

Claims (10)

  1. 1. A method for translating a configuration file, comprising: Acquiring a target translation instruction initiated by a user, and determining initial contents to be translated in an initial internationalization configuration file based on the target translation instruction; The method comprises the steps of obtaining a term dictionary corresponding to an initial internationalization configuration file, wherein the term dictionary is constructed based on first terms and second terms in the initial internationalization configuration file, the first terms are not translated, and the second terms are uniformly translated into the same translation; Analyzing target format information in the initial content, and generating target prompt words based on the initial content, the term dictionary and the target format information; And generating an initial translation corresponding to the initial content based on the target prompt word by using a target big model, and determining a target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation.
  2. 2. The profile translation method according to claim 1, wherein the target translation instruction is a full-scale translation or an incremental translation; correspondingly, the determining the initial content to be translated in the initial internationalization configuration file based on the target translation instruction comprises the following steps: If the target translation instruction is full translation, directly determining the initialization internationalization configuration file as the initial content; and if the target translation instruction is incremental translation, comparing the initial internationalized configuration file with a translation file, and determining the initial content based on the comparison result, wherein the translation file is the latest translation file obtained by translating the initial internationalized configuration file.
  3. 3. The profile translation method according to claim 2, wherein the determining the initial content based on the comparison result comprises: based on the comparison result, determining whether the translated text file lacks the content in the initial internationalization configuration file, if so, determining the corresponding missing content from the initial internationalization configuration file; determining whether modified contents exist in the initial internationalization configuration file, if so, determining corresponding modified contents from the initial internationalization configuration file; The initial content is determined based on the missing content and the altered content.
  4. 4. The method for translating a configuration file according to claim 1, further comprising, before the step of obtaining the term dictionary corresponding to the initial internationalized configuration file: Analyzing the initial internationalization configuration file with the target large model to detect the first term and the second term in the initial internationalization configuration file; and generating unified translations corresponding to the second term, and constructing the term dictionary based on the first term, the second term and the unified translations corresponding to the second term.
  5. 5. The method of claim 1, wherein said parsing the target format information in the initial content comprises: And analyzing target format information in the initial content by using a preset regular expression or a preset format analyzer, wherein the target format information comprises a placeholder, an HTML tag, a URL tag and a MarkDown tag.
  6. 6. The method for translating a configuration file according to any one of claims 1 to 5, wherein generating an initial translation corresponding to the initial content based on the target prompt word by using a target big model includes: Translating the initial content by utilizing the target big model to generate corresponding translated content; evaluating the translation content based on the target prompt word by utilizing the target big model, generating corresponding improvement suggestions based on an evaluation result, and generating the initial translation corresponding to the initial content based on the evaluation result and the improvement suggestions; correspondingly, the translating the initial content by using the target big model to generate corresponding translated content comprises the following steps: if the target translation instruction is full translation, directly translating the initial content by using the target big model to generate the translation content; and if the target translation instruction is incremental translation, determining a corresponding context of the initial content in the initial internationalization configuration file, and translating the initial content based on the context by utilizing the target big model so as to generate the translation content.
  7. 7. The method for translating a configuration file according to claim 3, wherein before determining a target internationalized configuration file translated from the initial internationalized configuration file based on the initial translation, the method further comprises: Verifying whether the format information of the initial translation is consistent with the target format information or not, so that when the format information of the initial translation is consistent with the target format information, the target internationalized profile obtained by translating the initial internationalized profile is determined based on the initial translation; Correspondingly, the determining, based on the initial translation, the target internationalization configuration file obtained by translating the initial internationalization configuration file includes: if the target translation instruction is full translation, directly determining the initial translation as the target internationalization configuration file; If the target translation instruction is incremental translation, determining whether redundant content exists in the translation file based on the comparison result between the initial internationalized configuration file and the translation file; If redundant content exists in the translated document, deleting the redundant content from the translated document to obtain an updated translated document, and merging the updated translated document with the initial translated document to obtain the target internationalized configuration file; If the translated text file does not have redundant content, the translated text file and the initial translated text file are directly combined to obtain the target internationalized configuration file.
  8. 8. A profile translation apparatus, comprising: The target translation instruction acquisition module is used for acquiring a target translation instruction initiated by a user and determining initial contents to be translated in an initial internationalization configuration file based on the target translation instruction; the term dictionary acquisition module is used for acquiring a term dictionary corresponding to the initial internationalization configuration file, wherein the term dictionary is constructed based on first terms and second terms in the initial internationalization configuration file, the first terms are not translated, and the second terms are uniformly translated into the same translation; the target prompt word generation module is used for analyzing target format information in the initial content and generating target prompt words based on the initial content, the term dictionary and the target format information; And the target internationalization configuration file determining module is used for generating an initial translation corresponding to the initial content based on the target prompt word by utilizing a target big model and determining a target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation.
  9. 9. An electronic device comprising a processor and a memory, wherein the memory is configured to store a computer program that is loaded and executed by the processor to implement the profile translation method of any one of claims 1-7.
  10. 10. A computer readable storage medium for storing a computer program which when executed by a processor implements the profile translation method of any one of claims 1 to 7.

Description

Configuration file translation method, device, equipment and storage medium Technical Field The present invention relates to the field of file translation technologies, and in particular, to a method, an apparatus, a device, and a storage medium for translating a configuration file. Background Under the globalization trend of Software development, a sea-going application, especially a network security class SaaS (Software as a service) AS A SERVICE platform needs to support multilingual adaptation, and an i18n (Internationalization ) configuration file becomes a core carrier for managing multilingual documents. The files usually exist in the form of key value pairs and often contain format elements such as nested structures, code placeholders and the like, and the translation accuracy and consistency of the technical terms in the field of network security are extremely high. In the prior art, the traditional API (Application Programming Interface ) translation and manual color scheme completes work through machine translation draft and manual correction, but the translation task is executed in batches and by individuals, and lacks unified term standards, so that multiple translation methods appear in the same professional term, the translator is often unfamiliar with technical details, format elements are easy to mistranslate or destroy, program error is caused, and the incremental update faces the dilemma of 'only translating and changing content lost context' or 'full translation cost is too high'. The scheme of directly using LLM (Large Language Model ) translation is more convenient, but is limited by the probabilistic generation characteristic of the large model, the term consistency during batch translation cannot be ensured, the format protection depends on prompt words and has insufficient reliability, the keys of configuration files can be misinterpreted or the file structure can be changed, and the incremental updating difficulty is difficult to solve. The translation of the i18n configuration file needs to meet the requirements of 100% consistency, complete and nondestructive format, unchanged configuration structure and efficient incremental updating, and the prior art is dealt with by a text translation idea and cannot meet the requirements. In summary, how to efficiently, accurately and safely complete the translation of the structured i18n configuration file is a technical problem to be solved at present. Disclosure of Invention In view of the above, the present invention aims to provide a method, a device and a storage medium for translating configuration files, which can efficiently, accurately and safely translate a configuration file of i18 n. The specific scheme is as follows: in a first aspect, the present application provides a method for translating a configuration file, including: Acquiring a target translation instruction initiated by a user, and determining initial contents to be translated in an initial internationalization configuration file based on the target translation instruction; The method comprises the steps of obtaining a term dictionary corresponding to an initial internationalization configuration file, wherein the term dictionary is constructed based on first terms and second terms in the initial internationalization configuration file, the first terms are not translated, and the second terms are uniformly translated into the same translation; Analyzing target format information in the initial content, and generating target prompt words based on the initial content, the term dictionary and the target format information; And generating an initial translation corresponding to the initial content based on the target prompt word by using a target big model, and determining a target internationalization configuration file obtained by translating the initial internationalization configuration file based on the initial translation. Optionally, the target translation instruction is full translation or incremental translation; correspondingly, the determining the initial content to be translated in the initial internationalization configuration file based on the target translation instruction comprises the following steps: If the target translation instruction is full translation, directly determining the initialization internationalization configuration file as the initial content; and if the target translation instruction is incremental translation, comparing the initial internationalized configuration file with a translation file, and determining the initial content based on the comparison result, wherein the translation file is the latest translation file obtained by translating the initial internationalized configuration file. Optionally, the determining the initial content based on the comparison result includes: based on the comparison result, determining whether the translated text file lacks the content in the initial internationalization configuration file, if so, de