[go: up one dir, main page]

CN110134586A - Code fragment correction method, device, computer equipment and storage medium - Google Patents

Code fragment correction method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN110134586A
CN110134586A CN201910296104.4A CN201910296104A CN110134586A CN 110134586 A CN110134586 A CN 110134586A CN 201910296104 A CN201910296104 A CN 201910296104A CN 110134586 A CN110134586 A CN 110134586A
Authority
CN
China
Prior art keywords
code
corrected
translated
file
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910296104.4A
Other languages
Chinese (zh)
Inventor
邹檬帆
计波
方秉纲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
Original Assignee
OneConnect Smart Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Smart Technology Co Ltd filed Critical OneConnect Smart Technology Co Ltd
Priority to CN201910296104.4A priority Critical patent/CN110134586A/en
Priority to SG11201907509XA priority patent/SG11201907509XA/en
Priority to PCT/CN2019/091835 priority patent/WO2020206839A1/en
Publication of CN110134586A publication Critical patent/CN110134586A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/362Debugging of software
    • G06F11/3624Debugging of software by performing operations on the source code, e.g. via a compiler

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Machine Translation (AREA)

Abstract

本申请涉及一种代码片段纠正方法、装置、计算机设备和存储介质。该方法包括:读取代码纠正配置文件;代码纠正配置文件中包含待纠正源代码文件路径和目标翻译细节报表路径;根据待纠正源代码文件路径获取待纠正源代码文件;根据目标翻译细节报表文件路径获取目标翻译细节报表;目标翻译细节报表中包含多个目标纠正项目以及与每个目标纠正项目对应的片段定位信息;遍历目标翻译细节报表中的每个目标纠正项目,按照每个目标纠正项目对应的片段定位信息对待纠正源代码文件进行纠正处理,生成纠正后源代码文件。采用本方法通过代码质量工具,能够提高代码片段纠正结果可靠性。

The present application relates to a code fragment correction method, device, computer equipment and storage medium. The method includes: reading the code correction configuration file; the code correction configuration file includes the source code file path to be corrected and the target translation detail report path; obtaining the source code file to be corrected according to the source code file path to be corrected; according to the target translation detail report file Path to obtain the target translation detail report; the target translation detail report contains multiple target correction items and the segment positioning information corresponding to each target correction item; traverse each target correction item in the target translation detail report, and correct each target item The source code file to be corrected is corrected for the corresponding segment positioning information, and the corrected source code file is generated. Using the method through the code quality tool can improve the reliability of code fragment correction results.

Description

代码片段纠正方法、装置、计算机设备和存储介质Code fragment correction method, device, computer equipment and storage medium

技术领域technical field

本申请涉及计算机技术领域,特别是涉及一种代码片段纠正方法、装置、计算机设备和存储介质。The present application relates to the field of computer technology, in particular to a code segment correction method, device, computer equipment and storage medium.

背景技术Background technique

随着国际化的日益深入发展,已开发的软件系统会面临面向世界不同地区和国家的需求,因此需要将软件系统的源代码从原始语言翻译为特定语言。传统方式中,通常是由业务分析人员收集翻译需求并写入文档,然后交与程序开发人员依据文档对源代码进行修改。然而传统的代码国际化翻译过程需要业务分析人员与开发人员进行合作完成,时间成本和人力成本高,且开发人员将业务分析人员的翻译思路落实到实践中时容易出现翻译错误。若由开发人员人工对翻译后的源代码文件进行全面核验修改,工作量较大且容易出现遗漏,从而导致代码片段纠正结果可靠性差。With the deepening of internationalization, the developed software system will face the needs of different regions and countries in the world, so it is necessary to translate the source code of the software system from the original language to a specific language. In the traditional way, business analysts usually collect translation requirements and write them into documents, and then hand them over to program developers to modify the source code according to the documents. However, the traditional code internationalization translation process requires the cooperation of business analysts and developers, resulting in high time and labor costs, and translation errors are prone to occur when developers implement the translation ideas of business analysts into practice. If developers manually check and modify the translated source code files, the workload will be large and omissions will easily occur, resulting in poor reliability of the code fragment correction results.

发明内容Contents of the invention

基于此,有必要针对上述技术问题,提供一种能够提高代码片段纠正结果可靠性的代码片段纠正方法、装置、计算机设备和存储介质。Based on this, it is necessary to provide a code fragment correction method, device, computer equipment and storage medium capable of improving the reliability of code fragment correction results for the above technical problems.

一种代码片段纠正方法,所述方法包括:读取代码纠正配置文件;所述代码纠正配置文件中包含待纠正源代码文件路径和目标翻译细节报表路径;根据所述待纠正源代码文件路径获取待纠正源代码文件;根据所述目标翻译细节报表文件路径获取目标翻译细节报表;所述目标翻译细节报表中包含多个目标纠正项目以及与每个目标纠正项目对应的片段定位信息;遍历所述目标翻译细节报表中的每个目标纠正项目,按照每个目标纠正项目对应的片段定位信息对所述待纠正源代码文件进行纠正处理,生成纠正后源代码文件。A method for correcting a code fragment, the method comprising: reading a code correction configuration file; the code correction configuration file includes a source code file path to be corrected and a target translation detail report path; according to the source code file path to be corrected, the The source code file to be corrected; obtain the target translation detail report according to the target translation detail report file path; the target translation detail report contains a plurality of target correction items and segment positioning information corresponding to each target correction item; traverse the For each target correction item in the target translation detail report, the source code file to be corrected is corrected according to the segment positioning information corresponding to each target correction item, and a corrected source code file is generated.

在其中一个实施例中,在所述读取代码纠正配置文件之前,还包括:获取初始翻译细节报表;所述初始翻译细节报表中包含多个待翻译代码片段以及与每个待翻译代码片段对应的翻译后代码片段和片段定位信息,所述多个待翻译代码片段中包含待纠正代码片段;接收基于所述待纠正代码片段和对应的片段定位信息,输入的纠正后代码片段;将每个所述待纠正代码片段和相应的纠正后代码片段作为目标纠正项目;根据多个所述目标纠正项目生成目标翻译细节报表。In one of the embodiments, before reading the code correction configuration file, it further includes: obtaining an initial translation detail report; the initial translation detail report includes a plurality of code fragments to be translated and corresponding to each code fragment to be translated Translated code fragments and fragment positioning information, the plurality of code fragments to be translated include code fragments to be corrected; receiving corrected code fragments input based on the code fragments to be corrected and corresponding fragment positioning information; The code segment to be corrected and the corresponding corrected code segment are used as target correction items; and a target translation detail report is generated according to a plurality of target correction items.

在其中一个实施例中,所述接收基于所述待纠正代码片段和对应的片段定位信息,输入的纠正后代码片段,包括:获取代码跳转指令;所述代码跳转指令对应于所述待纠正代码片段;基于代码跳转指令获取所述待纠正代码片段所属的待纠正代码文件;按照所述待纠正代码片段对应的片段定位信息,跳转展示所述待纠正源代码文件;检测作用于所展示的待纠正源代码文件的代码纠正操作;提取基于所述代码纠正操作得到的纠正后代码片段。In one of the embodiments, the receiving the input corrected code segment based on the code segment to be corrected and the corresponding segment positioning information includes: obtaining a code jump instruction; the code jump instruction corresponds to the to-be-corrected code segment Correcting the code segment; obtaining the code file to be corrected to which the code segment to be corrected belongs based on a code jump instruction; jumping to display the source code file to be corrected according to the segment positioning information corresponding to the code segment to be corrected; The displayed code correction operation of the source code file to be corrected; extracting the corrected code fragment obtained based on the code correction operation.

在其中一个实施例中,所述遍历所述目标翻译细节报表中的每个目标纠正项目,按照每个目标纠正项目对应的片段定位信息对所述待纠正源代码文件进行纠正处理,生成纠正后源代码文件,包括:提取目标翻译细节报表中的每个目标纠正项目对应的待纠正代码片段和相应的纠正后代码片段;按照每个目标纠正项目对应的片段定位信息,在所述待纠正源代码文件中查找所述待纠正代码片段;将所述待纠正源代码文件中的所述待纠正代码片段替换为相应的纠正后代码片段;当检测到执行完对应于所有目标纠正项目的纠正处理时,则重写经过纠正处理后的待纠正源代码文件,得到纠正后源代码文件。In one of the embodiments, each target correction item in the target translation detail report is traversed, and the source code file to be corrected is corrected according to the segment positioning information corresponding to each target correction item, and the corrected source code file is generated. The source code file, including: extracting the code segment to be corrected corresponding to each target correction item in the target translation detail report and the corresponding corrected code segment; according to the segment positioning information corresponding to each target correction item, in the source Find the code segment to be corrected in the code file; replace the code segment to be corrected in the source code file to be corrected with the corresponding corrected code segment; when it is detected that the correction process corresponding to all target correction items has been executed , rewrite the corrected source code file to obtain the corrected source code file.

