A translation method, device and medium for multilingual resources
Through a multilingual resource translation method, the translation engine and the extraction and write-back interface are used to solve the problem that the translation of multilingual resource in the prior art requires professional software, and efficient and professional translation effects are achieved.
Patent Information
- Application Number
- CN202211406365.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-10
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2042-11-10
AI Technical Summary
In the prior art, the translation of multilingual resources requires professional software developers to perform, resulting in unprofessional translation; while professional translators find it difficult to use these software for translation, which is inconvenient.
A multilingual resource translation method is proposed. By determining the translation product and multilingual context, calling the translation engine for language conversion, and writing the translation results back to the resource file through the extraction and write back the translation results to the resource file, avoiding the dependence of professional software.
It realizes efficient translation of multilingual resources, avoids collaborative work conflicts between developers and translators, and improves translation quality and efficiency.
Smart Images

Figure CN115719073B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a translation method, device and medium for multilingual resources. Background Art
[0002] At present, different multilingual resources are usually loaded for different languages on the market. Multilingual resource files generally require very professional software to open and edit. Such professional software is generally only available to software developers. If software developers are responsible for translation, the translation will not be professional. If professional translators are responsible for translation, most of them will not be able to use specialized software development tools for translation. Even if they learn it reluctantly, there will be many inconveniences. Summary of the invention
[0003] In order to solve the above problems, the present application proposes a translation method for multilingual resources, including: determining a translation product and determining a multilingual context of the translation product, and determining an original sentence from the translation product according to the multilingual context; determining a target language and calling a translation engine, and converting the original language of the original sentence into the target language through the translation engine to obtain a translation result; disassembling the original sentence to obtain historical vocabulary, and determining a vocabulary translation record according to the vocabulary translation corresponding to the historical vocabulary.
[0004] In one example, determining the multilingual context of the translation product specifically includes: determining translation attributes, wherein the translation attributes include but are not limited to products, modules, resource files, languages, and base paths, the product includes multiple modules, and the module includes multiple resource files; determining the multilingual context according to the translation attributes, and configuring an extraction and write-back interface according to the multilingual context.
[0005] In one example, determining the original sentence from the translation product according to the multilingual context specifically includes: determining the original sentence in the translation product through the extraction write-back interface according to the translation attributes; determining an original sentence list according to the translation attributes, and determining an original sentence record according to the original sentence list; checking the original sentence record according to the translation attributes; if the original sentence record corresponding to the translation attribute is not formed, extracting the original sentence through the extraction write-back interface according to the base path.
[0006] In one example, the method also includes: determining the integrity of the attribute value of the translation attribute; if only the product has the attribute value in the translation attribute, extracting all modules under the product through the extraction write-back interface; if both the product and the module in the translation attribute have the attribute value, and the resource file does not have the attribute value, extracting all resource files under the module through the extraction write-back interface; if the product, the module and the resource file in the translation attribute all have the attribute value, extracting the resource file through the extraction write-back interface.
[0007] In one example, the original language of the original sentence is converted into the target language by the translation engine to obtain a translation result; a plurality of the translation engines are called according to the translation attribute, and the original sentence and the target language are passed to the engine interface of each of the translation engines to obtain a plurality of the translation results.
[0008] In one example, after obtaining the plurality of translation results, the method further includes: performing lexical decomposition on the original sentence to obtain a plurality of original vocabularies, comparing the original vocabularies according to the lexical translation records to determine the historical vocabularies that are the same as the original vocabularies; if the lexical translation corresponding to the original vocabularies is the same as the lexical translation corresponding to the historical vocabularies, saving the translation result to the translation result record; if the lexical translation corresponding to the original vocabularies is different from the lexical translation corresponding to the historical vocabularies, saving the lexical translation corresponding to the original vocabularies to the lexical translation record.
[0009] In one example, after obtaining the translation result, the method further includes: determining the base path according to the translation attribute; and writing the translation result back to the resource file according to the base path through the extraction and write-back interface.
[0010] In one example, the attributes of the original sentence record include, but are not limited to, identification, product, module, resource file, multilingual resource key, original sentence, and hash value.
[0011] On the other hand, the present application also proposes a translation device for multilingual resources, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the translation device for multilingual resources can perform: determining a translation product, and determining a multilingual context of the translation product, and determining an original sentence from the translation product according to the multilingual context; determining a target language, and calling a translation engine, and converting the original language of the original sentence into the target language through the translation engine to obtain a translation result; disassembling the original sentence to obtain historical vocabulary, and determining a vocabulary translation record according to the vocabulary translation corresponding to the historical vocabulary.
[0012] On the other hand, the present application also proposes a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured to: determine a translation product, determine a multilingual context of the translation product, and determine an original sentence from the translation product based on the multilingual context; determine a target language, and call a translation engine to convert the original language of the original sentence into the target language through the translation engine to obtain a translation result; disassemble the original sentence to obtain historical vocabulary, and determine a vocabulary translation record based on the vocabulary translation corresponding to the historical vocabulary.
[0013] This application is suitable for applications with a wide range of applications, a large number of modules, and a large number of resource files, especially when it is necessary to provide high-quality multilingual translation, and when specialized translators are required, and when developers and translators are required to work independently or collaboratively. The multilingual extractor interface is used to extract multilingual resources from resource files of a specific format that require editing with a specialized IDE, and put them into an application that is friendly to translators. The application can find problems such as the original sentences being the same but translated differently, or the same word or phrase being translated differently by different people. After multiple comparisons and confirmations by the translators, the application writes back the original multilingual resource files through the multilingual writeback interface. This avoids the need for translators to use an IDE that is developer-friendly but not translator-friendly to perform translation work, avoids conflicts between developers and translators in editing the same series of files, and avoids conflicts between translators of different languages in editing the same resource files. This enables people of different professions to use their own friendly tools to work collaboratively without affecting each other. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0015] Figure 1A flowchart of a method for translating multilingual resources in an embodiment of the present application;
[0016] Figure 2 A schematic diagram of a translation device for multilingual resources in an embodiment of the present application. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0018] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0019] In the current multilingual resource translation technology on the market, if the translator uses an IDE, there will be troubles of accidentally modifying the code, and usually multiple languages need to be translated, and each translator generally only knows one foreign language, that is, different languages of the same resource package need to be opened multiple times by multiple translators of different languages. Large software products generally have many modules, and each module has many resource files, so many resource files need to be opened to complete the translation work. For the same word in the same language in different modules, it is easy to cause different translations by different translators, and the same word may be translated repeatedly, and the developer's code may be accidentally damaged.
[0020] like Figure 1 As shown, in order to solve the above problems, an embodiment of the present application provides a method for translating multilingual resources, the method comprising:
[0021] S101: Determine a translation product and a multilingual context of the translation product, and determine an original sentence from the translation product according to the multilingual context.
[0022] In the scenario of extracting and translating multilingual resources, when translators translate multilingual resources, they first select the product to be translated, which can be specific to the module to be translated or even the resource file. The system will form a multilingual extraction writeback context, i.e., multilingual context, based on the selected product, module, language, and resource file, i.e., translation attributes, and read the base path from the system configuration, as shown in the following table.
[0023]
[0024] Based on the context, the system calls the Get Extraction Writeback Interface Configuration operation of the Extraction Writeback Interface Configuration, and passes the product information in the context to the operation. The interface name passes the multilingual extraction interface. The multilingual extractor interface represents the interface standard that should be followed when extracting resource files. It is used to extract the original sentences in the multilingual resource files with characteristic formats to form a unified format. It contains an operation "Extract", as shown in the following table.
[0025]
[0026]
[0027] You will get the implementation class of the multilingual extraction interface for a specific product. The multilingual writer interface represents the interface that multilingual writing should follow to form translated resource files. It contains an operation "write back", as shown in the following table.
[0028]
[0029] The system calls the "extract" operation of the implementation class. This operation reads all relevant resource files and forms a list of original sentences in the form of product, module, resource file, resource key, and resource original sentence. The system inserts and saves this list into the multilingual original sentence record, that is, the original sentence record is formed. The multilingual original sentence record is used to record the original sentence to be translated. It contains multiple attributes: identification, product, module, resource file, multilingual resource key, original sentence, hash value, as shown in the following table.
[0030]
[0031]
[0032] If the original sentence record of the corresponding module has been formed, there is no need to repeat the operation; for example, if the English translator performs the extraction operation, the French translation does not need to click the extraction again for the same product, the same module, and the same resource file.
[0033] In one embodiment, the extraction write-back interface configuration is used to configure the specific implementation class of the extraction interface and the write-back interface. Different products and different development languages have different resource file formats and different implementation classes of extraction write-back. The "extraction write-back interface configuration" contains four attributes: identification, interface name, product, and full name of the implementation class, as shown in the following table.
[0034]
[0035] S102: Determine the target language, call a translation engine, and convert the original language of the original sentence into the target language through the translation engine to obtain a translation result.
[0036] S103: Decomposing the original sentence to obtain historical vocabulary, and determining vocabulary translation records according to vocabulary translations corresponding to the historical vocabulary.
[0037] After the translator selects "Language" and "Specific Module", the system will call the "Get All Translation Engines" operation of "Translation Engine Configuration". Among them, the translation engine interface is used to describe the interface standards that the translation engine needs to comply with. The "Translation Engine Interface" contains an operation "Translate", as shown in the following table.
[0038]
[0039] Translation engine configuration is used to configure the implementation class of the translation engine interface; there can be multiple translation engines, such as Baidu translation engine, Google translation engine, and Youdao translation engine. It contains three properties: ID, name, and translation engine implementation class. As shown in the following table.
[0040]
[0041] Translation Engine Configuration contains one operation, Get All Translation Engines, as shown in the following table.
[0042]
[0043]
[0044] The system will obtain the initial configuration information of all translation engines, and will initialize these translation engines. The above-mentioned initialization of the translation engine is only initialized once. The system will traverse the "translation" operation of the translation engine interface and pass the "original sentence" and "target language" to it, and will obtain the translation results of all translation engines for the reference of the translator; at the same time, the system will disassemble the original sentence into multiple words to form historical words, and call the "get vocabulary translation" operation of the "multilingual vocabulary translation record" to obtain the previous translation of the same word, so as to avoid the situation where the same word with the same meaning is translated differently in different sentences; after multiple comparisons and confirmations by the translator, the system will save the confirmed translation results to the "multilingual translation result record", and at the same time save the translation corresponding to the words after the original sentence is disassembled to the "multilingual vocabulary translation record" for next use.
[0045] In one embodiment, the multilingual translation result record records the result after the multilingual text is translated. The result is recorded separately by language and has a confirmation mark, that is, whether the translator has confirmed the translation result, as shown in the following table.
[0046]
[0047] In one embodiment, the multilingual vocabulary translation record is an auxiliary output of the above-mentioned "multilingual translation result record", which is used to split the original sentence before translation into vocabulary and record the corresponding translation results according to the vocabulary, that is, the same vocabulary may have different translations in different original sentences, so it is convenient to find out whether there is a translation problem. As shown in the following table.
[0048]
[0049] It contains one operation, Get Vocabulary Translation, as shown in the following table.
[0050]
[0051] After the above extraction and translation actions, the translator has completed the translation of a certain module or product in a specific language, and can write the results back to the resource file. After the translator selects "product", "module", "resource file" and "language", the system will form a "multi-language extraction and write-back context". According to the "product" information in the context, the system calls the "get extraction and write-back interface configuration" operation of the "extraction and write-back interface configuration", and passes the "multi-language write-back interface" to the operation interface name, and will obtain the "multi-language write-back interface" implementation class configuration information of the specific product. The system uses this configuration information to initialize the implementation class of the multi-language write-back interface, and calls the "write-back" operation of the implementation class. The system will translate a certain module or product in a specific language, and can write the results back to the resource file, and the translation work is completed.
[0052] like Figure 2 As shown, the embodiment of the present application also provides a translation device for multilingual resources, including:
[0053] at least one processor; and,
[0054] a memory communicatively connected to the at least one processor; wherein,
[0055] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the multilingual resource translation device to perform:
[0056] Determine a translation product, determine a multilingual context of the translation product, and determine an original sentence from the translation product according to the multilingual context;
[0057] Determine the target language, and call a translation engine to convert the original language of the original sentence into the target language through the translation engine to obtain a translation result;
[0058] The original sentence is disassembled to obtain historical vocabulary, and vocabulary translation records are determined according to vocabulary translations corresponding to the historical vocabulary.
[0059] The embodiment of the present application further provides a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured as follows:
[0060] Determine a translation product, determine a multilingual context of the translation product, and determine an original sentence from the translation product according to the multilingual context;
[0061] Determine the target language, and call a translation engine to convert the original language of the original sentence into the target language through the translation engine to obtain a translation result;
[0062] The original sentence is disassembled to obtain historical vocabulary, and vocabulary translation records are determined according to vocabulary translations corresponding to the historical vocabulary.
[0063] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0064] The devices and media provided in the embodiments of the present application correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0065] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0066] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0067] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0068] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0069] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0070] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0071] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0072] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0073] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for translating multilingual resources, characterized in that: include: Determine a translation product, determine a multilingual context of the translation product, and determine an original sentence from the translation product according to the multilingual context; Determine the target language, and call a translation engine to convert the original language of the original sentence into the target language through the translation engine to obtain a translation result; Decomposing the original sentence to obtain historical vocabulary, and determining vocabulary translation records according to vocabulary translations corresponding to the historical vocabulary; Determine the multilingual context of the translation product, including: Determine translation attributes, wherein the translation attributes include but are not limited to product, module, resource file, language, and base path, the product includes a plurality of the modules, and the module includes a plurality of the resource files; Determining the multilingual context according to the translation attribute, and configuring an extraction and write-back interface according to the multilingual context; Determining an original sentence from the translation product according to the multilingual context specifically includes: Determining the original sentence in the translation product through the extraction and write-back interface according to the translation attribute; Determining an original sentence list according to the translation attributes, and determining an original sentence record according to the original sentence list; Checking the original sentence record according to the translation attribute; If the original sentence record corresponding to the translation attribute is not formed, extracting the original sentence through the extraction and write-back interface according to the base path; According to the multilingual context, call the operation of obtaining the extraction and writing back interface configuration of the extraction and writing back interface configuration, and pass the product information in the multilingual context; the extraction and writing back interface is used to configure the specific implementation class of the extraction interface and the specific implementation class of the writing back interface. The extraction and writing back interface configuration contains four attributes: identifier, interface name, product, and full name of the implementation class; The extraction and write-back interface includes extraction and write-back operations. The extraction operation is used to extract sentences from multilingual resource files with characteristic formats to form a unified format. The extraction operation extracts multilingual resources from the entire product, the modules under the product, and the resource files. The return value of the extraction operation is a list. The attributes of the list include product, module, resource file, multilingual identifier, multilingual key, and original sentence. The write-back operation is used to write back the translated multi-language to the resource file. If the context only contains product attributes and has values, it means that the entire module is written back; if the context contains product attributes and module attributes, and both have values, it means that the translation result of the module is written back; if the context contains product attributes, module attributes, and resource file attributes, and both have values, it means that the translation result of the specific resource file is written back, and the language attribute in the context represents the language translation result of the write-back. If the language attribute returns true, it means that the translation is written back successfully. If the language attribute returns false, it means that the translation fails. Determining the completeness of the attribute value of the translation attribute; If only the product has an attribute value in the translation attribute, all modules under the product are extracted through the extraction and write-back interface; If both the product and the module in the translation attribute have attribute values, and the resource file does not have an attribute value, all resource files under the module are extracted through the extraction and write-back interface; If the product, the module and the resource file in the translation attribute all have attribute values, the resource file is extracted through the extraction and write-back interface.
2. The method according to claim 1, characterized in that: Converting the original language of the original sentence into the target language through the translation engine to obtain a translation result; The plurality of translation engines are called according to the translation attribute, and the original sentence and the target language are transmitted to the engine interface of each translation engine to obtain the plurality of translation results.
3. The method according to claim 2, characterized in that After obtaining a plurality of translation results, the method further includes: Decomposing the original sentence into words to obtain a plurality of original words, and comparing the original words with the word translation records to determine the historical words that are the same as the original words; If the vocabulary translation corresponding to the original vocabulary is the same as the vocabulary translation corresponding to the historical vocabulary, saving the translation result to the translation result record; If the vocabulary translation corresponding to the original vocabulary is different from the vocabulary translation corresponding to the historical vocabulary, the vocabulary translation corresponding to the original vocabulary is saved in the vocabulary translation record.
4. The method according to claim 1, characterized in that After obtaining the translation result, the method further includes: Determining the base path according to the translation attribute; The translation result is written back to the resource file according to the base path through the extraction and writing back interface.
5. The method according to claim 1, characterized in that The attributes of the original sentence record include but are not limited to identification, product, module, resource file, multilingual resource key, original sentence, and hash value.
6. A translation device for multilingual resources, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the multilingual resource translation device to perform the method according to any one of claims 1 to 5.
7. A non-volatile computer storage medium storing computer executable instructions, characterized in that: The computer executable instructions are configured as the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Multi-country instant online translation system based on server
CN101086731A
Professional vocabulary translation method and tool based on translation engine, and electronic equipment
CN113761953A
Multi-language translation method and device, equipment and storage medium
CN114925707A