File translation method and device, electronic equipment, storage medium and product

By converting XML format files into spreadsheet data formats, the problem of difficult to edit and manage XML files is solved, the accuracy and efficiency of translation operations are improved, and the accuracy of translated files is ensured.

CN118940771APending Publication Date: 2024-11-12GUANGZHOU BAOLUN ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411112797.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-14
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

In the prior art, XML format files are not intuitive and difficult to edit and manage directly, resulting in errors in translation operations and affecting the accuracy of the translated files.

Method used

Convert the XML format to be translated into a spreadsheet data format. By reading the to be translated in the target application platform, generate the corresponding spreadsheet data file, and after translating it on the translation side, convert the initial translation file to The format available to the target application platform.

Benefits of technology

Through the intuitiveness and convenience of the spreadsheet data format, the operation accuracy and efficiency of the translator are improved, and the accuracy of the target translation file is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118940771A_ABST
    Figure CN118940771A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a file translation method and device, electronic equipment, a storage medium and a product. The method comprises the following steps: reading a first to-be-translated file in a target application platform, and determining attribute data corresponding to a target attribute in the first to-be-translated file; based on the attribute data and a pre-constructed first to-be-written file, generating a second to-be-translated file corresponding to the first to-be-translated file, and sending the second to-be-translated file to the translation end; determining a target translation file corresponding to the first to-be-translated file and displayed on the target application platform based on a received initial translation file corresponding to the second to-be-translated file and fed back by the translation end; wherein the format of the first to-be-translated file is an extensible markup language format, the attribute data comprises the to-be-translated source text, and the formats of the first to-be-written file and the second to-be-translated file are spreadsheet data formats. According to the technical scheme, the accuracy of the determined target translation file can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technology, and in particular, to a file translation method, device, electronic device, storage medium and product. Background Art

[0002] With the development of globalization, the demand for internationalization and localization of software applications is growing, and it is necessary to ensure that the software can run seamlessly in different language and cultural environments. In order to achieve this goal, the software content needs to be translated.

[0003] In the prior art, a cross-platform application development framework usually uses files in the format of extensible markup language (XML) to store items to be translated, and translators manually translate the items to be translated by viewing the files in the XML format. However, in the process of implementing the present invention, it is found that the prior art has at least the following technical problems: the XML format is not intuitive, difficult to edit and manage directly, and prone to errors in operation. Summary of the invention

[0004] The embodiments of the present invention provide a file translation method, device, electronic device, storage medium and product to achieve the purpose of facilitating translators to operate more accurately and effectively, which is conducive to improving the accuracy of the determined target translation file.

[0005] According to one aspect of the present invention, there is provided a file translation method, comprising:

[0006] Reading a first file to be translated in the target application platform, and determining attribute data corresponding to the target attribute in the first file to be translated;

[0007] Based on the attribute data and the pre-constructed first file to be written, generating a second file to be translated corresponding to the first file to be translated, and sending the second file to be translated to the translation end;

[0008] Determining a target translation file corresponding to the first file to be translated and displayed on the target application platform based on the initial translation file corresponding to the second file to be translated and fed back by the translation end;

[0009] The format of the first file to be translated is an extensible markup language format, the attribute data includes a source text to be translated, and the format of the first file to be written and the second file to be translated is a spreadsheet data format.

[0010] According to another aspect of the present invention, there is provided a document translation device, the device comprising:

[0011] A file reading module, used for reading a first file to be translated in a target application platform, and determining attribute data corresponding to a target attribute in the first file to be translated;

[0012] A file generation module, configured to generate a second file to be translated corresponding to the first file to be translated based on the attribute data and the pre-constructed first file to be written, and send the second file to be translated to the translation end;

[0013] A file determination module, configured to determine a target translation file corresponding to the first file to be translated and displayed on the target application platform based on an initial translation file corresponding to the second file to be translated and fed back by the translation end;

[0014] The format of the first file to be translated is an extensible markup language format, the attribute data includes a source text to be translated, and the format of the first file to be written and the second file to be translated is a spreadsheet data format.

[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0016] at least one processor; and

[0017] a memory communicatively connected to the at least one processor; wherein,

[0018] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the file translation method described in any embodiment of the present invention.