在其中一个实施例中,所述获取初始翻译细节报表,包括:获取待翻译分析结果集;所述待翻译分析结果集中包含待翻译代码片段,及与所述待翻译代码片段对应的上下文代码片段;查找与所述待翻译代码片段匹配的代码处理器;通过所述代码处理器根据所述上下文代码片段,识别待翻译代码片段的目标语言类型以及翻译策略;通过所述代码处理器调用翻译器接口,得到基于所述翻译策略翻译的与待翻译代码片段对应的目标语言类型的翻译后代码片段;根据所述待翻译代码片段以及与每个待翻译代码片段对应的翻译后代码片段和上下文代码片段,生成初始翻译细节报表。In one of the embodiments, the obtaining the initial translation detail report includes: obtaining the analysis result set to be translated; the analysis result set to be translated includes the code fragment to be translated and the context code fragment corresponding to the code fragment to be translated ; Find a code processor that matches the code segment to be translated; identify the target language type and translation strategy of the code segment to be translated according to the context code segment through the code processor; call the translator through the code processor an interface to obtain translated code fragments of the target language type corresponding to the code fragments to be translated based on the translation strategy; according to the code fragments to be translated and the translated code fragments and context codes corresponding to each code fragment to be translated Fragment, generate initial translation detail report.

在其中一个实施例中,所述获取待翻译分析结果集,包括:获取待翻译源代码文件;读取所述待翻译源代码文件中的源代码目录;所述待翻译源代码目录中包含多个初始文件名;遍历每个所述初始文件名对应的初始代码子文件,筛选出待翻译代码子文件;所述待翻译代码子文件与预设语言类型相匹配;查找与所述预设语言类型匹配的解析器;通过所述解析器对所述待翻译代码子文件进行解析,得到待翻译分析结果集;所述待翻译分析结果集中包含所述待翻译代码子文件中的待翻译代码片段及与待翻译代码片段对应的上下文代码片段。In one of the embodiments, the obtaining the analysis result set to be translated includes: obtaining the source code file to be translated; reading the source code directory in the source code file to be translated; the source code directory to be translated contains multiple initial file name; traverse each initial code subfile corresponding to the initial file name, and filter out the code subfile to be translated; the code subfile to be translated matches the preset language type; search for the preset language A type-matched parser; the parser parses the code subfile to be translated to obtain an analysis result set to be translated; the analysis result set to be translated includes code fragments to be translated in the code subfile to be translated and the context code fragment corresponding to the code fragment to be translated.

一种代码片段纠正装置,所述装置包括:读取模块,用于读取代码纠正配置文件;所述代码纠正配置文件中包含待纠正源代码文件路径和目标翻译细节报表路径;获取模块,用于根据所述待纠正源代码文件路径获取待纠正源代码文件;根据所述目标翻译细节报表文件路径获取目标翻译细节报表;所述目标翻译细节报表中包含多个目标纠正项目以及与每个目标纠正项目对应的片段定位信息;纠正模块,用于遍历所述目标翻译细节报表中的每个目标纠正项目,按照每个目标纠正项目对应的片段定位信息对所述待纠正源代码文件进行纠正处理,生成纠正后源代码文件。A device for correcting code fragments, said device comprising: a reading module for reading a code correction configuration file; said code correction configuration file includes a source code file path to be corrected and a target translation detail report path; an acquisition module for Obtain the source code file to be corrected according to the source code file path to be corrected; obtain the target translation detail report according to the target translation detail report file path; the target translation detail report contains a plurality of target correction items and each target correcting the segment positioning information corresponding to the item; a correcting module, configured to traverse each target correcting item in the target translation detail report, and correct the source code file to be corrected according to the segment positioning information corresponding to each target correcting item , to generate the corrected source code file.

在其中一个实施例中,所述装置还包括生成模块,用于获取初始翻译细节报表;所述初始翻译细节报表中包含多个待翻译代码片段以及与每个待翻译代码片段对应的翻译后代码片段和片段定位信息,所述多个待翻译代码片段中包含待纠正代码片段;接收基于所述待纠正代码片段和对应的片段定位信息,输入的纠正后代码片段;将每个所述待纠正代码片段和相应的纠正后代码片段作为目标纠正项目;根据多个所述目标纠正项目生成目标翻译细节报表。In one of the embodiments, the device further includes a generating module, configured to obtain an initial translation detail report; the initial translation detail report includes a plurality of code fragments to be translated and translated code corresponding to each code fragment to be translated Segment and segment positioning information, the plurality of code segments to be translated include the code segment to be corrected; receiving the corrected code segment input based on the code segment to be corrected and the corresponding segment positioning information; each of the code segments to be corrected The code fragments and the corresponding corrected code fragments are used as target correction items; and a target translation detail report is generated according to the multiple target correction items.

一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述各个实施例中所述的代码片段纠正方法的步骤。A computer device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the steps of the method for correcting code fragments described in the foregoing embodiments are implemented.

一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述各个实施例中所述的代码片段纠正方法的步骤。A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method for correcting code fragments described in the foregoing embodiments are implemented.

上述代码片段纠正方法、装置、计算机设备和存储介质,代码服务器通过读取代码纠正配置文件,从而根据代码纠正配置文件中的待纠正源代码文件路径获取待纠正源代码文件,根据代码纠正配置文件中的目标翻译细节报表文件路径获取目标翻译细节报表。代码服务器可基于目标翻译细节报表中的目标纠正项目按照对应的片段定位信息对待纠正源代码文件准确地进行纠正处理,生成纠正后源代码文件。通过基于目标翻译细节报表自动化对待纠正源代码文件进行自动化纠正处理,能够保证纠正处理的全面性和准确定,从而提高代码片段纠正结果可靠性。The above code fragment correction method, device, computer equipment and storage medium, the code server reads the code correction configuration file, thereby obtaining the source code file to be corrected according to the path of the source code file to be corrected in the code correction configuration file, and according to the code correction configuration file The target translation detail report file path in Get the target translation detail report. The code server can accurately correct the source code file to be corrected based on the target correction items in the target translation detail report according to the corresponding segment positioning information, and generate the corrected source code file. By automatically correcting the source code file to be corrected based on the target translation detail report, the comprehensiveness and accuracy of the correction process can be ensured, thereby improving the reliability of the code fragment correction result.

附图说明Description of drawings

图1为一个实施例中代码片段纠正方法的应用场景图;Fig. 1 is an application scenario diagram of a method for correcting code fragments in an embodiment;

图2为一个实施例中代码片段纠正方法的流程示意图;Fig. 2 is a schematic flow chart of a method for correcting code fragments in an embodiment;

图3为另一个实施例中代码片段纠正方法的流程示意图;Fig. 3 is a schematic flow chart of a method for correcting code fragments in another embodiment;

图4为一个实施例中代码片段纠正装置的结构框图;Fig. 4 is a structural block diagram of a code fragment correcting device in an embodiment;

图5为一个实施例中计算机设备的内部结构图。Figure 5 is an internal block diagram of a computer device in one embodiment.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, and are not intended to limit the present application.

本申请提供的代码片段纠正方法,可以应用于如图1所示的应用环境中。其中,终端102与代码服务器104通过网络进行通信。其中,终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备,代码服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。开发人员在终端102编写了代码纠正配置文件之后,代码服务器104可读取该代码纠正配置文件。代码服务器104可根据代码纠正配置文件中的待纠正源代码文件路径获取待纠正源代码文件。代码服务器104还可根据代码纠正配置文件中的目标翻译细节报表文件路径获取目标翻译细节报表,目标翻译细节报表中包含多个目标纠正项目以及与每个目标纠正项目对应的片段定位信息。代码服务器104通过遍历目标翻译细节报表中每个目标纠正项目的方式,可按照每个目标纠正项目对应的片段定位信息对待纠正源代码文件进行处理,生成纠正后源代码文件。The method for correcting code fragments provided in this application can be applied to the application environment shown in FIG. 1 . Wherein, the terminal 102 communicates with the code server 104 through a network. Among them, the terminal 102 can be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the code server 104 can be realized by an independent server or a server cluster composed of multiple servers. After the developer writes the code correction configuration file on the terminal 102, the code server 104 can read the code correction configuration file. The code server 104 can obtain the source code file to be corrected according to the path of the source code file to be corrected in the code correction configuration file. The code server 104 can also obtain the target translation detail report according to the target translation detail report file path in the code correction configuration file, and the target translation detail report includes multiple target correction items and segment positioning information corresponding to each target correction item. The code server 104 can process the source code file to be corrected according to the segment location information corresponding to each target correction item by traversing each target correction item in the target translation detail report, and generate a corrected source code file.

在一个实施例中,如图2所示,提供了一种代码片段纠正方法,以该方法应用于图1中的代码服务器104为例进行说明,包括以下步骤:In one embodiment, as shown in FIG. 2 , a method for correcting code fragments is provided. The method is applied to the code server 104 in FIG. 1 as an example for illustration, including the following steps:

步骤202,读取代码纠正配置文件;代码纠正配置文件中包含待纠正源代码文件路径和目标翻译细节报表路径。Step 202, read the code correction configuration file; the code correction configuration file includes the source code file path to be corrected and the target translation detail report path.

代码纠正配置文件是指用于对待纠正源代码文件进行纠正处理所依赖的配置文件。开发人员可预先在终端编写代码纠正配置文件,使得代码服务器可以读取代码纠正配置文件。待纠正源代码文件路径是指待纠正源代码文件的存储路径。目标翻译细节报表路径是指目标翻译细节报表的存储路径。The code correction configuration file refers to the configuration file that is used to correct the source code file to be corrected. Developers can pre-write the code correction configuration file on the terminal, so that the code server can read the code correction configuration file. The source code file path to be corrected refers to the storage path of the source code file to be corrected. The target translation detail report path refers to the storage path of the target translation detail report.

在一个实施例中,代码服务器可读取代码纠正配置文件中的待纠正源代码文件路径和目标翻译细节报表路径等配置参数,对配置参数进行预校验。比如,可校验配置参数的完整性和真实性。当配置参数预校验不通过时,则发送参数错误信息至终端;当配置参数预校验通过时,则进行下一步处理。In one embodiment, the code server can read configuration parameters such as the source code file path to be corrected and the target translation detail report path in the code correction configuration file, and perform pre-verification on the configuration parameters. For example, the integrity and authenticity of configuration parameters can be verified. When the configuration parameter pre-verification fails, the parameter error message is sent to the terminal; when the configuration parameter pre-verification is passed, the next step is processed.

步骤204,根据待纠正源代码文件路径获取待纠正源代码文件。Step 204, obtain the source code file to be corrected according to the path of the source code file to be corrected.

待纠正源代码文件是指需要进行代码片段纠正的源代码文件。待纠正源代码文件可以是待翻译源代码文件通过人工翻译得到的翻译后源代码文件,也可以是通过代码翻译工具进行自动翻译之后得到的翻译后源代码文件。待纠正源代码文件可存储于代码服务器中,也可以存储于终端或其他服务器中,代码服务器可按照待纠正源代码文件路径从终端或其他服务器中获取待纠正源代码文件。The source code file to be corrected refers to the source code file that needs code fragment correction. The source code file to be corrected may be a translated source code file obtained through manual translation of the source code file to be translated, or a translated source code file obtained after automatic translation by a code translation tool. The source code files to be corrected can be stored in the code server, and can also be stored in the terminal or other servers. The code server can obtain the source code files to be corrected from the terminal or other servers according to the path of the source code files to be corrected.

步骤206,根据目标翻译细节报表文件路径获取目标翻译细节报表;目标翻译细节报表中包含多个目标纠正项目以及与每个目标纠正项目对应的片段定位信息。In step 206, the target translation detail report is obtained according to the file path of the target translation detail report; the target translation detail report includes a plurality of target correction items and segment positioning information corresponding to each target correction item.

目标翻译细节报表是指记录了待翻译源代码文件经过翻译处理得到翻译后源代码文件的具体翻译细节的报表。目标翻译细节报表中可包含多个目标纠正项目,一个目标纠正项目对应于待纠正源代码文件中需要进行纠正的一个待纠正代码片段。每个目标纠正项目中包括待纠正代码片段、纠正后代码片段,还可以包括上下文代码片段等。目标翻译细节报表中还包含每个目标纠正项目对应的片段定位信息。The target translation detail report refers to a report that records the specific translation details of the translated source code file obtained through translation processing of the source code file to be translated. The target translation detail report may contain multiple target correction items, and one target correction item corresponds to a code segment to be corrected in the source code file to be corrected. Each target correction item includes code fragments to be corrected, code fragments after correction, and contextual code fragments. The target translation details report also includes segment positioning information corresponding to each target correction item.

片段定位信息是指待纠正代码片段在待纠正源代码文件中的定位信息。比如,特定语法的待纠正代码片段对应有特定的起始字符串和结束字符串,可分别检测起始字符串在待纠正源代码文件中的起始定位信息和结束字符串在在待纠正源代码文件中的结束定位信息,将起始定位信息和结束定位信息作为片段定位信息。The segment positioning information refers to the positioning information of the code segment to be corrected in the source code file to be corrected. For example, the code segment to be corrected with a specific syntax corresponds to a specific start string and end string, and the start location information of the start string in the source code file to be corrected and the end string in the source code file to be corrected can be detected respectively. The end positioning information in the code file uses the start positioning information and the end positioning information as the fragment positioning information.

步骤208,遍历目标翻译细节报表中的每个目标纠正项目,按照每个目标纠正项目对应的片段定位信息对待纠正源代码文件进行纠正处理,生成纠正后源代码文件。Step 208, traversing each target correction item in the target translation detail report, performing correction processing on the source code file to be corrected according to the fragment location information corresponding to each target correction item, and generating a corrected source code file.

可基于目标翻译细节报表中的每个目标纠正项目对应的片段定位信息,在待纠正源代码文件中查找定位到需要进行纠正的待纠正代码片段,从而基于目标纠正项目对定位到的待纠正代码片段进行纠正处理。通过对待纠正源代码文件中所有需要进行的待纠正代码片段进行纠正处理之后,可以生成纠正后源代码文件。Based on the fragment positioning information corresponding to each target correction item in the target translation details report, the code fragment to be corrected can be located in the source code file to be corrected, so that the code to be corrected can be located based on the target correction item Fragments are corrected. After correcting all required code fragments in the source code file to be corrected, a corrected source code file can be generated.

上述代码片段纠正方法中,代码服务器通过读取代码纠正配置文件,从而根据代码纠正配置文件中的待纠正源代码文件路径获取待纠正源代码文件,根据代码纠正配置文件中的目标翻译细节报表文件路径获取目标翻译细节报表。代码服务器可基于目标翻译细节报表中的目标纠正项目按照对应的片段定位信息对待纠正源代码文件准确地进行纠正处理,生成纠正后源代码文件。通过基于目标翻译细节报表自动化对待纠正源代码文件进行自动化纠正处理,能够保证纠正处理的全面性和准确定,从而提高代码片段纠正结果可靠性。In the above code fragment correction method, the code server reads the code correction configuration file to obtain the source code file to be corrected according to the path of the source code file to be corrected in the code correction configuration file, and translates the detailed report file according to the target in the code correction configuration file Path to get target translation details report. The code server can accurately correct the source code file to be corrected based on the target correction items in the target translation detail report according to the corresponding segment positioning information, and generate the corrected source code file. By automatically correcting the source code file to be corrected based on the target translation detail report, the comprehensiveness and accuracy of the correction process can be ensured, thereby improving the reliability of the code fragment correction result.

在一个实施例中,在读取代码纠正配置文件之前,还包括:获取初始翻译细节报表;初始翻译细节报表中包含多个待翻译代码片段以及与每个待翻译代码片段对应的翻译后代码片段和片段定位信息,多个待翻译代码片段中包含待纠正代码片段;接收基于待纠正代码片段和对应的片段定位信息,输入的纠正后代码片段;将每个待纠正代码片段和相应的纠正后代码片段作为目标纠正项目;根据多个目标纠正项目生成目标翻译细节报表。In one embodiment, before reading the code correction configuration file, it further includes: obtaining an initial translation detail report; the initial translation detail report includes a plurality of code fragments to be translated and translated code fragments corresponding to each code fragment to be translated and segment positioning information, multiple code segments to be translated contain the code segment to be corrected; receive the corrected code segment based on the code segment to be corrected and the corresponding segment positioning information; each code segment to be corrected and the corresponding corrected code segment Code snippets as target correction items; generate target translation detail reports based on multiple target correction items.

初始翻译细节报表是指待翻译源代码文件经过自动化翻译处理得到的、记录了翻译细节的报表。待翻译代码片段是指待翻译源代码文件中为原始语言类型的、需要翻译成目标语言类型的代码片段。翻译后代码片段是指待翻译代码片段经过翻译处理得到的目标语言类型的代码片段。在进行自动化翻译处理时,由于待翻译代码片段的直接翻译以及替换是没有考虑到上下文代码片段的,导致部分翻译后代码片段出现翻译不准确的情况,该些翻译不准确的翻译后代码片段即为待纠正代码片段。The initial translation detail report refers to a report that records translation details obtained through automatic translation of the source code files to be translated. The code segment to be translated refers to the code segment in the original language type in the source code file to be translated and needs to be translated into the target language type. The translated code fragment refers to a code fragment of the target language type obtained through translation processing of the code fragment to be translated. When performing automatic translation processing, because the direct translation and replacement of the code fragments to be translated does not take into account the context code fragments, resulting in inaccurate translations of some translated code fragments, these inaccurately translated code fragments are is the code snippet to be corrected.

