Multi-language page conversion method and device, equipment, storage medium and program product
By extracting and annotating source language text from front-end code files and establishing a multilingual corpus, the problems of low translation accuracy and resource waste in multilingual page display are solved, achieving non-intrusive code modification and efficient multilingual page conversion.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-26
- Publication Date
- 2026-04-10
AI Technical Summary
Existing technologies suffer from low translation accuracy, resource waste, and maintenance difficulties in multilingual page display, especially in scenarios involving the switching between primary and secondary languages where resource allocation is unreasonable.
By extracting and annotating source language text from front-end code files, a multilingual corpus is established, enabling non-intrusive code modification, dynamic switching of target language text, and text matching and translation using regular expressions and abstract syntax trees. An independent and reliable corpus is built to support multilingual switching.
It enables efficient and low-cost multilingual page conversion without disrupting the original code structure, reducing resource waste, improving resource utilization and page development efficiency, and is particularly suitable for scenarios involving switching between primary and secondary languages.
Smart Images

Figure CN121835702A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of terminal display technology, and in particular to a multilingual page conversion method, apparatus, device, storage medium, and program product. Background Technology
[0002] Currently, the main methods for displaying multilingual content on front-end pages include: translation plugins, static methods, and dynamic methods. Translation plugins leverage third-party translation plugins to achieve multilingual display; when a user switches languages, the page content is translated and presented. Static methods prepare separate page files for each language, distinguished by file extensions or subdirectories; users are redirected to the corresponding page after selecting the target language. Dynamic methods use language variables to represent text content in the dynamic parts of the page; after the user selects the target language, the variable retrieves the corresponding language configuration value, enabling text switching.
[0003] Because translation plugins rely on third-party plugins, for languages like Chinese that are semantically rich and context-dependent, the translations are prone to deviating from the original meaning, resulting in low accuracy and affecting users' accurate understanding of information and normal business operations. Static translation requires repeatedly building pages for each language during the development phase, investing significant manpower and time. During subsequent feature iterations, maintaining multilingual page files synchronously becomes extremely difficult. Dynamic translation, on the other hand, does not rely on third-party plugins and effectively reduces language-independent page redundancy by using language variables, thus addressing the shortcomings of both translation plugins and static translation. However, dynamic translation suffers from a significant drawback: switching language packages incurs the same cost for all language packs, requiring intrusive code modifications and indiscriminately replacing language text in the code with language variables. It fails to consider the primary and secondary use of different languages; for example, in a scenario where Chinese is the primary language and English is secondary, resource allocation is unreasonable, leading to resource waste. Summary of the Invention
[0004] To address the problems existing in the prior art, embodiments of the present invention provide a multilingual page conversion method, apparatus, device, storage medium, and program product, which can achieve multilingual page conversion without intrusive code modification. For display scenarios with main and auxiliary bilingual page switching requirements, it can improve the rationality of resource allocation and reduce resource waste.
[0005] In a first aspect, embodiments of the present invention provide a multilingual page conversion method, including: Extract the text from the source language of the front-end code file to obtain the page text in the source language; Translate and annotate the text on the page; Based on a pre-built multilingual corpus, the translated and annotated page text is converted into translated text in the target language selected by the user; wherein, the multilingual corpus includes a set of page text in the source language mapped to translated text in multiple other languages.
[0006] As an improvement to the above solution, the source language text is extracted from the front-end code file to obtain the page text in the source language, including: Regular expressions are used to match and search the strings in the source language in the front-end code file to obtain multiple page texts in the source language.
[0007] As an improvement to the above solution, the method further includes: The multiple page texts are deduplicated, and the deduplicated multiple page texts are incrementally updated to the multilingual corpus; The newly added page text in the multilingual corpus is translated to obtain the translated page text in multiple other languages; The translated text is updated to the multilingual corpus, and a mapping relationship is established between the page text in the source language and the translated text in various other languages.
[0008] As an improvement to the above solution, the page text is translated and annotated, including: The front-end code file is parsed to obtain the code template in the front-end code; The page text is translated and annotated based on the abstract syntax tree in the code template.
[0009] As an improvement to the above solution, based on a pre-built multilingual corpus, the translated and annotated page text is converted into translated text in the user-selected target language, including: If the target language selected by the user is the same as the source language, the page text will be used for page rendering. If the target language selected by the user is not the same as the source language, the translated text in the target language corresponding to the page text is obtained from the multilingual corpus, and the page is rendered using the translated text in the target language.
[0010] As an improvement to the above solution, the method further includes: If the front-end code file is modified, the copy is extracted again from the modified front-end code file to obtain the updated page copy in the source language, and the updated page copy is translated and annotated. Obtain the translated text of the updated page in multiple other languages, and update the updated page text and its translated text in multiple other languages incrementally to the multilingual corpus.
[0011] Secondly, embodiments of the present invention provide a multilingual page conversion device, comprising: The copy extraction module is used to extract the copy in the source language of the front-end code file to obtain the page copy in the source language. The translation annotation module is used to translate and annotate the text on the page. The text conversion module is used to convert the translated and annotated page text into translated text in the target language selected by the user, based on a pre-built multilingual corpus; wherein, the multilingual corpus includes a collection of page text in the source language mapped to translated text in multiple other languages.
[0012] Thirdly, embodiments of the present invention provide a multilingual page conversion device, comprising: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the multilingual page conversion method as described in any one of the first aspects.
[0013] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the multilingual page conversion method as described in any one of the first aspects.
[0014] Fifthly, embodiments of the present invention provide a computer program product, including a computer program or instructions that, when executed by a processor, implement the multilingual page conversion method as described in any one of the first aspects.
[0015] Compared to existing technologies, the present invention provides a multilingual page conversion method, apparatus, device, storage medium, and program product, which extracts the source language text from the front-end code file to obtain the page text in the source language; then, translates and annotates the page text; and finally, based on a pre-built multilingual corpus, converts the translated and annotated page text into translated text in the target language selected by the user; wherein, the multilingual corpus includes a set of page text in the source language mapped to translated text in multiple other languages. This invention, based on the original development language's front-end code files, achieves multilingual page conversion through text extraction and translation annotation, a non-intrusive code transformation that minimizes damage to the original code file structure and content intrusion. It involves less modification, lower cost, and is less likely to cause system failures / vulnerabilities. When users need to switch to pages in other languages, only the translated page text in the required language needs to be obtained from the multilingual corpus for page rendering; no additional interface translation modifications are required. This decouples front-end development from text translation. For display scenarios with primary and secondary bilingual page switching requirements, it improves the rationality of resource allocation and reduces resource waste. Attached Figure Description
[0016] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart of a multilingual page conversion method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the overall process of multilingual page conversion provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the text translation interface provided in an embodiment of the present invention; Figure 4 This is a flowchart illustrating the text conversion process provided in an embodiment of the present invention; Figure 5 This is a structural block diagram of a multilingual page conversion device provided in an embodiment of the present invention; Figure 6 This is a structural block diagram of a multilingual page conversion device provided in an embodiment of the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] It is understood that the various numerical designations used in the embodiments of this invention are merely for descriptive convenience and are not intended to limit the scope of this application. The order of the process numbers does not imply the order of execution; the execution order of each process should be determined by its function and internal logic.
[0020] In embodiments of the invention, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, without necessarily requiring or implying any such actual relationship or order between these entities or operations. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising" does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element. The term "a plurality or several" refers to two or more.
[0021] Please see Figure 1 , Figure 1 This is a flowchart of a multilingual page conversion method provided in an embodiment of the present invention. The multilingual page conversion method specifically includes: S11: Extract the text from the source language of the front-end code file to obtain the page text in the source language; S12: Translate and annotate the text on the page; S13: Based on a pre-built multilingual corpus, the translated and annotated page text is converted into translated text in the target language selected by the user; wherein, the multilingual corpus includes a set of page text in the source language mapped to translated text in multiple other languages.
[0022] The front-end code file refers to the collection of source code files used to build the webpage. The front-end code file can be in formats such as Vue, JS, or JSON, and is not specifically limited to these formats in this invention.
[0023] As is understandable, Vue is a front-end JavaScript framework based on the MVVM (Model-View-ViewModel, data layer-page view layer-view data layer) pattern. It comprises three logical layers: View, View Model, and Model. The View layer primarily displays information to the user, the Model layer contains data information on the page, and the View Model layer acts as a bridge for communication between the View and Model layers. On one hand, it reflects data changes in the view; on the other hand, it synchronizes data changes on the page to the data layer. Thus, the View and Model layers can update each other and maintain consistency through the ViewModel layer.
[0024] This invention, based on Vue's ability to update data changes to the view in real time under the MVVM model, implements dynamic multilingual page switching using Vue format front-end code files (referred to as Vue files). The multilingual page switching described in this invention can be executed by computing devices such as servers and computers. First, a text extraction module extracts text from the front-end code file (i.e., the Vue file) to obtain the page text in the source language (i.e., the original development language of the webpage, such as Chinese). Simultaneously, a translation and annotation module translates and annotates the extracted page text. Then, the translated and annotated page text is used as input to a text conversion module. Based on the user-selected page language (i.e., the target language, also known as the user's page language, such as English), the corresponding translated text is retrieved from a multilingual language library for page rendering, thereby dynamically mapping / converting the source language page text to the target language translated text. Finally, the transformed text is reflected at the view level, thus achieving the purpose of page language switching. Figure 2 As shown. In this embodiment of the invention, when a user needs to switch to a page in another language, it is only necessary to obtain the translation file of the page text in the required language based on the multilingual corpus for page rendering. No additional interface translation modifications are required. This achieves decoupling of front-end development and text translation work and non-intrusive code modification for multilingual page conversion. It can minimize the damage to the original code file structure and the intrusion into the content. The amount of modification is smaller, the cost is lower, and it is less likely to cause system failures / vulnerabilities. At the same time, in front-end code development, only the text in a single language is needed, just like in single-language project development. There is no need to use multilingual files for front-end code development. For display scenarios with primary and secondary bilingual page switching requirements, it can improve the rationality of resource allocation and reduce resource waste.
[0025] In one optional embodiment, the source language text is extracted from the front-end code file to obtain the page text in the source language, including: Regular expressions are used to match and search the strings in the source language in the front-end code file to obtain multiple page texts in the source language.
[0026] Furthermore, the method also includes: The multiple page texts are deduplicated, and the deduplicated multiple page texts are incrementally updated to the multilingual corpus; The newly added page text in the multilingual corpus is translated to obtain the translated page text in multiple other languages; The translated text is updated to the multilingual corpus, and a mapping relationship is established between the page text in the source language and the translated text in various other languages.
[0027] For example, for a Vue format front-end code file, at the operational level, the front-end code file can be traversed, the file content can be read, and then regular expressions can be used to match Chinese characters, thereby extracting the page text in the source language (such as Chinese) from the front-end code file; the extracted Chinese page text (referred to as Chinese text) is deduplicated, and then incrementally updated to the multilingual corpus.
[0028] When a new Chinese text is detected in a multilingual corpus, it can first be matched and checked. If the multilingual corpus already contains a matching Chinese text, no further processing is needed; the new Chinese text can simply overwrite the matching text. If the multilingual corpus does not contain a matching Chinese text, then webhook technology can be used to push the information to the translation platform to notify the translation team to promptly supplement the translation of the Chinese text. This can be done for translations of other languages, such as English, Japanese, German, etc.
[0029] Understandably, the translation platform provides an entry point for translating Chinese texts to be translated, and the main functional page is as follows: Figure 3 As shown; when the "Publish" button is clicked, the translated Chinese text is updated accordingly in the multilingual corpus, realizing the multilingual corpus required by the project. The multilingual corpus stores a set of mappings from the source language (e.g., Chinese) to the translated text in various other languages (e.g., English, Japanese, etc.). In this embodiment of the invention, taking Chinese as the source language and establishing a bilingual page switching with Chinese as the primary language and English as the secondary language as the secondary language, the multilingual corpus stores a set of mappings from Chinese text to English text; for a certain Chinese text S_zh, the unique English text S_en = GetTranslate(S_zh) can be obtained through the mapping relationship from Chinese text to English text stored in the multilingual corpus.
[0030] This invention utilizes a webhook as a driving trigger to activate the @vue / compiler-sfc (VueSingle-File Component Compiler) tool for automated incremental extraction of Chinese text from front-end code files. This improves the efficiency and accuracy of Chinese text extraction, laying the foundation for subsequent internationalization translation and AST translation annotation. Simultaneously, the corpus construction is independent, reliable, and reusable, decoupling the corpus from the page code and improving the maintainability and flexibility of both. Furthermore, by introducing the corpus into front-end projects, the same corpus can be used by multiple front-end projects with similar text, improving resource utilization and saving storage space.
[0031] In one optional embodiment, translating and annotating the page text includes: The front-end code file is parsed to obtain the code template in the front-end code; The page text is translated and annotated based on the abstract syntax tree in the code template.
[0032] In this embodiment of the invention, in addition to building a multilingual corpus for the project, it is also necessary to translate and annotate the front-end code. Translation annotation refers to marking the parts of the front-end code file that require multilingual text switching, so as to control the subsequent text processing flow in the text conversion module.
[0033] Taking the switching between Chinese and English text as an example, based on Vue's ability to update the view in real time with data changes, only the code template part of the Vue-formatted front-end code file needs to be translated and annotated, without additional processing of script parts. Specifically, the @vue / compiler-sfc tool can be used to parse the Vue-formatted front-end code file, thereby separating the template part of the code and performing translation and annotation processing; then, based on the abstract syntax tree (AST) of the parsed template part, the Chinese text is translated and annotated, that is, the Chinese text in the front-end code file is annotated as input and passed to the text conversion module for processing; for example, the text conversion module is denoted as Trans, and for the annotated Chinese text S_zh, it is annotated as S_zh|Trans. When the page is executed, the Chinese text in the annotated template part will enter the text conversion processing flow.
[0034] In this embodiment of the invention, during code development, a single language (such as Chinese) can be used for development. Then, the `@vue / compiler-sfc` tool is used to automatically and incrementally extract the template portion of the Vue-formatted front-end code file for translation and annotation, enabling bilingual switching. This fundamentally solves the development experience and maintenance problems caused by the lack of Chinese text in traditional dynamic solutions. Simultaneously, the translation annotation and text conversion work together to achieve bilingual page switching. The process distinguishes between the handling of Chinese and English display requirements, effectively improving page development and operational efficiency. This is particularly suitable and efficient for bilingual systems that use one language as the primary language and the other as a secondary language.
[0035] In one optional embodiment, based on a pre-built multilingual corpus, the translated and annotated page text is converted into translated text in the user-selected target language, including: If the target language selected by the user is the same as the source language, the page text will be used for page rendering. If the target language selected by the user is not the same as the source language, the translated text in the target language corresponding to the page text is obtained from the multilingual corpus, and the page is rendered using the translated text in the target language.
[0036] In this embodiment of the invention, the text conversion module needs to introduce a multilingual corpus as the source of page text translation data. Combined with the language identifier (lang) corresponding to the target language selected by the user, the page text is processed as follows: Figure 4 As shown.
[0037] Taking the source language webpage text as Chinese text as an example, when the user selects the English page, that is, the target language corresponding to the language identifier lang=en (the target language is English), the previously built multilingual corpus is introduced, and the English translation of the current Chinese text is obtained. The return GetTranslate(S_zh) tool is used to render the page. When a user selects the Chinese page, the target language is Chinese. No processing of the current Chinese text is required; the page can be rendered directly using the Chinese text, thus achieving the effect of bilingual switching on the page.
[0038] Furthermore, the method also includes: If the front-end code file is modified, the copy is extracted again from the modified front-end code file to obtain the updated page copy in the source language, and the updated page copy is translated and annotated. Obtain the translated text of the updated page in multiple other languages, and update the updated page text and its translated text in multiple other languages incrementally to the multilingual corpus.
[0039] In this embodiment of the invention, when the code file needs to be iterated in the future, it is only necessary to extract the text from the code file as described above, translate and publish the modified (such as modified, added, etc.) page text, update the modified page text and its translation text increments in multiple other languages to the multilingual corpus, and complete the translation annotation of the page text. The specific process is described above and will not be repeated here.
[0040] Vuex is a state management pattern and library specifically designed for Vue.js applications, leveraging Vue.js's fine-grained data reactivity mechanism for efficient state updates. It uses a centralized store to manage the state of all application components and ensures that state changes in a predictable manner through corresponding rules. A state-managed application consists of several parts: state, view, and actions. By defining and isolating the various concepts in state management and maintaining the independence between view and state through enforced rules, the code becomes more structured and maintainable.
[0041] Furthermore, the step-by-step form and fine-grained caching strategy proposed in this embodiment of the invention effectively utilizes Vuex to manage shared state, enabling page switching / rendering where multiple views depend on the same state, and achieving finer-grained division of cached data (such as page text, components derived from translated text). It can be understood that all data and methods defined within a Vue component are determined based on whether they depend on a unified state and whether that unified state has changed, to determine whether to update or cache existing data. Based on user behavior, the following can be defined: if the unified state was not changed in the previous step and does not depend on it, the next step caches the data; if the unified state was not changed in the previous step but depends on it, the next step caches the data; if the unified state was changed in the previous step but does not depend on it, the next step caches the data; if the unified state was changed in the previous step and depends on it, the next step refreshes the data, making a unified assignment request to the data. The page switching / rendering process based on the step-by-step form and fine-grained caching strategy includes keeping dynamic components active (keep-alive) and fine-grained caching, as detailed below: Dynamic component keep-alive: First, the text (including page text and translated text) needs to be broken down into individual components. For step-by-step forms, construct abstract components that maintain consistency with the design content of each page of the form. If the content of a single page component is too large, it can be further broken down; this will not be elaborated on here. To implement the form page, import all the split components and use Vue's built-in...<component>The `Is` property dynamically specifies the component to be rendered, enabling dynamic component rendering. The value of the `Is` property, `activeComponent`, uniquely identifies the currently active component based on the `currentStep` index. `activeComponent` is defined in a computed property and its calculation is cached based on dependencies. It is only updated when its related dependencies change. For details, please refer to Vue's computed property caching mechanism, which will not be elaborated here.
[0042] Then, within each of the split components, the `changeStep` callback function is used to change the value of `currentStep`, and the `emit` method is used to notify the parent component (e.g., the form page). Within the parent component (i.e., the form page), a footer component is imported. The footer component defines the previous and next information pages, and the computed property `activeComponent` is updated, thus switching components. By default, the state of a component cannot be maintained when switching dynamic components. In this case, Vue's built-in... <keep-alive>The component keeps the state of the dynamic component. In this way, when switching from the previous page to the next page, the form on the previous page is not destroyed, and the data filled in or selected by the user in the form is kept unchanged instead of disappearing.
[0043] Fine-grained caching: In addition to the dynamic component implementation cache, all data dependencies of the previous step or several steps inside the sub-component need to be combed and mapped. The so-called data dependency refers to a user-operable changed attribute field of a component, which is an input request parameter for obtaining the selected value of another component attribute field value, so as to control the cache processing mechanism of all data inside the dependent component in different ways.
[0044] The fine-grained caching strategy proposed in the embodiment of the application is based on the fact that Vuex can share the changes of data among multiple components, so the data dependencies combed in the previous step need to be defined in the state (state) as shared data and storage variables. The method for modifying the logic of the shared data state in the state is defined in the mutations (an object containing all state change units). The action (a place for processing business logic, including asynchronous operations) function submits the mutation (state change unit) asynchronous operation, and listens to the state shared data in the sub-component (split component) inside. For details, refer to the vue step-by-step form and fine-grained caching mechanism, which will not be described in detail here.
[0045] Compared with the prior art, the embodiment of the application proposes a multi-language page conversion method based on vue. The Chinese text of the website is used as basic data, and when it is necessary to switch to English, the basic data is dynamically converted, and finally the changed text data is reflected to the view layer in real time, achieving the purpose of page language switching. At the same time, during the code development process, Chinese text is still used for development, and then the template part of the vue format front-end code file is automatically extracted and translated by using the @vue / compiler-sfc tool to realize bilingual switching, which can fundamentally solve the development experience and maintenance problems caused by the lack of Chinese text in the traditional dynamic solution.
[0046] The front-end internationalization is realized by using the non-invasive original code text method, which can minimize the damage to the original code file structure and the invasion of the content, has smaller changes, lower cost, and is less likely to cause system failure / vulnerabilities. At the same time, for the interface level data, the step of interface modification in the existing solution can be skipped. When the text data returned by the interface needs to be displayed on the page, the text can be extracted and input into the text conversion module, and the target language can be output and displayed on the page without additional interface translation modification.
[0047] The constructed multilingual corpus is independent, reliable, and reusable, decoupling the corpus from the front-end code files of the pages and improving the maintainability and flexibility of both. Furthermore, by introducing the corpus into the front-end project, the same corpus can be reused by multiple front-end projects with high text commonality, reducing resource redundancy, improving resource utilization, and saving storage space. At the same time, it avoids the drawbacks of existing dynamic solutions that treat multiple language switching methods indiscriminately, improving page performance and making it more suitable for systems with primary and secondary bilingual requirements.
[0048] The translation annotation and text conversion modules work together to enable bilingual switching on the page. The process distinguishes between the handling of Chinese and English display requirements, which can effectively improve the efficiency of page development and operation. It is especially suitable and more efficient for bilingual systems that use one language as the primary language and the other as a secondary language.
[0049] See Figure 5 , Figure 5 This is a structural block diagram of a multilingual page conversion device provided in an embodiment of the present invention. The multilingual page conversion device includes: The copy extraction module 11 is used to extract the copy in the source language of the front-end code file to obtain the page copy in the source language. Translation annotation module 12 is used to translate and annotate the page text; The text conversion module 13 is used to convert the translated and annotated page text into translated text in the target language selected by the user based on a pre-built multilingual corpus; wherein, the multilingual corpus includes a collection of page text in the source language mapped to translated text in multiple other languages.
[0050] In one optional embodiment, the text extraction module 11 includes: The regular expression matching unit is used to match and search the strings of the source language in the front-end code file using regular expressions to obtain multiple page texts in the source language.
[0051] In an optional embodiment, the device further includes: The deduplication module is used to deduplicatize multiple page texts and incrementally update the deduplicated page texts to the multilingual corpus. The translation module is used to translate the newly added page text in the multilingual corpus to obtain the translated text of the corresponding page text in multiple other languages; The copywriting update module is used to update the translated copywriting to the multilingual corpus and establish a mapping relationship between the page copywriting in the source language and the translated copywriting in various other languages.
[0052] In one optional embodiment, the translation annotation module 12 includes: The template acquisition unit is used to parse the front-end code file and obtain the code template in the front-end code; The text annotation unit is used to translate and annotate the page text based on the abstract syntax tree in the code template.
[0053] In one optional embodiment, the text conversion module 13 includes: The first rendering unit is used to render the page using the page text when the target language selected by the user is the same as the source language. The second rendering unit is used to obtain the translated text in the target language corresponding to the page text from the multilingual corpus when the target language selected by the user is not the same as the source language, and to render the page using the translated text in the target language.
[0054] In an optional embodiment, the device further includes: The text extraction and annotation module is used to extract text from the modified front-end code file when the front-end code file is modified, obtain the updated page text in the source language, and translate and annotate the updated page text. The incremental update module is used to obtain the translated text of the updated page in multiple other languages, and incrementally update the updated page text and its translated text in multiple other languages to the multilingual corpus.
[0055] It should be noted that the working process of each module in the multilingual page conversion device described in the embodiments of the present invention can refer to the working process of the multilingual page conversion method described in the above embodiments, and the technical effect achieved is the same as that of the multilingual page conversion method described in the above embodiments, so it will not be repeated here.
[0056] See Figure 6 , Figure 6 This is a structural block diagram of a multilingual page conversion device provided in an embodiment of the present invention. The multilingual page conversion device includes a processor 21, a memory 22, and a computer program stored in the memory 22 and executable on the processor 21. When the processor 21 executes the computer program, it implements the steps in the various multilingual page conversion method embodiments described above, such as steps S11 to S13.
[0057] For example, the computer program may be divided into one or more modules or units, which are stored in the memory 22 and executed by the processor 21 to complete the present invention. The one or more modules or units may be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the multilingual page conversion device.
[0058] The multilingual page conversion device may include, but is not limited to, a processor 21 and a memory 22. Those skilled in the art will understand that the schematic diagram is merely an example of a multilingual page conversion device and does not constitute a limitation on the device. It may include more or fewer components than illustrated, or combine certain components, or use different components. For example, the multilingual page conversion device may also include input / output devices, network access devices, buses, etc.
[0059] The processor 21 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor 21 is the control center of the multilingual page conversion device, connecting various parts of the device via various interfaces and lines.
[0060] The memory 22 can be used to store the computer programs and / or modules. The processor 21 implements various functions of the multilingual page conversion device by running or executing the computer programs and / or modules stored in the memory 22 and calling the data stored in the memory 22. The memory 22 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 22 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0061] If the modules or units integrated into the multilingual page conversion device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by the processor 21, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0062] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0063] The above description represents the preferred embodiments of the present invention. It should be noted that, for those skilled in the art, various improvements and modifications can be made without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention. < / component>
Claims
1. A multi-lingual page conversion method, characterized by, The method comprises the following steps: text extraction of a front-end code file in a source language to obtain page text in the source language; translation annotation of the page text; conversion of the page text after translation annotation into translated text in a target language selected by a user according to a pre-constructed multilingual corpus, wherein the multilingual corpus comprises a collection of translated text in multiple other languages mapped from the page text in the source language.
2. The multi-lingual page conversion method of claim 1, wherein, The text extraction of the front-end code file in the source language to obtain the page text in the source language comprises: matching and searching for strings in the source language in the front-end code file by using a regular expression to obtain multiple page texts in the source language.
3. The multi-lingual page conversion method of claim 2, wherein, The method further comprises: de-duplication processing of the multiple page texts and incremental updating of the multiple page texts after de-duplication into the multilingual corpus; translation of the newly added page texts in the multilingual corpus to obtain translated text in multiple other languages corresponding to the page texts; updating of the translated text into the multilingual corpus and establishment of a mapping relationship between the page text in the source language and the translated text in multiple other languages.
4. The multi-lingual page conversion method of claim 1, wherein, The translation annotation of the page text comprises: parsing of the front-end code file to obtain a code template in the front-end code; translation annotation of the page text according to an abstract syntax tree in the code template.
5. The multi-lingual page conversion method of claim 1, wherein, The conversion of the page text after translation annotation into translated text in a target language selected by a user according to a pre-constructed multilingual corpus comprises: in the case where the target language selected by the user and the source language are the same language, page rendering is performed by using the page text; in the case where the target language selected by the user and the source language are not the same language, translated text in the target language corresponding to the page text is obtained from the multilingual corpus, and page rendering is performed by using the translated text in the target language.
6. The multi-lingual page conversion method of claim 5, wherein, The method further comprises: in the case where the front-end code file is modified, text extraction is performed again on the modified front-end code file to obtain updated page text in the source language, and translation annotation is performed on the updated page text; obtaining of translated text in multiple other languages of the updated page text and incremental updating of the updated page text and the translated text in multiple other languages into the multilingual corpus.
7. A multi-lingual page conversion apparatus, characterized by comprising: The method comprises the following steps: a text extraction module configured to perform text extraction of a front-end code file in a source language to obtain page text in the source language; a translation annotation module configured to perform translation annotation of the page text; a text conversion module configured to convert the page text after translation annotation into translated text in a target language selected by a user according to a pre-constructed multilingual corpus, wherein the multilingual corpus comprises a collection of translated text in multiple other languages mapped from the page text in the source language.
8. A multi-lingual page conversion apparatus, characterized by comprising: The method comprises the following steps: The processor, the memory, and a computer program stored in the memory and configured to be executed by the processor, the processor implementing the multilingual page conversion method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, wherein the computer program controls a device where the computer readable storage medium is located to implement the multilingual page conversion method according to any one of claims 1 to 6 when the computer program is running.
10. A computer program product comprising computer programs or instructions, characterized in that, The computer program or the instructions implement the multilingual page conversion method according to any one of claims 1 to 6 when executed by the processor.