[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the file translation method described in any embodiment of the present invention when executed.

[0020] The technical solution of the embodiment of the present invention determines the attribute data corresponding to the target attribute in the first file to be translated by reading the first file to be translated in the target application platform; based on the attribute data and the pre-constructed first file to be written, generates the second file to be translated corresponding to the first file to be translated, and sends the second file to be translated to the translation end; wherein the format of the first file to be translated is the extensible markup language format, the attribute data includes the source text to be translated, and the format of the first file to be written and the second file to be translated is the spreadsheet data format. Since the spreadsheet data format is more intuitive and easy to operate, by providing the second file to be translated in the spreadsheet data format to the translation end, it is convenient for translators to operate more accurately and effectively; finally, based on the initial translation file corresponding to the second file to be translated fed back by the translation end, the target translation file corresponding to the first file to be translated displayed on the target application platform is determined, which is conducive to improving the accuracy of the determined target translation file.

[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0023] Figure 1 is a flow chart of a file translation method provided according to an embodiment of the present invention;

[0024] Figure 2 is a flow chart of another file translation method provided according to an embodiment of the present invention;

[0025] Figure 3 is a structural schematic diagram of a file translation device provided according to an embodiment of the present invention;

[0026] Figure 4 It is a schematic diagram of the structure of an electronic device for implementing the file translation method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "etc." and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information and network security.

[0030] Figure 1 This is a flowchart of a file translation method provided according to an embodiment of the present invention. This embodiment is applicable to the case where a file to be translated on a target application platform is translated into different languages. The method can be executed by a file translation device, which can be implemented in the form of hardware and / or software.

[0031] like Figure 1 As shown, the method of this embodiment may specifically include:

[0032] S110: Read a first file to be translated in the target application platform, and determine attribute data corresponding to the target attribute in the first file to be translated.

[0033] The target application platform is an application platform translated into multiple languages, and may be a cross-platform application development framework platform. For example, the target application platform may be a QT platform. The first file to be translated is a file generated on the target application platform and needs to be translated; the format of the first file to be translated is an extensible markup language format.

[0034] It should be noted that XML files are used to store and transmit data. In XML, elements and attributes are the cornerstones of building data structures. Elements usually contain text data or other elements, while attributes provide additional information about elements in the form of name-value pairs.

[0035] In this embodiment, the first file to be translated is a translation source file, i.e., a ts file. The attributes of the first file to be translated may include a file storage path attribute, a translation source text attribute, a target translation text attribute, a target function position attribute, and a translation status attribute. Optionally, the target attribute includes at least one of the file storage path attribute, the translation source text attribute, and the target translation text attribute. The attribute data may be understood as an attribute value corresponding to the target attribute in the first file to be translated.

[0036] In a specific implementation, the first file to be translated in the target application platform is read, and attribute data corresponding to the target attribute in the first file to be translated is determined, including: reading attribute data corresponding to the target attribute of each sub-file to be translated in the first file to be translated on the target application platform, and storing the attribute data in a pre-constructed structure.

[0037] In this embodiment, the first file to be translated may record at least one attribute data of a sub-file to be translated for different attributes. In order to be able to fully translate the contents to be translated in each sub-file to be translated, the attribute data corresponding to the target attribute of each sub-file to be translated in the first file to be translated on the target application platform may be read and stored in a pre-built structure.

[0038] Exemplarily, the first subfile to be circulated may contain a context element, in which fields to be translated for each subfile to be translated are recorded. The content in the context element in the first subfile to be translated may be read cyclically, and the attribute data corresponding to each subfile to be translated may be read in sequence. The subfile to be translated may be a source file of the C++ programming language, i.e., a cpp file. The structure may be a structure constructed by the C++ programming language.

[0039] In this embodiment, the attribute data of each sub-file to be translated is uniformly written into the first file to be translated, so as to facilitate uniform reading and translation, which is beneficial to improving translation efficiency.

[0040] S120: Generate a second file to be translated corresponding to the first file to be translated based on the attribute data and the pre-constructed first file to be written, and send the second file to be translated to the translation end.

[0041] The formats of the first file to be written and the second file to be translated are electronic spreadsheet data formats.

[0042] In this embodiment, the first file to be written can be a blank document in a spreadsheet data format; or a document in a spreadsheet data format with row and column headers. Specifically, the attribute data can be written into a file after the first file to be written to become the second file to be translated.

[0043] In a specific implementation, based on the attribute data and a pre-constructed first file to be written, a second file to be translated corresponding to the first file to be translated is generated, including: based on a pre-set writing rule of the first file to be written, determining a writing position corresponding to at least one attribute data, and writing at least one attribute data to the corresponding writing position; determining the first file to be written in which the attribute data is written as the second file to be translated corresponding to the first file to be translated.

[0044] The writing rule is used to reflect the row and column position corresponding to each attribute data in the first file to be written, and the row and column position corresponding to the attribute data in the writing rule is used as the writing position. Exemplarily, the writing rule may specify that the source text to be translated is written to the fifth column.

[0045] In this embodiment, the writing position corresponding to each attribute data can be determined in turn according to the writing rules, and each attribute data can be written to the first file to be written according to the correspondence between the attribute data and the writing position. The file obtained after all the attribute data are written is used as the second translation file.

[0046] It should be noted that the second file to be translated is in a spreadsheet data format, which has the functions of batch text translation and automatic repeated translation, is more concise and intuitive, and is convenient for translators to operate.

[0047] This embodiment can quickly and orderly write the attribute data into the first file to be written by writing rules, thereby improving the writing efficiency of the attribute data.

[0048] In a specific implementation, the second file to be translated can be sent to the translation end so that the translation end displays the second file to be translated. After manual translation by a translator, an initial translation file having a spreadsheet data format is generated, and the initial translation file is fed back to the file translation platform through the translation end. Among them, the initial translation file is a file containing a target translation text corresponding to the source text to be translated. The target translation text can be a text with the same interpretation as the source text to be translated, but in a different language. For example, the source text to be translated can be a Chinese text, and the target translation text can be an English text.

[0049] S130: Determine a target translation file corresponding to the first file to be translated and displayed on the target application platform based on the initial translation file corresponding to the second file to be translated and fed back by the translation end.

[0050] The attribute data includes the source text to be translated.

[0051] In a specific implementation, after receiving the initial translation file, the file translation platform verifies whether the format of the initial translation file matches the format of the first file to be translated; if it matches, it means that the initial translation file can be directly used and displayed on the target application platform; if it does not match, it means that the initial translation file cannot be directly applied to the target application platform. In the case where the format of the initial translation file matches the format of the first file to be translated, the initial translation file can be directly determined as the target translation file. Furthermore, the target translation file can also be sent to the target application platform to display the target translation file on the target application platform.

[0052] Optionally, based on the initial translation file corresponding to the second file to be translated received as feedback from the translation end, a target translation file corresponding to the first file to be translated and displayed on the target application platform is determined, including: when the format of the initial translation file does not match the format of the first file to be translated, obtaining a target translation text corresponding to the source text to be translated based on a writing rule; writing the target translation text into a pre-created second file to be written in accordance with the format requirements of the extensible markup language format, and determining the second file to be written in which the target translation text is written as the target translation file; wherein the format of the second file to be written is the extensible markup language format.

[0053] Specifically, when the format of the initial translation file does not match the format of the first file to be translated, in order to obtain a target translation file that can be used on the target application platform, the format of the initial translation file can be converted into the format of the first file to be translated, and the initial translation file after the format conversion is used as the target translation file. Exemplarily, if the format of the initial translation file is in the spreadsheet data format and the format of the first file to be translated is in the extensible markup language format, it means that the two formats do not match; if the format of the initial translation file and the format of the first file to be translated are both in the extensible markup language format, it means that the two formats match.

[0054] Optionally, when the format of the initial translation file is converted, the target translation text corresponding to the original text to be translated can be read based on the writing rules, the target translation text can be written into the second file to be written, and the second file to be written with the target translation text can be determined as the target translation file.

[0055] In this embodiment, when the format of the initial translation file does not match the format of the first file to be translated, the initial translation file is converted into a format, thereby ensuring that the target translation file can be displayed and run on the target application platform.

[0056] The technical solution of the embodiment of the present invention determines the attribute data corresponding to the target attribute in the first file to be translated by reading the first file to be translated in the target application platform; based on the attribute data and the pre-constructed first file to be written, generates the second file to be translated corresponding to the first file to be translated, and sends the second file to be translated to the translation end; wherein the format of the first file to be translated is the extensible markup language format, the attribute data includes the source text to be translated, and the format of the first file to be written and the second file to be translated is the spreadsheet data format. Since the spreadsheet data format is more intuitive and easy to operate, by providing the second file to be translated in the spreadsheet data format to the translation end, it is convenient for translators to operate more accurately and effectively; finally, based on the initial translation file corresponding to the second file to be translated fed back by the translation end, the target translation file corresponding to the first file to be translated displayed on the target application platform is determined, which is conducive to improving the accuracy of the determined target translation file.

[0057] Figure 2 This is a flowchart of another file translation method provided according to an embodiment of the present invention. Based on the above embodiment, this embodiment optionally generates a second file to be translated corresponding to the first file to be translated based on attribute data and a pre-constructed first file to be written. The specific implementation method is: calling a pre-constructed machine translation interface so that the machine translation platform corresponding to the machine translation interface determines a machine translation text corresponding to at least one source text to be translated; obtaining the machine translation text, writing the machine translation text and the attribute data into the first file to be written, and obtaining a second file to be translated corresponding to the first text to be translated. Among them, the explanations of the terms that are the same or corresponding to the above embodiments are not repeated here. Figure 2 As shown, the method includes:

[0058] S210: Read a first file to be translated in the target application platform, and determine attribute data corresponding to the target attribute in the first file to be translated.

[0059] The attribute data includes the source text to be translated.

[0060] S220: Calling a pre-built machine translation interface so that a machine translation platform corresponding to the machine translation interface determines a machine translation text corresponding to at least one source text to be translated.

[0061] In this embodiment, a machine translation interface can be pre-constructed. By calling the machine translation interface, the source text to be translated in the first file to be translated can be transmitted to the machine translation platform, and the source text to be translated can be translated by the machine translation platform to obtain a machine translation text.

[0062] Optionally, calling a pre-built machine translation interface includes: sending a pre-translation request to the translation end, and calling the pre-built machine translation interface when receiving request passing information corresponding to the pre-translation request sent by the translation end.

[0063] In order to improve the flexibility of the translation operation, before calling the pre-built machine translation interface, the translator can be confirmed whether it is necessary to perform a pre-translation operation through the machine translation platform. Specifically, a pre-translation request is generated and sent to the translation end. Among them, the pre-translation request may include information such as the version of the target application platform of the first file to be translated, the language to be translated, and the target translation language. The language to be translated is the language currently used by the source text to be translated, and the target translation language is the language into which the source text to be translated needs to be translated. The pre-translation request is sent to the translation end, which is convenient for the translator to determine whether it is necessary to perform a pre-translation operation through the machine translation platform based on information such as the version of the target application platform, the language to be translated, and the target translation language.

[0064] Furthermore, in order to ensure that the translation of the source text to be translated can be completed in time, when the request passing information corresponding to the pre-translation request sent by the translation end is received within a preset time period, the pre-built machine translation interface is called. If the request passing information sent by the translation end is not received within the preset time period; or when the rejection request information corresponding to the pre-translation request is received, the attribute data is written into the first file to be written, and the second file to be translated is obtained.

[0065] This embodiment sends a pre-translation request to the translation end before calling the machine translation interface, thereby better meeting the actual needs of translators and flexibly and effectively completing the translation work of the source text to be translated.

[0066] S230: Obtain a machine-translated text, write the machine-translated text and attribute data into a first file to be written, obtain a second file to be translated corresponding to the first text to be translated, and send the second file to be translated to a translation end.

[0067] In a specific implementation, the machine translation platform transmits the machine translation text obtained by translation to the text translation platform, and the text translation platform writes the machine translation text and the attribute data into the first file to be written, and the first file to be written with the machine translation text and the attribute data is used as the second file to be translated. The format of the second file to be translated can be a spreadsheet data format.

[0068] Furthermore, if the machine translation text fed back by the machine translation platform is not received, the attribute data is written into the first file to be written, and the first file to be written with the attribute data written is sent to the translation end as the second file to be translated.

[0069] S240: Determine a target translation file corresponding to the first file to be translated and displayed on the target application platform based on the initial translation file corresponding to the second file to be translated and fed back by the translation end.

[0070] This embodiment sends the second file to be translated containing the machine translated text to the translation end, which is convenient for the translation end to display, so that the translator can proofread the machine translated text. The correctly translated machine translated text can be directly used as the target translation text without the need for further translation work, which reduces the workload of the translator and is conducive to improving translation efficiency.

[0071] The above describes in detail the embodiments corresponding to the file translation method. In order to make the technical solution of the method clearer to those skilled in the art, the following describes in detail the file translation process by taking the target application platform as the QT platform as an example. It should be noted that the QT platform is a cross-platform application and user interface development framework. Using the QT platform, you only need to develop the application once, without rewriting the source code, and you can deploy the application across different desktop and embedded operating systems.

[0072] In this embodiment, the QT platform executes the instruction (lupdate instruction) to extract the translatable string in the source code to generate the first file to be translated in the ts file structure. The file translation process includes the following steps:

[0073] 1. Analyze the first file to be translated of the ts file structure, the format of the first file to be translated is the xml format. Read the attribute data of the target attribute in the first file to be translated.

[0074] Exemplarily, the first file to be translated can be opened through an open source library of the C++ programming language and the doc structure can be obtained; the version number and target translation language of the TS root directory can be read, and the content of the context field in the first file to be translated can be read cyclically to obtain the file storage path, translation source text and target translation text of each sub-file to be translated. The obtained content is written into the struct ct_xml_ts structure.

[0075] 2. Write to the first file to be written, wherein the format of the first file to be written is a spreadsheet data format. Exemplarily, the content stored in the struct ct_xml_ts structure can be written to the first file to be written in the xlsx format to obtain the second file to be translated, and the second file to be translated is sent to the translation end. The second file to be translated is in the xlsx format. Exemplarily, the first line of the second file to be translated includes the xml root element (xml root), source (source text to be translated), target translation text (translation), comment content (comment), translation type (translation type), file storage path (location filename) and target function location (location line). Among them, comment is used to annotate the translation corresponding to each source when multiple sources are the same. Location filename is used to reflect the storage path of each sub-file to be translated. For example, the sub-file to be translated is a cpp file. Location line is used to reflect the number of lines in which the tr ("") function appears in the cpp file. The second file to be translated also records the version number and target language of the target application platform.

[0076] In this embodiment, the second file to be translated completely retains the information of the first file to be translated, and after being optimized in a certain order, the translation speed can be accelerated.

[0077] 3. Receive the initial translation file fed back by the translation end, and parse the initial translation file. Exemplarily, the initial translation file is in the spreadsheet data format. The open source library of C++ language can be used to read the content in the initial translation file into the structure struct ct_xml_ts. Exemplarily, the layout and structure of the initial translation file are the same as those of the second file to be translated. In the parsing process, the first line in the initial translation file includes the xml root element (xml root), source (source text to be translated), target translation text (translation), comment content (comment), translation type (translation type), file storage path (location filename) and target function location (location line). The first line serves as a marker, which is convenient for translators to view and does not need to be read. The second line of the initial translation file contains the version number and the target language. If the first column of the initial translation file is empty, the parsing of the initial translation file is terminated; if it is not empty, the target translation text is obtained by reading the column corresponding to translation.

[0078] 4. Write the content stored in the structure struct ct_xml_ts into the second file to be written, which may be a ts file, to obtain a target translation file.

[0079] 5. Send the target translation file to the QT platform. The QT platform executes the compilation instruction (lrelease instruction) on the target translation file to generate the translation file (qm file) of the QT platform. The translation result of the source text to be translated is displayed by loading the qm file.

[0080] In this embodiment, different target languages ​​result in different target translation files; different target translation files are stored in different paths for easy display. During the file translation process, a visual interface can be provided to display the translation process. Exemplarily, a pre-translation selection control can be displayed on the display interface to facilitate the user to select whether to perform a pre-translation operation on the source text to be translated.

[0081] This embodiment uses Xlsx files for translation, which significantly simplifies the translation operation and improves efficiency. By adopting Xlsx files, the translation work becomes more flexible, efficient and easy to manage, providing convenience for developers and translators.

[0082] Figure 3 1 is a schematic diagram of the structure of a file translation device provided according to an embodiment of the present invention, and the device is used to execute the file translation method provided in any of the above embodiments. The device and the file translation method of the above embodiments belong to the same inventive concept, and the details not described in detail in the embodiment of the file translation device can refer to the embodiment of the above file translation method. Figure 3 As shown, the device comprises:

[0083] The file reading module 10 is used to read the first file to be translated in the target application platform and determine the attribute data corresponding to the target attribute in the first file to be translated;

[0084] A file generation module 11, configured to generate a second file to be translated corresponding to the first file to be translated based on the attribute data and the pre-constructed first file to be written, and send the second file to be translated to the translation end;

[0085] A file determination module 12, configured to determine a target translation file corresponding to the first file to be translated and displayed on the target application platform based on the initial translation file corresponding to the second file to be translated and fed back by the translation end;

[0086] The format of the first file to be translated is an extensible markup language format, the attribute data includes a source text to be translated, and the format of the first file to be written and the second file to be translated is a spreadsheet data format.

[0087] Based on any optional technical solution in the embodiment of the present invention, optionally, the file generation module 11 includes:

[0088] A writing position determination submodule, used to determine a writing position corresponding to at least one attribute data based on a preset writing rule of the first file to be written, and write the at least one attribute data to the corresponding writing position;

[0089] The second file to be translated determining submodule is used to determine the first file to be written with the attribute data as the second file to be translated corresponding to the first file to be translated.

[0090] Based on any optional technical solution in the embodiment of the present invention, optionally, the file determination module 12 includes:

[0091] A target translation text acquisition submodule, used for acquiring a target translation text corresponding to the source text to be translated based on a writing rule when the format of the initial translation file does not match the format of the first file to be translated;

[0092] A target translation file determination submodule is used to write the target translation text into a pre-created second file to be written according to the format requirements of the extensible markup language format, and determine the second file to be written in which the target translation text is written as the target translation file;

[0093] The format of the second file to be written is the Extensible Markup Language format.

[0094] Based on any optional technical solution in the embodiments of the present invention, optionally, the file generation module 11 includes:

[0095] An interface calling submodule, used to call a pre-built machine translation interface so that a machine translation platform corresponding to the machine translation interface determines a machine translation text corresponding to at least one source text to be translated;

[0096] The machine translation text acquisition submodule is used to acquire the machine translation text, write the machine translation text and attribute data into the first file to be written, and obtain the second file to be translated corresponding to the first text to be translated.

[0097] Based on any optional technical solution in the embodiments of the present invention, optionally, the interface calling submodule includes:

[0098] The request sending unit is used to send a pre-translation request to the translation end, and call a pre-built machine translation interface when receiving request passing information corresponding to the pre-translation request sent by the translation end.

[0099] Based on any optional technical solution in the embodiment of the present invention, optionally, the target attribute includes at least one of a file storage path attribute, a translation source text attribute, and a target translation text attribute;

[0100] The file reading module 10 includes:

[0101] The data reading submodule is used to read the attribute data corresponding to the target attribute of each sub-file to be translated in the first file to be translated on the target application platform, and store the attribute data into a pre-built structure.

[0102] The technical solution of the embodiment of the present invention determines the attribute data corresponding to the target attribute in the first file to be translated by reading the first file to be translated in the target application platform; based on the attribute data and the pre-constructed first file to be written, generates the second file to be translated corresponding to the first file to be translated, and sends the second file to be translated to the translation end; wherein the format of the first file to be translated is the extensible markup language format, the attribute data includes the source text to be translated, and the format of the first file to be written and the second file to be translated is the spreadsheet data format. Since the spreadsheet data format is more intuitive and easy to operate, by providing the second file to be translated in the spreadsheet data format to the translation end, it is convenient for translators to operate more accurately and effectively; finally, based on the initial translation file corresponding to the second file to be translated fed back by the translation end, the target translation file corresponding to the first file to be translated displayed on the target application platform is determined, which is conducive to improving the accuracy of the determined target translation file.

[0103] It is worth noting that in the embodiment of the above-mentioned file translation device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0104] Figure 4 1 is a schematic diagram of the structure of an electronic device for implementing the file translation method of an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0105] like Figure 4As shown, the electronic device 20 includes at least one processor 21, and a memory connected to the at least one processor 21, such as a read-only memory (ROM) 22, a random access memory (RAM) 23, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 21 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 22 or the computer program loaded from the storage unit 28 to the random access memory (RAM) 23. In RAM23, various programs and data required for the operation of the electronic device 20 can also be stored. The processor 21, ROM22 and RAM23 are connected to each other through a bus 24. An input / output (I / O) interface 25 is also connected to the bus 24.