待纠正代码片段是指待纠正源代码文件中翻译不正确从而需要进行纠正处理的代码片段。纠正后代码片段是指用于纠正待纠正代码片段的代码片段。开发人员可基于初始翻译细节报表输入纠正后代码片段。还可在目标翻译细节报表中上下文代码片段,从而使得开发人员无需打开待纠正源代码文件,仅需根据目标翻译细节报表,便可通过查阅上下文代码片段对翻译后代码片段进行人工核查,从而能够更准确地从翻译后代码片段中筛选出待纠正代码片段减少了开发人员的浏览查找代码的时间。The code segment to be corrected refers to the code segment in the source code file to be corrected that is incorrectly translated and needs to be corrected. The corrected code fragment refers to the code fragment used to correct the code fragment to be corrected. Developers can enter corrected code snippets based on the initial translation detail report. Context code fragments can also be included in the target translation detail report, so that developers do not need to open the source code file to be corrected, and only need to manually check the translated code fragments by consulting the context code fragments according to the target translation detail report, so that they can More accurately filtering code fragments to be corrected from translated code fragments reduces the developer's time spent browsing to find code.

在一个实施例中,初始翻译细节报表中还可包含与每个翻译后代码片段对应的风险等级。风险等级包括但不限于低风险等级、潜在风险等级以及高风险等级等。当经过对上下文代码片段进行检查后发现,该段待翻译代码片段是某个字符串拼接的一部分,则说明这种情况下的自动翻译往往不正确,可将该待翻译代码片段标注为潜在风险等级。或当对翻译结果进行检查后发现翻译后代码片段中仍然包含原始语言类型的字符串,则说明翻译器系统没有进行准确翻译,可将该待翻译代码片段标注为潜在风险等级。当检测到翻译器接口调用失败导致翻译没有完成时,可将该待翻译代码片段标注为高风险等级。或当未查找到与待翻译代码片段匹配的代码处理器时,可将该待翻译代码片段标注为高风险等级。开发人员可重点针对风险等级高的翻译后代码片段进行核验,以快速确定待纠正代码片段,从而针对待纠正代码片段输入纠正后代码片段。In one embodiment, the initial translation detail report may further include a risk level corresponding to each translated code segment. Risk levels include but are not limited to low risk levels, potential risk levels, and high risk levels. When the context code fragment is checked and it is found that the code fragment to be translated is part of a string concatenation, it means that the automatic translation in this case is often incorrect, and the code fragment to be translated can be marked as a potential risk grade. Or, after checking the translation results, it is found that the translated code fragment still contains strings of the original language type, indicating that the translator system has not performed accurate translation, and the code fragment to be translated can be marked as a potential risk level. When it is detected that the translation is not completed due to the failure of the translator interface call, the code segment to be translated can be marked as a high risk level. Or when no code processor matching the code segment to be translated is found, the code segment to be translated may be marked as a high risk level. Developers can focus on the verification of the translated code fragments with a high risk level to quickly determine the code fragments to be corrected, so as to input the corrected code fragments for the code fragments to be corrected.

在一个实施例中,接收基于待纠正代码片段和对应的片段定位信息,输入的纠正后代码片段,包括:获取代码跳转指令;代码跳转指令对应于待纠正代码片段;基于代码跳转指令获取待纠正代码片段所属的待纠正代码文件;按照待纠正代码片段对应的片段定位信息,跳转展示待纠正源代码文件;检测作用于所展示的待纠正源代码文件的代码纠正操作;提取基于代码纠正操作得到的纠正后代码片段。In one embodiment, receiving the corrected code segment input based on the code segment to be corrected and the corresponding segment positioning information includes: obtaining a code jump instruction; the code jump instruction corresponds to the code segment to be corrected; based on the code jump instruction Obtain the code file to be corrected to which the code segment to be corrected belongs; jump to display the source code file to be corrected according to the segment location information corresponding to the code segment to be corrected; detect the code correction operation acting on the displayed source code file to be corrected; extract based on The corrected code fragment resulting from the code correction operation.

当开发人员无法通过初始翻译细节报表确定待纠正代码片段的纠正后代码片段时,比如当出现代码逻辑问题或字符串拼接问题时,开发人员可通过触发代码跳转指令,代码服务器可基于代码跳转指令按照片段定位信息打开展示待纠正源代码文件,并跳转至包含该不确定的待纠正代码片段的部分。代码服务器还可在待纠正源代码文件中标注出该部分待纠正代码片段,以使得开发人员可快速浏览待纠正代码片段的上下文片段,从而对待纠正源代码文件进行代码纠正操作。代码纠正操作可以是开发人员直接在待纠正源代码文件进行代码修改,则代码服务器可比对修改前后的待纠正源代码文件,提取出待纠正代码片段和纠正后代码片段。还可以是开发人员在待纠正源代码文件中选择需要修改的部分作为待纠正代码片段,从而开发人员可在目标翻译细节报表的对应位置输入纠正后代码片段。通过快速的代码跳转,节约了开发人员在待纠正源代码文件中查找待纠正代码片段的时间,从而提高了目标翻译细节报表的生成效率。When the developer cannot determine the corrected code fragment of the code fragment to be corrected through the initial translation detail report, for example, when a code logic problem or string splicing problem occurs, the developer can trigger the code jump command, and the code server can jump based on the code The switch command opens and displays the source code file to be corrected according to the segment positioning information, and jumps to the part containing the uncertain code segment to be corrected. The code server can also mark the part of the code segment to be corrected in the source code file to be corrected, so that developers can quickly browse the context segment of the code segment to be corrected, so as to perform code correction operations on the source code file to be corrected. The code correction operation can be that the developer directly modifies the code in the source code file to be corrected, and the code server can compare the source code file to be corrected before and after modification, and extract the code fragment to be corrected and the code fragment after correction. It can also be that the developer selects the part to be modified in the source code file to be corrected as the code segment to be corrected, so that the developer can input the corrected code segment in the corresponding position of the target translation detail report. Fast code jumping saves the time for developers to find the code fragments to be corrected in the source code files to be corrected, thereby improving the efficiency of generating target translation detail reports.

在一个实施例中,遍历目标翻译细节报表中的每个目标纠正项目,按照每个目标纠正项目对应的片段定位信息对待纠正源代码文件进行纠正处理,生成纠正后源代码文件,包括:提取目标翻译细节报表中的每个目标纠正项目对应的待纠正代码片段和相应的纠正后代码片段;按照每个目标纠正项目对应的片段定位信息,在待纠正源代码文件中查找待纠正代码片段;将待纠正源代码文件中的待纠正代码片段替换为相应的纠正后代码片段;当检测到执行完对应于所有目标纠正项目的纠正处理时,则重写经过纠正处理后的待纠正源代码文件,得到纠正后源代码文件。In one embodiment, each target correction item in the target translation detail report is traversed, and the source code file to be corrected is corrected according to the fragment location information corresponding to each target correction item, and the corrected source code file is generated, including: extracting the target The code segment to be corrected and the corresponding corrected code segment corresponding to each target correction item in the translation detail report; search for the code segment to be corrected in the source code file to be corrected according to the segment location information corresponding to each target correction item; The code segment to be corrected in the source code file to be corrected is replaced with the corresponding corrected code segment; when it is detected that the correction processing corresponding to all target correction items has been executed, the source code file to be corrected after the correction process is rewritten, The source code file was corrected.

通过目标纠正项目按照对应的片段定位信息,逐一对待纠正源代码文件中的待纠正代码片段进行纠正处理,能够保证纠正处理全面覆盖整个待纠正源代码文件,防止出现遗漏。Through the target correction project, according to the corresponding segment positioning information, the code segments to be corrected in the source code file to be corrected are corrected one by one, which can ensure that the correction process fully covers the entire source code file to be corrected and prevent omissions.

在一个实施例中,获取初始翻译细节报表,包括:获取待翻译分析结果集;待翻译分析结果集中包含待翻译代码片段,及与待翻译代码片段对应的上下文代码片段;查找与待翻译代码片段匹配的代码处理器;通过代码处理器根据上下文代码片段,识别待翻译代码片段的目标语言类型以及翻译策略;通过代码处理器调用翻译器接口,得到基于翻译策略翻译的与待翻译代码片段对应的目标语言类型的翻译后代码片段;根据待翻译代码片段以及与每个待翻译代码片段对应的翻译后代码片段和上下文代码片段,生成初始翻译细节报表。In one embodiment, obtaining the initial translation detail report includes: obtaining the analysis result set to be translated; the analysis result set to be translated includes the code segment to be translated and the context code segment corresponding to the code segment to be translated; searching for the code segment corresponding to the code segment to be translated Matching code processor; identify the target language type and translation strategy of the code segment to be translated according to the context code segment through the code processor; call the translator interface through the code processor to obtain the translation based on the translation strategy corresponding to the code segment to be translated Translated code snippets of the target language type; generate an initial translation detail report based on the code snippets to be translated and the translated code snippets and contextual code snippets corresponding to each code snippet to be translated.