[0106] A number of components in the electronic device 20 are connected to the I / O interface 25, including: an input unit 26, such as a keyboard, a mouse, etc.; an output unit 27, such as various types of displays, speakers, etc.; a storage unit 28, such as a disk, an optical disk, etc.; and a communication unit 29, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 29 allows the electronic device 20 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0107] The processor 21 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 21 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 21 executes the various methods and processes described above, such as a file translation method.

[0108] In some embodiments, the file translation method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 28. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 20 via the ROM 22 and / or the communication unit 29. When the computer program is loaded into the RAM 23 and executed by the processor 21, one or more steps of the file translation method described above may be performed. Alternatively, in other embodiments, the processor 21 may be configured to execute the file translation method in any other appropriate manner (e.g., by means of firmware).

[0109] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0110] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0111] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0112] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0113] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0114] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0115] This embodiment also provides a computer program product, including a computer program, which, when executed by a processor, implements the file translation method provided in any embodiment of the present application.

[0116] In the process of implementation, the computer program product can be written in one or more programming languages ​​or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0117] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0118] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for translating a document, characterized in that: include: Reading a first file to be translated in the target application platform, and determining attribute data corresponding to the target attribute in the first file to be translated; Based on the attribute data and the pre-constructed first file to be written, generating a second file to be translated corresponding to the first file to be translated, and sending the second file to be translated to the translation end; Determining a target translation file corresponding to the first file to be translated and displayed on the target application platform based on the initial translation file corresponding to the second file to be translated and fed back by the translation end; The format of the first file to be translated is an extensible markup language format, the attribute data includes a source text to be translated, and the format of the first file to be written and the second file to be translated is a spreadsheet data format.

2. The method according to claim 1, characterized in that: The step of generating a second file to be translated corresponding to the first file to be translated based on the attribute data and the pre-constructed first file to be written includes: Based on a preset writing rule of the first file to be written, determining a writing position corresponding to at least one of the attribute data, and writing the at least one attribute data to the corresponding writing position; The first file to be written in which the attribute data is written is determined as a second file to be translated corresponding to the first file to be translated.

3. The method according to claim 2, characterized in that The determining, based on the received initial translation file corresponding to the second file to be translated fed back by the translation end, a target translation file corresponding to the first file to be translated displayed on the target application platform comprises: In a case where the format of the initial translation file does not match the format of the first file to be translated, acquiring a target translation text corresponding to the source text to be translated based on the writing rule; Writing the target translation text into a pre-created second file to be written according to the format requirements of the extensible markup language format, and determining the second file to be written into which the target translation text is written as the target translation file; The format of the second file to be written is the Extensible Markup Language format.

4. The method according to claim 1, characterized in that: The step of generating a second file to be translated corresponding to the first file to be translated based on the attribute data and the pre-constructed first file to be written includes: Invoking a pre-built machine translation interface so that a machine translation platform corresponding to the machine translation interface determines a machine translation text corresponding to at least one of the source texts to be translated; The machine-translated text is obtained, and the machine-translated text and the attribute data are written into the first file to be written, so as to obtain a second file to be translated corresponding to the first text to be translated.