待翻译分析结果集是指对待翻译源代码文件进行解析之后得到的,包含与多个待翻译代码片段对应的分别对应的待翻译分析结果的集合。待翻译分析结果包括待翻译源代码文件中待翻译代码片段及其相关信息。上下文代码片段是指待翻译代码片段在待翻译源代码文件中前后预设字符长度的代码片段。比如说,可以获取待翻译代码片段的前后50个字符长度的代码片段,作为待翻译代码片段的上下文代码片段。The to-be-translated analysis result set refers to a set of to-be-translated analysis results obtained after parsing the to-be-translated source code file, which respectively corresponds to a plurality of to-be-translated code fragments. The analysis results to be translated include code segments to be translated and related information in source code files to be translated. Context code fragments refer to code fragments with a preset character length before and after the code fragments to be translated in the source code file to be translated. For example, a code segment with a length of 50 characters before and after the code segment to be translated may be obtained as a context code segment of the code segment to be translated.

代码处理器是指用于对待翻译代码片段进行语法识别、风险识别、翻译处理及状态标注等操作的处理器。可预先对不同变成语言类型的待翻译代码片段设置不同的代码处理器,从而使得代码处理器能够更有针对性地对待翻译代码片段进行准确的操作,以实现更为精准的代码片段翻译。代码处理器可结合上下文代码片段对待翻译代码片段的语法进行分析,从而识别待翻译代码片段所对应的翻译策略。针对不同的待翻译代码片段可预设不同的翻译策略。翻译策略包括是否进行替换操作、对应于不同语法的待翻译代码片段进行不同的翻译操作等。通过得到的上下文代码片段能够更准确地对待翻译代码片段进行语法分析。A code processor refers to a processor used to perform operations such as syntax identification, risk identification, translation processing, and status annotation of code fragments to be translated. Different code processors can be set in advance for code fragments to be translated in different languages, so that the code processor can perform accurate operations on the code fragments to be translated in a more targeted manner, so as to achieve more accurate code fragment translation. The code processor can analyze the grammar of the code segment to be translated in combination with the context code segment, so as to identify the translation strategy corresponding to the code segment to be translated. Different translation strategies can be preset for different code fragments to be translated. The translation strategy includes whether to perform a replacement operation, perform different translation operations corresponding to code fragments to be translated with different grammars, and so on. Through the obtained context code fragments, the syntax analysis of the code fragments to be translated can be performed more accurately.

翻译器接口是指翻译器系统提供的、可用于通过调用实现翻译功能的接口。翻译器系统可部署于翻译服务器上。翻译器系统包括但不限于百度翻译器或谷歌翻译器等其中一种或多种。可根据翻译结果输出目标语言类型的翻译后源代码文件以及翻译细节报表。通过自动化翻译替换的方式,提高了代码翻译的效率,以及提高了翻译结果的全面性和统一性。The translator interface refers to the interface provided by the translator system, which can be used to realize the translation function by calling. The translator system can be deployed on a translation server. Translator systems include but are not limited to one or more of Baidu Translator or Google Translator. According to the translation results, the translated source code files of the target language type and the translation detail report can be output. Through automatic translation and replacement, the efficiency of code translation is improved, and the comprehensiveness and uniformity of translation results are improved.

在一个实施例中,获取待翻译分析结果集,包括:获取待翻译源代码文件;读取待翻译源代码文件中的源代码目录;待翻译源代码目录中包含多个初始文件名;遍历每个初始文件名对应的初始代码子文件,筛选出待翻译代码子文件;待翻译代码子文件与预设语言类型相匹配;查找与预设语言类型匹配的解析器;通过解析器对待翻译代码子文件进行解析,得到待翻译分析结果集;待翻译分析结果集中包含待翻译代码子文件中的待翻译代码片段及与待翻译代码片段对应的上下文代码片段。In one embodiment, obtaining the analysis result set to be translated includes: obtaining the source code file to be translated; reading the source code directory in the source code file to be translated; the source code directory to be translated contains a plurality of initial file names; traversing each The initial code sub-files corresponding to each initial file name, filter out the code sub-files to be translated; the code sub-files to be translated match the preset language type; find the parser that matches the preset language type; treat the translated code sub-files through the parser The file is parsed to obtain an analysis result set to be translated; the analysis result set to be translated includes the code segment to be translated in the sub-file of the code to be translated and the context code segment corresponding to the code segment to be translated.

待翻译源代码可预存在代码服务器的数据库中,代码服务器可直接从本地数据库中获取待翻译源代码文件;代码服务器也可接收终端上传的待翻译代码文件或其他服务器发送的待翻译源代码文件。初始代码子文件是指待翻译源代码文件中最小粒度的、无法进一步展开的源代码文件。待翻译代码子文件是指与预设语言类型相匹配的、需要翻译成目标语言类型的初始代码子文件。通过解析器可对待翻译代码子文件进行解析,对待翻译代码子文件中的待处理代码进行语法分析,可得到待处理代码中的待翻译代码片段。The source code to be translated can be pre-stored in the database of the code server, and the code server can directly obtain the source code file to be translated from the local database; the code server can also receive the code file to be translated uploaded by the terminal or the source code file to be translated sent by other servers . The initial code sub-file refers to the source code file with the smallest granularity among the source code files to be translated, which cannot be further expanded. The code subfile to be translated refers to the initial code subfile that matches the preset language type and needs to be translated into the target language type. The sub-file of the code to be translated can be parsed by the parser, and the code to be translated in the sub-file of the code to be translated can be parsed to obtain the code segment to be translated in the code to be processed.

在一个实施例中,如图3所示,提供了另一种代码片段纠正方法,以该方法应用于图1中的代码服务器104为例进行说明,包括以下步骤:In one embodiment, as shown in FIG. 3 , another method for correcting code fragments is provided. The method is applied to the code server 104 in FIG. 1 as an example for illustration, including the following steps:

步骤302,获取初始翻译细节报表;初始翻译细节报表中包含多个待翻译代码片段以及与每个待翻译代码片段对应的翻译后代码片段和片段定位信息,多个待翻译代码片段中包含待纠正代码片段。Step 302, obtain the initial translation detail report; the initial translation detail report includes a plurality of code fragments to be translated and the translated code fragments and fragment location information corresponding to each code fragment to be translated, and the plurality of code fragments to be translated include the code fragments to be corrected code segment.

步骤304,接收基于待纠正代码片段和对应的片段定位信息,输入的纠正后代码片段。Step 304, receiving the input corrected code segment based on the code segment to be corrected and the corresponding segment location information.

步骤306,将每个待纠正代码片段和相应的纠正后代码片段作为目标纠正项目,根据多个目标纠正项目以及与每个目标纠正项目对应的片段定位信息生成目标翻译细节报表。Step 306, taking each code segment to be corrected and the corresponding corrected code segment as a target correction item, and generating a target translation detail report according to multiple target correction items and segment positioning information corresponding to each target correction item.

步骤308,读取代码纠正配置文件;代码纠正配置文件中包含待纠正源代码文件路径和目标翻译细节报表路径。Step 308, read the code correction configuration file; the code correction configuration file includes the source code file path to be corrected and the target translation detail report path.

步骤310,根据待纠正源代码文件路径获取待纠正源代码文件。Step 310, obtain the source code file to be corrected according to the path of the source code file to be corrected.

步骤312,根据目标翻译细节报表文件路径获取目标翻译细节报表。Step 312, obtain the target translation detail report according to the file path of the target translation detail report.

步骤314,按照每个目标纠正项目对应的片段定位信息,在待纠正源代码文件中查找待纠正代码片段。Step 314, according to the segment positioning information corresponding to each target correction item, search for the code segment to be corrected in the source code file to be corrected.

步骤316,将待纠正源代码文件中的待纠正代码片段替换为相应的纠正后代码片段。Step 316, replacing the code segment to be corrected in the source code file to be corrected with the corresponding corrected code segment.

步骤318,当检测到执行完对应于所有目标纠正项目的纠正处理时,则重写经过纠正处理后的待纠正源代码文件,得到纠正后源代码文件。Step 318, when it is detected that the correction processing corresponding to all target correction items has been executed, rewrite the source code file to be corrected after the correction processing, and obtain the corrected source code file.