5. The method according to claim 4, characterized in that The calling of the pre-built machine translation interface includes: A pre-translation request is sent to the translation end, and upon receiving request passing information corresponding to the pre-translation request sent by the translation end, a pre-built machine translation interface is called.

6. The method according to claim 1, characterized in that The target attribute includes at least one of a file storage path attribute, a translation source text attribute, and a target translation text attribute; The step of reading a first file to be translated in the target application platform and determining attribute data corresponding to a target attribute in the first file to be translated includes: The attribute data corresponding to the target attribute of each sub-file to be translated in the first file to be translated on the target application platform is read, and the attribute data is stored in a pre-constructed structure.

7. A document translation device, characterized in that: include: A file reading module, used for reading a first file to be translated in a target application platform, and determining attribute data corresponding to a target attribute in the first file to be translated; A file generation module, configured to generate a second file to be translated corresponding to the first file to be translated based on the attribute data and the pre-constructed first file to be written, and send the second file to be translated to the translation end; A file determination module, configured to determine a target translation file corresponding to the first file to be translated and displayed on the target application platform based on an initial translation file corresponding to the second file to be translated and fed back by the translation end; The format of the first file to be translated is an extensible markup language format, the attribute data includes a source text to be translated, and the format of the first file to be written and the second file to be translated is a spreadsheet data format.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the document translation method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the file translation method according to any one of claims 1 to 6 when executed.

10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the file translation method according to any one of claims 1 to 6.