上述代码片段纠正方法中,代码服务器在获得初始翻译细节报表之后,开发人员可基于翻译后代码片段筛选出待纠正代码片段,并输入纠正后代码片段。代码服务器通过读取代码纠正配置文件,从而根据代码纠正配置文件中的待纠正源代码文件路径获取待纠正源代码文件,根据代码纠正配置文件中的目标翻译细节报表文件路径获取目标翻译细节报表。代码服务器可基于目标翻译细节报表中的目标纠正项目按照对应的片段定位信息对待纠正源代码文件准确地进行纠正处理,生成纠正后源代码文件。通过基于目标翻译细节报表自动化对待纠正源代码文件进行自动化纠正处理,能够保证纠正处理的全面性和准确定,从而提高代码片段纠正结果可靠性。In the above code fragment correction method, after the code server obtains the initial translation detail report, the developer can filter out the code fragments to be corrected based on the translated code fragments, and input the corrected code fragments. By reading the code correction configuration file, the code server obtains the source code file to be corrected according to the source code file path to be corrected in the code correction configuration file, and obtains the target translation detail report according to the target translation detail report file path in the code correction configuration file. The code server can accurately correct the source code file to be corrected based on the target correction items in the target translation detail report according to the corresponding segment positioning information, and generate the corrected source code file. By automatically correcting the source code file to be corrected based on the target translation detail report, the comprehensiveness and accuracy of the correction process can be ensured, thereby improving the reliability of the code fragment correction result.

应该理解的是,虽然图2和3的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2和3中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flow charts of FIGS. 2 and 3 are displayed sequentially as indicated by the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in Figures 2 and 3 may include a plurality of sub-steps or stages, these sub-steps or stages are not necessarily performed at the same time, but may be performed at different times, these sub-steps or stages The order of execution is not necessarily performed sequentially, but may be performed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps.

在一个实施例中,如图4所示,提供了一种代码片段纠正装置400,包括:读取模块402,用于读取代码纠正配置文件;代码纠正配置文件中包含待纠正源代码文件路径和目标翻译细节报表路径;获取模块404,用于根据待纠正源代码文件路径获取待纠正源代码文件;根据目标翻译细节报表文件路径获取目标翻译细节报表;目标翻译细节报表中包含多个目标纠正项目以及与每个目标纠正项目对应的片段定位信息;纠正模块406,用于遍历目标翻译细节报表中的每个目标纠正项目,按照每个目标纠正项目对应的片段定位信息对待纠正源代码文件进行纠正处理,生成纠正后源代码文件。In one embodiment, as shown in FIG. 4 , a code fragment correction device 400 is provided, including: a reading module 402 for reading a code correction configuration file; the code correction configuration file contains the source code file path to be corrected and the target translation details report path; the obtaining module 404 is used to obtain the source code file to be corrected according to the source code file path to be corrected; obtain the target translation details report according to the target translation details report file path; the target translation details report contains multiple target corrections project and the segment positioning information corresponding to each target correcting item; the correcting module 406 is used to traverse each target correcting item in the target translation detail report, and process the source code file to be corrected according to the segment positioning information corresponding to each target correcting item Correction processing, generating corrected source code files.

在一个实施例中,该装置还包括生成模块,用于获取初始翻译细节报表;初始翻译细节报表中包含多个待翻译代码片段以及与每个待翻译代码片段对应的翻译后代码片段和片段定位信息,多个待翻译代码片段中包含待纠正代码片段;接收基于待纠正代码片段和对应的片段定位信息,输入的纠正后代码片段;将每个待纠正代码片段和相应的纠正后代码片段作为目标纠正项目;根据多个目标纠正项目生成目标翻译细节报表。In one embodiment, the device further includes a generating module, configured to obtain an initial translation detail report; the initial translation detail report includes a plurality of code fragments to be translated and translated code fragments and fragment positioning corresponding to each code fragment to be translated information, multiple code fragments to be translated contain code fragments to be corrected; receive corrected code fragments input based on the code fragments to be corrected and corresponding fragment positioning information; use each code fragment to be corrected and the corresponding corrected code fragments as Target correction items; generate target translation detail reports based on multiple target correction items.

在一个实施例中,生成模块还用于获取代码跳转指令;代码跳转指令对应于待纠正代码片段;基于代码跳转指令获取待纠正代码片段所属的待纠正代码文件;按照待纠正代码片段对应的片段定位信息,跳转展示待纠正源代码文件;检测作用于所展示的待纠正源代码文件的代码纠正操作;提取基于代码纠正操作得到的纠正后代码片段。In one embodiment, the generation module is also used to obtain a code jump instruction; the code jump instruction corresponds to the code segment to be corrected; obtain the code file to be corrected to which the code segment to be corrected belongs based on the code jump instruction; according to the code segment to be corrected Corresponding fragment positioning information, jumping to display the source code file to be corrected; detecting the code correction operation acting on the displayed source code file to be corrected; extracting the corrected code fragment obtained based on the code correction operation.

在一个实施例中,纠正模块406还用于提取目标翻译细节报表中的每个目标纠正项目对应的待纠正代码片段和相应的纠正后代码片段;按照每个目标纠正项目对应的片段定位信息,在待纠正源代码文件中查找待纠正代码片段;将待纠正源代码文件中的待纠正代码片段替换为相应的纠正后代码片段;当检测到执行完对应于所有目标纠正项目的纠正处理时,则重写经过纠正处理后的待纠正源代码文件,得到纠正后源代码文件。In one embodiment, the correction module 406 is also used to extract the code segment to be corrected and the corresponding corrected code segment corresponding to each target correction item in the target translation detail report; according to the segment positioning information corresponding to each target correction item, Find the code segment to be corrected in the source code file to be corrected; replace the code segment to be corrected in the source code file to be corrected with the corresponding corrected code segment; when it is detected that the corrective processing corresponding to all target correction items has been executed, The corrected source code file is rewritten to obtain the corrected source code file.

在一个实施例中,生成模块还用于获取待翻译分析结果集;待翻译分析结果集中包含待翻译代码片段,及与待翻译代码片段对应的上下文代码片段;查找与待翻译代码片段匹配的代码处理器;通过代码处理器根据上下文代码片段,识别待翻译代码片段的目标语言类型以及翻译策略;通过代码处理器调用翻译器接口,得到基于翻译策略翻译的与待翻译代码片段对应的目标语言类型的翻译后代码片段;根据待翻译代码片段以及与每个待翻译代码片段对应的翻译后代码片段和上下文代码片段,生成初始翻译细节报表。In one embodiment, the generation module is also used to obtain the analysis result set to be translated; the analysis result set to be translated includes the code segment to be translated, and the context code segment corresponding to the code segment to be translated; find the code that matches the code segment to be translated Processor; identify the target language type and translation strategy of the code segment to be translated according to the context code segment through the code processor; call the translator interface through the code processor to obtain the target language type corresponding to the code segment to be translated based on the translation strategy the translated code fragments; an initial translation detail report is generated according to the code fragments to be translated and the translated code fragments and contextual code fragments corresponding to each code fragment to be translated.

在一个实施例中,生成模块还用于获取待翻译源代码文件;读取待翻译源代码文件中的源代码目录;待翻译源代码目录中包含多个初始文件名;遍历每个初始文件名对应的初始代码子文件,筛选出待翻译代码子文件;待翻译代码子文件与预设语言类型相匹配;查找与预设语言类型匹配的解析器;通过解析器对待翻译代码子文件进行解析,得到待翻译分析结果集;待翻译分析结果集中包含待翻译代码子文件中的待翻译代码片段及与待翻译代码片段对应的上下文代码片段。In one embodiment, the generating module is also used to obtain the source code file to be translated; read the source code directory in the source code file to be translated; include multiple initial file names in the source code directory to be translated; traverse each initial file name Corresponding to the initial code sub-file, filter out the code sub-file to be translated; the code sub-file to be translated matches the preset language type; find the parser that matches the preset language type; parse the code sub-file to be translated through the parser, An analysis result set to be translated is obtained; the analysis result set to be translated includes the code segment to be translated in the code subfile to be translated and the context code segment corresponding to the code segment to be translated.

关于代码片段纠正装置的具体限定可以参见上文中对于代码片段纠正方法的限定,在此不再赘述。上述代码片段纠正装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For the specific limitations of the code fragment correcting apparatus, please refer to the above-mentioned definition of the code fragment correcting method, which will not be repeated here. Each module in the above-mentioned device for correcting code fragments can be fully or partially realized by software, hardware and combinations thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that the processor can invoke and execute the corresponding operations of the above-mentioned modules.

在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图5所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储代码纠正配置文件等数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种代码片段纠正方法。In one embodiment, a computer device is provided, and the computer device may be a server, and its internal structure may be as shown in FIG. 5 . The computer device includes a processor, memory, network interface and database connected by a system bus. Wherein, the processor of the computer device is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs and databases. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device is used to store data such as code correction configuration files. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a code segment correction method is realized.

本领域技术人员可以理解,图5中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in Figure 5 is only a block diagram of a part of the structure related to the solution of this application, and does not constitute a limitation to the computer equipment on which the solution of this application is applied. The specific computer equipment can be More or fewer components than shown in the figures may be included, or some components may be combined, or have a different arrangement of components.

在一个实施例中,提供了另一种计算机设备,包括存储器和处理器,该存储器存储有计算机程序,该处理器执行计算机程序时实现上述各个实施例中的代码片段纠正方法的步骤。In one embodiment, another computer device is provided, including a memory and a processor, the memory stores a computer program, and the processor implements the steps of the method for correcting code fragments in each of the above embodiments when executing the computer program.

在一个实施例中,提供了另一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述各个实施例中的代码片段纠正方法的步骤。In one embodiment, another computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for correcting code fragments in the above-mentioned embodiments are implemented.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented through computer programs to instruct related hardware, and the computer programs can be stored in a non-volatile computer-readable memory In the medium, when the computer program is executed, it may include the processes of the embodiments of the above-mentioned methods. Wherein, any references to memory, storage, database or other media used in the various embodiments provided in the present application may include non-volatile and/or volatile memory. Nonvolatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Chain Synchlink DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. To make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be It is considered to be within the range described in this specification.

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several implementation modes of the present application, and the description thereof is relatively specific and detailed, but it should not be construed as limiting the scope of the patent for the invention. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the scope of protection of the patent application should be based on the appended claims.

Claims (10)

1.一种代码片段纠正方法,所述方法包括:1. A code fragment correction method, said method comprising: 读取代码纠正配置文件;所述代码纠正配置文件中包含待纠正源代码文件路径和目标翻译细节报表路径;Read the code correction configuration file; the code correction configuration file includes the source code file path to be corrected and the target translation detail report path; 根据所述待纠正源代码文件路径获取待纠正源代码文件;Acquiring the source code file to be corrected according to the path of the source code file to be corrected; 根据所述目标翻译细节报表文件路径获取目标翻译细节报表;所述目标翻译细节报表中包含多个目标纠正项目以及与每个目标纠正项目对应的片段定位信息;Obtaining a target translation detail report according to the target translation detail report file path; the target translation detail report includes a plurality of target correction items and segment positioning information corresponding to each target correction item; 遍历所述目标翻译细节报表中的每个目标纠正项目,按照每个目标纠正项目对应的片段定位信息对所述待纠正源代码文件进行纠正处理,生成纠正后源代码文件。Traverse each target correction item in the target translation detail report, perform correction processing on the source code file to be corrected according to the segment positioning information corresponding to each target correction item, and generate a corrected source code file. 2.根据权利要求1所述的方法,其特征在于,在所述读取代码纠正配置文件之前,还包括:2. The method according to claim 1, further comprising: 获取初始翻译细节报表;所述初始翻译细节报表中包含多个待翻译代码片段以及与每个待翻译代码片段对应的翻译后代码片段和片段定位信息,所述多个待翻译代码片段中包含待纠正代码片段;Obtain an initial translation detail report; the initial translation detail report includes a plurality of code fragments to be translated and translated code fragments and fragment positioning information corresponding to each code fragment to be translated, and the plurality of code fragments to be translated includes the code fragments to be translated correct code snippet; 接收基于所述待纠正代码片段和对应的片段定位信息,输入的纠正后代码片段;receiving a corrected code segment input based on the code segment to be corrected and corresponding segment positioning information; 将每个所述待纠正代码片段和相应的纠正后代码片段作为目标纠正项目;Taking each of the code fragments to be corrected and the corresponding corrected code fragments as target correction items; 根据多个所述目标纠正项目生成目标翻译细节报表。A target translation detail report is generated based on a plurality of the target correction items. 3.根据权利要求2所述的方法,其特征在于,所述接收基于所述待纠正代码片段和对应的片段定位信息,输入的纠正后代码片段,包括:3. The method according to claim 2, wherein the receiving the corrected code segment input based on the code segment to be corrected and the corresponding segment positioning information includes: 获取代码跳转指令;所述代码跳转指令对应于所述待纠正代码片段;Obtaining a code jump instruction; the code jump instruction corresponds to the code segment to be corrected; 基于代码跳转指令获取所述待纠正代码片段所属的待纠正代码文件;Obtaining the code file to be corrected to which the code segment to be corrected belongs based on a code jump instruction; 按照所述待纠正代码片段对应的片段定位信息,跳转展示所述待纠正源代码文件;According to the segment positioning information corresponding to the code segment to be corrected, jump to display the source code file to be corrected; 检测作用于所展示的待纠正源代码文件的代码纠正操作;Detect code correction actions applied to the displayed source code files to be corrected; 提取基于所述代码纠正操作得到的纠正后代码片段。Extracting the corrected code fragment obtained based on the code correcting operation. 4.根据权利要求2所述的方法,其特征在于,所述遍历所述目标翻译细节报表中的每个目标纠正项目,按照每个目标纠正项目对应的片段定位信息对所述待纠正源代码文件进行纠正处理,生成纠正后源代码文件,包括:4. The method according to claim 2, characterized in that, each target correction item in the target translation detail report is traversed, and the source code to be corrected is processed according to the segment positioning information corresponding to each target correction item The file is corrected and the corrected source code file is generated, including: 提取目标翻译细节报表中的每个目标纠正项目对应的待纠正代码片段和相应的纠正后代码片段;Extract the code segment to be corrected and the corresponding corrected code segment corresponding to each target correction item in the target translation detail report; 按照每个目标纠正项目对应的片段定位信息,在所述待纠正源代码文件中查找所述待纠正代码片段;Searching for the code fragment to be corrected in the source code file to be corrected according to the fragment positioning information corresponding to each target correction item; 将所述待纠正源代码文件中的所述待纠正代码片段替换为相应的纠正后代码片段;replacing the code segment to be corrected in the source code file to be corrected with the corresponding corrected code segment; 当检测到执行完对应于所有目标纠正项目的纠正处理时,则重写经过纠正处理后的待纠正源代码文件,得到纠正后源代码文件。When it is detected that the correction processing corresponding to all target correction items has been executed, the source code file to be corrected after the correction processing is rewritten to obtain the corrected source code file. 5.根据权利要求2所述的方法,其特征在于,所述获取初始翻译细节报表,包括:5. The method according to claim 2, wherein said obtaining the initial translation detail report comprises: 获取待翻译分析结果集;所述待翻译分析结果集中包含待翻译代码片段,及与所述待翻译代码片段对应的上下文代码片段;Obtain an analysis result set to be translated; the analysis result set to be translated includes a code segment to be translated and a context code segment corresponding to the code segment to be translated; 查找与所述待翻译代码片段匹配的代码处理器;Finding a code processor matching the code segment to be translated; 通过所述代码处理器根据所述上下文代码片段,识别待翻译代码片段的目标语言类型以及翻译策略;Using the code processor to identify the target language type and translation strategy of the code segment to be translated according to the context code segment; 通过所述代码处理器调用翻译器接口,得到基于所述翻译策略翻译的与待翻译代码片段对应的目标语言类型的翻译后代码片段;calling a translator interface through the code processor to obtain a translated code segment of the target language type corresponding to the code segment to be translated based on the translation strategy; 根据所述待翻译代码片段以及与每个待翻译代码片段对应的翻译后代码片段和上下文代码片段,生成初始翻译细节报表。An initial translation detail report is generated according to the code fragments to be translated and the translated code fragments and context code fragments corresponding to each code fragment to be translated. 6.根据权利要求5所述的方法,其特征在于,所述获取待翻译分析结果集,包括:6. The method according to claim 5, wherein said obtaining the analysis result set to be translated comprises: 获取待翻译源代码文件;Obtain source code files to be translated; 读取所述待翻译源代码文件中的源代码目录;所述待翻译源代码目录中包含多个初始文件名;Read the source code directory in the source code file to be translated; the source code directory to be translated contains a plurality of initial file names; 遍历每个所述初始文件名对应的初始代码子文件,筛选出待翻译代码子文件;所述待翻译代码子文件与预设语言类型相匹配;Traverse the initial code sub-files corresponding to each of the initial file names, and filter out the code sub-files to be translated; the code sub-files to be translated match the preset language type; 查找与所述预设语言类型匹配的解析器;Find a parser that matches the preset language type; 通过所述解析器对所述待翻译代码子文件进行解析,得到待翻译分析结果集;所述待翻译分析结果集中包含所述待翻译代码子文件中的待翻译代码片段及与待翻译代码片段对应的上下文代码片段。Analyze the code subfile to be translated by the parser to obtain an analysis result set to be translated; the analysis result set to be translated includes the code segment to be translated and the code segment to be translated in the code subfile to be translated Corresponding context code snippet. 7.一种代码片段纠正装置,其特征在于,所述装置包括:7. A device for correcting code fragments, characterized in that the device comprises: 读取模块,用于读取代码纠正配置文件;所述代码纠正配置文件中包含待纠正源代码文件路径和目标翻译细节报表路径;The reading module is used to read the code correction configuration file; the code correction configuration file includes the source code file path to be corrected and the target translation detail report path; 获取模块,用于根据所述待纠正源代码文件路径获取待纠正源代码文件;根据所述目标翻译细节报表文件路径获取目标翻译细节报表;所述目标翻译细节报表中包含多个目标纠正项目以及与每个目标纠正项目对应的片段定位信息;The obtaining module is used to obtain the source code file to be corrected according to the source code file path to be corrected; obtain the target translation detail report according to the target translation detail report file path; the target translation detail report contains a plurality of target correction items and Fragment positioning information corresponding to each target correction item; 纠正模块,用于遍历所述目标翻译细节报表中的每个目标纠正项目,按照每个目标纠正项目对应的片段定位信息对所述待纠正源代码文件进行纠正处理,生成纠正后源代码文件。The correction module is configured to traverse each target correction item in the target translation detail report, correct the source code file to be corrected according to the segment positioning information corresponding to each target correction item, and generate a corrected source code file. 8.根据权利7所述的装置,其特征在于,所述装置还包括生成模块,用于获取初始翻译细节报表;所述初始翻译细节报表中包含多个待翻译代码片段以及与每个待翻译代码片段对应的翻译后代码片段和片段定位信息,所述多个待翻译代码片段中包含待纠正代码片段;8. The device according to claim 7, characterized in that, the device also includes a generation module for obtaining an initial translation detail report; the initial translation detail report includes a plurality of code fragments to be translated and each The translated code segment and segment positioning information corresponding to the code segment, the plurality of code segments to be translated include the code segment to be corrected; 接收基于所述待纠正代码片段和对应的片段定位信息,输入的纠正后代码片段;receiving a corrected code segment input based on the code segment to be corrected and corresponding segment positioning information; 将每个所述待纠正代码片段和相应的纠正后代码片段作为目标纠正项目;Taking each of the code fragments to be corrected and the corresponding corrected code fragments as target correction items; 根据多个所述目标纠正项目生成目标翻译细节报表。A target translation detail report is generated based on a plurality of the target correction items. 9.一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至6中任一项所述方法的步骤。9. A computer device, comprising a memory and a processor, the memory stores a computer program, wherein the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program . 10.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至6中任一项所述的方法的步骤。10. A computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are realized.
CN201910296104.4A 2019-04-12 2019-04-12 Code fragment correction method, device, computer equipment and storage medium Pending CN110134586A (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN201910296104.4A CN110134586A (en) 2019-04-12 2019-04-12 Code fragment correction method, device, computer equipment and storage medium
SG11201907509XA SG11201907509XA (en) 2019-04-12 2019-06-19 Methods and apparatuses for code snippet correction, computer devices and storage mediums
PCT/CN2019/091835 WO2020206839A1 (en) 2019-04-12 2019-06-19 Code snippet correction method and apparatus, computer device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910296104.4A CN110134586A (en) 2019-04-12 2019-04-12 Code fragment correction method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110134586A true CN110134586A (en) 2019-08-16

Family

ID=67569839

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910296104.4A Pending CN110134586A (en) 2019-04-12 2019-04-12 Code fragment correction method, device, computer equipment and storage medium

Country Status (3)

Country Link
CN (1) CN110134586A (en)
SG (1) SG11201907509XA (en)
WO (1) WO2020206839A1 (en)

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5797011A (en) * 1990-10-23 1998-08-18 International Business Machines Corporation Method for controlling the translation of information on a display screen from a source language to a target language
US20040268257A1 (en) * 2003-06-30 2004-12-30 American Megatrends, Inc. Method, apparatus, and system for providing multi-language character strings within a computer
US20080127045A1 (en) * 2006-09-27 2008-05-29 David Pratt Multiple-developer architecture for facilitating the localization of software applications
CN101253476A (en) * 2005-08-10 2008-08-27 微软公司 Syntactic program language translation
CN102737014A (en) * 2011-04-04 2012-10-17 陈本东 Multilingual user online communication method, system and user interface
CN104317788A (en) * 2014-11-03 2015-01-28 上海鼎讯电子有限公司 Android multi-language translation method and device
CN105242932A (en) * 2015-10-21 2016-01-13 宁波三星医疗电气股份有限公司 Automatic translation method of software developed on the basis of DELPHI tool
CN106648819A (en) * 2016-12-27 2017-05-10 竞技世界(北京)网络技术有限公司 Internationalized code conversion method based on editor
CN107133200A (en) * 2017-04-14 2017-09-05 深圳市海派通讯科技有限公司 A kind of android system text string extracting and merging method
CN107153607A (en) * 2016-03-03 2017-09-12 展讯通信(天津)有限公司 Check method, the apparatus and system of interface of mobile terminal language
CN107329957A (en) * 2017-05-18 2017-11-07 网易(杭州)网络有限公司 Replace the method and computer-readable recording medium of code Chinese character string
CN107451128A (en) * 2017-08-04 2017-12-08 深圳Tcl新技术有限公司 Multilingual code adaptation method, equipment and storage medium
CN107577482A (en) * 2017-08-28 2018-01-12 北京锐安科技有限公司 The automatic switching method and device of software languages
CN108399166A (en) * 2018-02-07 2018-08-14 深圳壹账通智能科技有限公司 Text interpretation method, device, computer equipment and storage medium

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5797011A (en) * 1990-10-23 1998-08-18 International Business Machines Corporation Method for controlling the translation of information on a display screen from a source language to a target language
US20040268257A1 (en) * 2003-06-30 2004-12-30 American Megatrends, Inc. Method, apparatus, and system for providing multi-language character strings within a computer
CN101253476A (en) * 2005-08-10 2008-08-27 微软公司 Syntactic program language translation
US20080127045A1 (en) * 2006-09-27 2008-05-29 David Pratt Multiple-developer architecture for facilitating the localization of software applications
CN102737014A (en) * 2011-04-04 2012-10-17 陈本东 Multilingual user online communication method, system and user interface
CN104317788A (en) * 2014-11-03 2015-01-28 上海鼎讯电子有限公司 Android multi-language translation method and device
CN105242932A (en) * 2015-10-21 2016-01-13 宁波三星医疗电气股份有限公司 Automatic translation method of software developed on the basis of DELPHI tool
CN107153607A (en) * 2016-03-03 2017-09-12 展讯通信(天津)有限公司 Check method, the apparatus and system of interface of mobile terminal language
CN106648819A (en) * 2016-12-27 2017-05-10 竞技世界(北京)网络技术有限公司 Internationalized code conversion method based on editor
CN107133200A (en) * 2017-04-14 2017-09-05 深圳市海派通讯科技有限公司 A kind of android system text string extracting and merging method
CN107329957A (en) * 2017-05-18 2017-11-07 网易(杭州)网络有限公司 Replace the method and computer-readable recording medium of code Chinese character string
CN107451128A (en) * 2017-08-04 2017-12-08 深圳Tcl新技术有限公司 Multilingual code adaptation method, equipment and storage medium
CN107577482A (en) * 2017-08-28 2018-01-12 北京锐安科技有限公司 The automatic switching method and device of software languages
CN108399166A (en) * 2018-02-07 2018-08-14 深圳壹账通智能科技有限公司 Text interpretation method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
SG11201907509XA (en) 2020-11-27
WO2020206839A1 (en) 2020-10-15

Similar Documents

Publication Publication Date Title
WO2020206840A1 (en) Code translation method and apparatus, computer device, and storage medium
US11775414B2 (en) Automated bug fixing using deep learning
CN110489321B (en) Test case screening method, device, computer equipment and storage medium
WO2022227314A1 (en) Method and apparatus for dynamic synchronous testing, device, and storage medium
WO2021003913A1 (en) Method and device for processing annotation information, computer apparatus, and storage medium
CN111078568B (en) Code specification method, apparatus, computer device and storage medium
WO2020206838A1 (en) Code snippet translation method and apparatus, computer device, and storage medium
CN110765152B (en) SQL extraction method, SQL extraction device, computer equipment and storage medium
CN111176996A (en) Test case generation method, device, computer equipment and storage medium
WO2020206837A1 (en) Code segment positioning method and device, computer apparatus, and storage medium
CN110471838A (en) Method of calibration, device, computer equipment and the storage medium of test case
CN110019566A (en) Data checking, device, computer equipment and storage medium based on data warehouse
CN116226170A (en) Database statement conversion method and device, electronic equipment and storage medium
CN114116268A (en) Method and device for checking Flink SQL statement, computer equipment and storage medium
US10782942B1 (en) Rapid onboarding of data from diverse data sources into standardized objects with parser and unit test generation
CN113778852B (en) A Code Analysis Method Based on Regular Expression
CN112148581A (en) Code specification checking method, device, system and storage medium
CN119917571A (en) Data format conversion method, system, device and storage medium
CN110134586A (en) Code fragment correction method, device, computer equipment and storage medium
CN113778888B (en) Code automatic test method, system, equipment and storage medium
CN113568632B (en) Server power firmware updating method and device, computer equipment and storage medium
CN115543477A (en) Database statement processing method and device and electronic equipment
CN118394368B (en) Basic input output system layout information generating method, updating method and product
CN120578601A (en) Element node positioning method, device, equipment and medium based on custom identification
CN120596095A (en) Instruction optimization method, device, equipment and medium based on abstract syntax tree

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20190816