Method and device for realizing web system

文档序号:1889978 发布日期:2021-11-26 浏览:21次 中文

阅读说明:本技术 一种web系统的实现方法和装置 (Method and device for realizing web system ) 是由 杨兵 周海波 于 2020-05-22 设计创作,主要内容包括:本发明公开了一种web系统的实现方法和装置,涉及计算机技术领域。该方法的一具体实施方式包括:对第一语种web系统的源代码进行词汇挖掘,得到第一语种词汇文件;根据第一语种词汇文件将第一语种web系统的源代码中的第一语种词汇替换为对应的词汇标识,以得到目标源代码;获取第一多语种词汇文件,第一多语种词汇文件是在第一语种词汇文件中添加其他语种得到的,根据第一多语种词汇文件分别生成各语种的语言包,以根据目标源代码和各语种的语言包分别实现各语种web系统。该实施方式能够降低web系统国际化改造的工作量,节省改造耗时,提高改造效率和翻译效率,并降低后期出现词汇与词汇文件不同步、翻译需要局部修改等情况时的维护成本。(The invention discloses a method and a device for realizing a web system, and relates to the technical field of computers. One embodiment of the method comprises: performing vocabulary mining on a source code of the first language web system to obtain a first language vocabulary file; replacing the first language vocabulary in the source code of the first language web system with a corresponding vocabulary identifier according to the first language vocabulary file to obtain a target source code; and acquiring a first multilingual vocabulary file, wherein the first multilingual vocabulary file is obtained by adding other languages into the first language vocabulary file, and generating language packages of all languages according to the first multilingual vocabulary file respectively so as to realize web systems of all languages respectively according to the target source code and the language packages of all languages. According to the embodiment, the workload of the internationalized transformation of the web system can be reduced, the transformation time is saved, the transformation efficiency and the translation efficiency are improved, and the maintenance cost when the situations that the vocabulary and the vocabulary file are not synchronous and the translation needs to be locally modified and the like occur in the later stage is reduced.)

1. A method for implementing a web system, comprising:

performing vocabulary mining on a source code of the first language web system to obtain a first language vocabulary file comprising a first language vocabulary and a corresponding vocabulary identifier;

replacing the first language vocabulary in the source code of the first language web system with a corresponding vocabulary identifier according to the first language vocabulary file to obtain a target source code;

and acquiring a first multilingual vocabulary file, wherein the first multilingual vocabulary file is obtained by adding other languages into the first language vocabulary file, and language packages of various languages are respectively generated according to the first multilingual vocabulary file so as to respectively realize web systems of various languages according to the target source code and the language packages of various languages, wherein the various languages comprise the first language and the other languages.

2. The method of claim 1, wherein vocabulary mining source code of the first language web system to obtain a first language vocabulary file including the first language vocabulary and corresponding vocabulary identification comprises:

traversing the code library file of the first language web system to match out the first language vocabulary in the code library file;

and generating corresponding vocabulary identification for the matched first language vocabulary, and generating the first language vocabulary file comprising the matched first language vocabulary and the corresponding vocabulary identification.

3. The method of claim 2, wherein said replacing a first language vocabulary in source code of said first language web system from said first language vocabulary file with a corresponding vocabulary identification comprises:

and searching characters matched with the original content corresponding to the first language vocabulary in the file content of the code library file to which the first language vocabulary belongs, and replacing the searched characters with the vocabulary identification corresponding to the first language vocabulary, wherein the original content corresponding to the first language vocabulary is recorded in the first language vocabulary file.

4. The method of claim 3, wherein the vocabulary identification corresponding to the vocabulary of the first language comprises: and the path, the file name and the vocabulary index value of the code library file to which the first language vocabulary belongs are used for acquiring the file content.

5. The method of claim 1, wherein generating language packs of respective languages from the first multilingual vocabulary file comprises:

generating language package files of all languages according to the language quantity and the language name in the first multilingual vocabulary file;

and taking out each vocabulary identification and each corresponding language vocabulary from the first multilingual vocabulary file, and writing the vocabulary identification and each corresponding language vocabulary into the language packet file of the corresponding language in a specific data form respectively, wherein each language vocabulary comprises the first language vocabulary and the vocabularies of other languages.

6. The method of claim 5, wherein prior to obtaining the first multilingual vocabulary file, further comprising:

searching for a vocabulary in the same language as the first language vocabulary in the first language vocabulary file in an existing multilingual vocabulary file;

and acquiring the vocabularies of other languages corresponding to the searched vocabularies from the stored multilingual vocabulary files, and adding the vocabularies into the first language vocabulary file.

7. The method according to claim 5, wherein after said implementing a languages web system, further comprising:

respectively reading the vocabulary in the language packet of the first language and the vocabulary in the language packets of the other languages from the language packets of the languages so as to generate a second multilingual vocabulary file to be modified;

and after the second multilingual vocabulary file is modified, regenerating the language packages of all languages according to the modified second multilingual vocabulary file, so as to respectively realize the web systems of all languages again according to the target source code and the regenerated language packages of all languages.

8. An apparatus for implementing a web system, comprising:

the vocabulary mining module is used for performing vocabulary mining on a source code of the first language web system to obtain a first language vocabulary file comprising a first language vocabulary and a corresponding vocabulary identifier;

the vocabulary replacement module is used for replacing the first language vocabulary in the source code of the first language web system with the corresponding vocabulary identification according to the first language vocabulary file so as to obtain a target source code;

a language package generation module, configured to obtain a first multilingual vocabulary file, where the first multilingual vocabulary file is obtained by adding another language to the first language vocabulary file, and generate language packages of various languages according to the first multilingual vocabulary file, where each language includes the first language and the other language;

and the web system realization module is used for respectively realizing web systems of various languages according to the target source code and the language packages of various languages.

9. The apparatus of claim 8, wherein the vocabulary mining module is further configured to:

traversing the code library file of the first language web system to match out the first language vocabulary in the code library file;

and generating corresponding vocabulary identification for the matched first language vocabulary, and generating the first language vocabulary file comprising the matched first language vocabulary and the corresponding vocabulary identification.

10. The apparatus of claim 9, wherein the vocabulary replacement module is further configured to:

and searching characters matched with the original content corresponding to the first language vocabulary in the file content of the code library file to which the first language vocabulary belongs, and replacing the searched characters with the vocabulary identification corresponding to the first language vocabulary, wherein the original content corresponding to the first language vocabulary is recorded in the first language vocabulary file.

11. The apparatus of claim 8, wherein the language pack generation module is further configured to:

generating language package files of all languages according to the language quantity and the language name in the first multilingual vocabulary file;

and taking out each vocabulary identification and each corresponding language vocabulary from the first multilingual vocabulary file, and writing the vocabulary identification and each corresponding language vocabulary into the language packet file of the corresponding language in a specific data form respectively, wherein each language vocabulary comprises the first language vocabulary and the vocabularies of other languages.

12. The apparatus of claim 11, further comprising a vocabulary multiplexing module to:

searching for a vocabulary in the same language as the first language vocabulary in the first language vocabulary file in an existing multilingual vocabulary file;

and acquiring the vocabularies of other languages corresponding to the searched vocabularies from the stored multilingual vocabulary files, and adding the vocabularies into the first language vocabulary file.

13. The apparatus of claim 11, further comprising a multilingual vocabulary file export module configured to:

respectively reading the vocabulary in the language packet of the first language and the vocabulary in the language packets of the other languages from the language packets of the languages so as to generate a second multilingual vocabulary file to be modified;

the language pack generation module is further used for regenerating the language packs of all languages according to the modified second multilingual vocabulary files after the second multilingual vocabulary files are modified;

and the web system implementation module is further used for respectively implementing the web systems of the languages again according to the target source code and the regenerated language packages of the languages.

14. An electronic device, comprising:

one or more processors;

a memory for storing one or more programs,

the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method recited in any of claims 1-7.

15. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.

Technical Field

The invention relates to the technical field of computers, in particular to a method and a device for realizing a web system.

Background

With the increasing overseas business, the number of internet systems that need to be internationally modified is rapidly increasing. For example, the front-end system is directly oriented to the user and includes most of the vocabulary of the web (internet) system, so that the workload of the front-end system is usually the largest in the international transformation of the web system, and therefore, the improvement of the international development efficiency of the front-end system plays an important role in landing the international business. When the current front-end system is internationally transformed, a front-end developer needs to find out the Chinese vocabulary of all files in a code base, manually input a Chinese language package and input Chinese into excel; and finally, manually replacing the Chinese in the code with an internationalized identifier. And circularly operating the steps, and after all Chinese characters in the code base are found out, giving the complete excel form to a translator for translation. After taking excel, a translator needs to manually check and search whether each vocabulary in the table is translated or not, manually copy the existing translation result, and then translate other vocabularies one by one. And after the translation result is taken by the front-end developer, the front-end developer manually inputs other language packages according to the format of the Chinese language package.

In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:

the existing web system international transformation has the disadvantages of huge workload, long consumed time and low efficiency, a large amount of operations need to be completed manually by research and development personnel, the translation efficiency of translation personnel is low, and when the situation that vocabulary and excel are not synchronous or translation needs to be modified locally occurs in later-stage maintenance, the development personnel need to find missing words manually and enter words to be modified manually, so that the maintenance cost is very high.

Disclosure of Invention

In view of this, embodiments of the present invention provide a method and an apparatus for implementing a web system, which can reduce the workload of internationalized transformation of the web system, save time consumed by transformation, improve transformation efficiency and translation efficiency, and reduce the later maintenance cost.

To achieve the above object, according to an aspect of the embodiments of the present invention, an implementation method of a web system is provided.

A method for implementing a web system, comprising: performing vocabulary mining on a source code of the first language web system to obtain a first language vocabulary file comprising a first language vocabulary and a corresponding vocabulary identifier; replacing the first language vocabulary in the source code of the first language web system with a corresponding vocabulary identifier according to the first language vocabulary file to obtain a target source code; and acquiring a first multilingual vocabulary file, wherein the first multilingual vocabulary file is obtained by adding other languages into the first language vocabulary file, and language packages of various languages are respectively generated according to the first multilingual vocabulary file so as to respectively realize web systems of various languages according to the target source code and the language packages of various languages, wherein the various languages comprise the first language and the other languages.

Optionally, the performing vocabulary mining on the source code of the first language web system to obtain a first language vocabulary file including the first language vocabulary and corresponding vocabulary identifiers includes: traversing the code library file of the first language web system to match out the first language vocabulary in the code library file; and generating corresponding vocabulary identification for the matched first language vocabulary, and generating the first language vocabulary file comprising the matched first language vocabulary and the corresponding vocabulary identification.

Optionally, the replacing, according to the first language vocabulary file, a first language vocabulary in source code of the first language web system with a corresponding vocabulary identifier includes: and searching characters matched with the original content corresponding to the first language vocabulary in the file content of the code library file to which the first language vocabulary belongs, and replacing the searched characters with the vocabulary identification corresponding to the first language vocabulary, wherein the original content corresponding to the first language vocabulary is recorded in the first language vocabulary file.

Optionally, the vocabulary identifier corresponding to the vocabulary in the first language includes: and the path, the file name and the vocabulary index value of the code library file to which the first language vocabulary belongs are used for acquiring the file content.

Optionally, the generating language packs of different languages according to the first multilingual vocabulary file includes: generating language package files of all languages according to the language quantity and the language name in the first multilingual vocabulary file; and taking out each vocabulary identification and each corresponding language vocabulary from the first multilingual vocabulary file, and writing the vocabulary identification and each corresponding language vocabulary into the language packet file of the corresponding language in a specific data form respectively, wherein each language vocabulary comprises the first language vocabulary and the vocabularies of other languages.

Optionally, before the obtaining the first multilingual vocabulary file, the method further includes: searching for a vocabulary in the same language as the first language vocabulary in the first language vocabulary file in an existing multilingual vocabulary file; and acquiring the vocabularies of other languages corresponding to the searched vocabularies from the stored multilingual vocabulary files, and adding the vocabularies into the first language vocabulary file.

Optionally, after the implementation of the web systems of various languages, the method further includes: respectively reading the vocabulary in the language packet of the first language and the vocabulary in the language packets of the other languages from the language packets of the languages so as to generate a second multilingual vocabulary file to be modified; and after the second multilingual vocabulary file is modified, regenerating the language packages of all languages according to the modified second multilingual vocabulary file, so as to respectively realize the web systems of all languages again according to the target source code and the regenerated language packages of all languages.

According to another aspect of the embodiment of the invention, an implementation device of a web system is provided.

An apparatus for implementing a web system, comprising: the vocabulary mining module is used for performing vocabulary mining on a source code of the first language web system to obtain a first language vocabulary file comprising a first language vocabulary and a corresponding vocabulary identifier; the vocabulary replacement module is used for replacing the first language vocabulary in the source code of the first language web system with the corresponding vocabulary identification according to the first language vocabulary file so as to obtain a target source code; a language package generation module, configured to obtain a first multilingual vocabulary file, where the first multilingual vocabulary file is obtained by adding another language to the first language vocabulary file, and generate language packages of various languages according to the first multilingual vocabulary file, where each language includes the first language and the other language; and the web system realization module is used for respectively realizing web systems of various languages according to the target source code and the language packages of various languages.

Optionally, the vocabulary mining module is further configured to: traversing the code library file of the first language web system to match out the first language vocabulary in the code library file; and generating corresponding vocabulary identification for the matched first language vocabulary, and generating the first language vocabulary file comprising the matched first language vocabulary and the corresponding vocabulary identification.

Optionally, the vocabulary replacement module is further configured to: and searching characters matched with the original content corresponding to the first language vocabulary in the file content of the code library file to which the first language vocabulary belongs, and replacing the searched characters with the vocabulary identification corresponding to the first language vocabulary, wherein the original content corresponding to the first language vocabulary is recorded in the first language vocabulary file.

Optionally, the vocabulary identifier corresponding to the vocabulary in the first language includes: and the path, the file name and the vocabulary index value of the code library file to which the first language vocabulary belongs are used for acquiring the file content.

Optionally, the language pack generation module is further configured to: generating language package files of all languages according to the language quantity and the language name in the first multilingual vocabulary file; and taking out each vocabulary identification and each corresponding language vocabulary from the first multilingual vocabulary file, and writing the vocabulary identification and each corresponding language vocabulary into the language packet file of the corresponding language in a specific data form respectively, wherein each language vocabulary comprises the first language vocabulary and the vocabularies of other languages.

Optionally, the system further comprises a vocabulary multiplexing module, configured to: searching for a vocabulary in the same language as the first language vocabulary in the first language vocabulary file in an existing multilingual vocabulary file; and acquiring the vocabularies of other languages corresponding to the searched vocabularies from the stored multilingual vocabulary files, and adding the vocabularies into the first language vocabulary file.

Optionally, the system further comprises a multilingual vocabulary file export module, configured to: respectively reading the vocabulary in the language packet of the first language and the vocabulary in the language packets of the other languages from the language packets of the languages so as to generate a second multilingual vocabulary file to be modified; the language pack generation module is further used for regenerating the language packs of all languages according to the modified second multilingual vocabulary files after the second multilingual vocabulary files are modified; and the web system implementation module is further used for respectively implementing the web systems of the languages again according to the target source code and the regenerated language packages of the languages.

According to yet another aspect of an embodiment of the present invention, an electronic device is provided.

An electronic device, comprising: one or more processors; a memory for storing one or more programs, which when executed by the one or more processors, cause the one or more processors to implement the method for implementing the web system provided by the embodiment of the present invention.

According to yet another aspect of an embodiment of the present invention, a computer-readable medium is provided.

A computer-readable medium, on which a computer program is stored, which, when executed by a processor, implements the method for implementing the web system provided by the embodiments of the present invention.

One embodiment of the above invention has the following advantages or benefits: performing vocabulary mining on a source code of the first language web system to obtain a first language vocabulary file; replacing the first language vocabulary in the source code of the first language web system with a corresponding vocabulary identifier according to the first language vocabulary file to obtain a target source code; and acquiring a first multilingual vocabulary file, wherein the first multilingual vocabulary file is obtained by adding other languages into the first language vocabulary file, and generating language packages of all languages according to the first multilingual vocabulary file respectively so as to realize web systems of all languages respectively according to the target source code and the language packages of all languages. The workload of the international transformation of the web system can be reduced, the transformation time is saved, the transformation efficiency and the translation efficiency are improved, and the maintenance cost when the conditions that the vocabulary and the vocabulary file are asynchronous and the translation needs to be locally modified and the like are generated in the later stage is reduced.

Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.

Drawings

The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:

FIG. 1 is a diagram illustrating the main steps of a method for implementing a web system according to one embodiment of the present invention;

FIG. 2 is a flow diagram illustrating an implementation of a web system according to one embodiment of the present invention;

FIG. 3 is a schematic diagram of a Chinese vocabulary file in accordance with one embodiment of the present invention;

FIG. 4 is a schematic diagram illustrating a comparison between a conventional front-end system international reconstruction process and a front-end system international reconstruction process according to an embodiment of the present invention;

FIG. 5 is a schematic diagram of the main modules of an implementation apparatus of a web system according to one embodiment of the present invention;

FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;

fig. 7 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.

Detailed Description

Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.

Fig. 1 is a schematic diagram of main steps of an implementation method of a web system according to one embodiment of the present invention.

As shown in fig. 1, the method for implementing a web system according to an embodiment of the present invention mainly includes the following steps S101 to S103.

Step S101: and carrying out vocabulary mining on the source code of the first language web system to obtain a first language vocabulary file comprising the first language vocabulary and the corresponding vocabulary identification.

Step S102: and replacing the first language vocabulary in the source code of the first language web system with the corresponding vocabulary identification according to the first language vocabulary file to obtain the target source code.

Step S103: the method comprises the steps of obtaining a first multilingual vocabulary file, adding other languages into the first language vocabulary file, respectively generating language packages of various languages according to the first multilingual vocabulary file, and respectively realizing web systems of various languages according to target source codes and the language packages of various languages, wherein the various languages comprise the first language and the other languages.

The first language web system is a current language web system, and web systems of other languages can be obtained by internationally transforming the first language web system. For example, the first language web system is a chinese language web system, and for example, an english web system, a japanese web system, a korean web system, and the like can be obtained by internationalization.

The first language vocabulary file has a specific file format, and may be an excel file, for example.

For example, the source code of the chinese web system is word mined to obtain a chinese word file, which includes chinese words and corresponding word identifiers.

In one embodiment, performing vocabulary mining (abbreviated as word mining) on source code of a first language web system to obtain a first language vocabulary file including a first language vocabulary and a corresponding vocabulary identifier includes: traversing a code library file of the first language web system to match first language vocabularies in the code library file; and generating a corresponding vocabulary identification for the matched first language vocabulary, and generating a first language vocabulary file comprising the matched first language vocabulary and the corresponding vocabulary identification.

The code library file of the web system is each file in the code library of the web system. The first language vocabulary in the matching code library file can be specifically matched by a regular matching method, for example, a Chinese vocabulary is obtained by Chinese regular matching.

Replacing the first language vocabulary in the source code of the first language web system with the corresponding vocabulary identifier according to the first language vocabulary file, which may specifically include: and searching characters matched with the original content corresponding to the first language vocabulary in the file content of the code library file to which the first language vocabulary belongs, and replacing the searched characters with the vocabulary identification corresponding to the first language vocabulary, wherein the original content corresponding to the first language vocabulary is recorded in the first language vocabulary file.

In one embodiment, the vocabulary identification corresponding to the first language vocabulary may include: and the path, the file name and the vocabulary index value of the code library file to which the vocabulary of the first language belongs are used for acquiring the file content.

In one embodiment, generating language packages of different languages according to the first multilingual vocabulary file includes: generating language package files of various languages according to the language quantity and the language name in the first multilingual vocabulary file; and taking out each vocabulary identification and each corresponding language vocabulary from the first multilingual vocabulary file, and writing the vocabulary identification and each corresponding language vocabulary into the language packet file of the corresponding language in a specific data form respectively, wherein each language vocabulary comprises the first language vocabulary and the vocabulary of other languages.

A specific data form such as a json (JavaScript Object Notation) data form.

In one embodiment (embodiment one), before the first multilingual vocabulary file is obtained, the existing multilingual vocabulary file may be searched for the same vocabulary as the first language vocabulary in the first language vocabulary file; and acquiring vocabularies of other languages corresponding to the searched vocabularies from the stored multilingual vocabulary files, and adding the vocabularies into the first language vocabulary file.

In another embodiment (embodiment two), different from the first embodiment, the above-mentioned searching for the same vocabulary as the first language vocabulary in the first language vocabulary file in the existing multilingual vocabulary file may be performed before step S102; and acquiring the vocabularies of other languages corresponding to the searched vocabularies from the stored multilingual vocabulary files, and adding the vocabularies into the first language vocabulary file.

Sending the first language vocabulary file after adding the vocabularies of other languages corresponding to the searched vocabularies to the translator client so that the translator can add other languages in the first language vocabulary file, namely: and translating the first language vocabulary without a translation result on the basis of the first language vocabulary file to obtain corresponding other language vocabularies, and finally returning the first multilingual vocabulary file obtained after the translation is finished by a translator.

In an embodiment, after the web system of each language is implemented, the vocabulary in the language packet of the first language and the vocabulary in the language packets of other corresponding languages can be read from the language packets of each language respectively to generate a second multilingual vocabulary file to be modified; after the second multilingual vocabulary file is modified, language packages of all languages are regenerated according to the modified second multilingual vocabulary file, and the web systems of all languages are respectively realized again according to the target source codes and the regenerated language packages of all languages.

According to the embodiment of the invention, the research and development workload of the international transformation of the web system can be reduced, the transformation time is saved, the transformation efficiency and the translation efficiency are improved, the maintenance cost in the later period when the vocabulary and the vocabulary file are asynchronous and the translation needs to be locally modified is reduced, and the international transformation of the web system is automatically, quickly and accurately assisted by a developer.

FIG. 2 is a flow diagram illustrating an implementation of a web system according to one embodiment of the invention.

Taking the international transformation of a front-end system as an example, the embodiment of the invention develops an international auxiliary tool to realize the implementation process of the web system of the embodiment of the invention. The internationalized auxiliary tool provided by the embodiment of the invention mainly comprises the functions of word mining, word replacing, language pack generation, excel comparison and multiplexing, excel package reverse-guiding, and the like.

Specifically, the international transformation for the chinese front-end system is taken as an example, that is, the chinese is transformed into the front-end system of other languages.

As shown in FIG. 2, the Chinese vocabulary in the project code of the Chinese front-end system can be quickly found through the vocabulary mining step and an excel file (the excel file is not shown in FIG. 2) is generated. Specifically, a code base of a chinese front-end system is read first, all files of the code base are traversed, chinese regular matching is performed on a source code of each traversed file to match a chinese vocabulary, then the matched chinese vocabulary is traversed, a corresponding vocabulary identifier is generated for each chinese vocabulary, and to ensure that the vocabulary identifier is unique, a code base file path (file path for short) + file name + vocabulary index value can be spliced, for example: the first vocabulary of the/view/video/create.vue file is identified as view.view.create.0, wherein "view.view" corresponds to the file path, "create" corresponds to the file name, and "0" corresponds to the vocabulary index value. In addition, the original content of the code corresponding to the Chinese vocabulary and the file and the path of the Chinese vocabulary can be recorded, and the part can be embodied by the vocabulary identification instead of being recorded separately because the vocabulary identification comprises the file path and the file name. After all the files are traversed, the Chinese vocabulary can be subjected to duplication elimination operation, and finally all data (the Chinese vocabulary, original content, vocabulary identification and the like, wherein the vocabulary identification comprises information of file names and file paths) are written into the file to generate an excel file, the generated excel file can be called as a Chinese vocabulary file, a schematic diagram of the Chinese vocabulary file is shown in fig. 3, and the page identification in fig. 3 is the vocabulary identification.

The embodiment of the invention can avoid adding extra workload to repeated words by removing the duplication of Chinese words. In the prior art, the front-end research personnel do not perform duplicate removal in the process of searching for words, so that extra and invalid work is increased, and according to the method in the prior art, if the words are manually removed by duplicate removal, extra workload is also needed, but the embodiment of the invention can automatically perform duplicate removal operation after the file is traversed, so that the defects in the prior art are overcome.

The excel contrast multiplexing step, i.e. the contrast multiplexing step in fig. 2, is used to quickly multiplex the translated vocabularies of other items into the current excel file (i.e. the chinese vocabulary file generated by the vocabulary mining step). The vocabulary file in which the translated vocabulary of the other project is located is a stored multilingual vocabulary file, which is also in the form of an excel file, and thus can also be referred to as a stored multilingual excel file. Specifically, the content in the current excel file is read, each Chinese vocabulary is traversed, for each traversed Chinese vocabulary, whether the Chinese vocabulary identical to the traversed Chinese vocabulary exists or not is searched in the existing multilingual excel file, and if the Chinese vocabulary exists, the translation result of the Chinese vocabulary is multiplexed into the current excel file to obtain the excel file to be translated. The excel file to be translated is a vocabulary file obtained after adding a part of translation results to a part of Chinese vocabulary in the Chinese vocabulary file through the contrast multiplexing step, and because the Chinese vocabulary which can obtain the translation results through the contrast multiplexing is usually limited, the remaining part of Chinese vocabulary without the translation results needs to be translated by a translator.

Through the vocabulary replacing step, the Chinese vocabulary in the source code of the Chinese front-end system is quickly replaced by the corresponding international identification (namely the vocabulary identification). Firstly, reading an excel file to be translated, traversing each Chinese vocabulary therein, reading a vocabulary identifier, original content and a file to which the Chinese vocabulary belongs, then finding a character matched with the original content in the file content, and replacing the character with a corresponding international identifier (namely the vocabulary identifier of the Chinese vocabulary). For example, replace "generate picture" in the following code by { $ t (' views.

Before replacement: < p class ═ title "> creation of Picture </p >

After replacement: < p class { $ t ('views. imgtool. savepic.0') } } </p >, is ═ title ">

The Chinese front-end system source code after the replacement vocabulary may be referred to as target source code.

It should be noted that, in the embodiment shown in fig. 2, the excel contrast multiplexing step is performed first, and then the vocabulary replacement step is performed, in other embodiments, the excel contrast multiplexing step and the vocabulary replacement step may also be performed in an order, when the vocabulary replacement step is performed first, the above-mentioned chinese vocabulary file (i.e. the above-mentioned current excel file) is read first, each chinese vocabulary therein is traversed, the vocabulary identifier, the original content and the file to which the chinese vocabulary belongs are read, and then the character matching the original content is found in the file content, and is replaced with the vocabulary identifier of the chinese vocabulary. And then, performing an excel comparison multiplexing step to obtain an excel file to be translated, which is introduced above and is not described any more.

The embodiment of the invention can realize the rapid multiplexing of the existing translation result, and provides the excel file after the excel comparison multiplexing for the translator, so that the translator only needs to translate the untranslated vocabulary, and does not need to manually search whether the vocabulary is translated in the past, thereby greatly improving the translation efficiency.

After the excel file to be translated is translated by the translator, all Chinese vocabularies are translated into other languages to obtain a first multilingual vocabulary file, and the first multilingual vocabulary file is represented by the multilingual excel file in fig. 2. Which languages are specifically translated are determined according to the requirement of international transformation.

According to the embodiment of the invention, the language packages of a plurality of languages can be generated by one key according to the translated multilingual vocabulary files (namely the first multilingual vocabulary file), so that the expandability of the international transformation of the front-end system is strong, and the transformation efficiency is improved.

Through the language package generating step, a plurality of language packages can be quickly generated according to the multilingual excel file (the first multilingual vocabulary file), and each language corresponds to one language package. Specifically, after receiving a multilingual excel file (a first multilingual vocabulary file) translated by a translator, the translator reads the content of the multilingual excel file (the first multilingual vocabulary file), generates a plurality of language package files according to the number of languages and the names of the languages, traverses each Chinese vocabulary, extracts the vocabulary identifier of the Chinese vocabulary and the corresponding translation content of each language, and writes the translation content into the language package files in the form of json data.

By using the obtained target source code and language packages of various languages, front-end systems of various languages can be respectively realized. For example, an english front-end system may be implemented based on the target source code and the english language package.

The anti-excel step in fig. 2 is set for scenes in which vocabulary and excel are not synchronized, translation needs to be locally modified, and the like, which occur in post-maintenance. For example, after the international transformation of the chinese front-end system is completed through the above-mentioned process, for example, an english front-end system (which may further include one or more other language front-end systems, and in this example, only the english front-end system is taken as an example) is obtained, if some vocabularies of the english front-end system need to be modified, according to the embodiment of the present invention, a complete excel vocabulary (i.e., a second multilingual vocabulary file) is derived according to the content of each language package through the reverse excel derivation step, so as to perform operations such as modification of the translation content, and after the operations such as modification are completed, the language packages of various languages are regenerated according to the modified excel vocabulary, so as to implement the front-end systems of various languages according to the regenerated language packages of various languages and the obtained target source code, respectively. When a complete excel vocabulary is derived according to the contents of each language package, the path of each language package in the code base can be traversed, firstly, the Chinese language package is read, secondly, each Chinese vocabulary is traversed, then, the translation contents of the corresponding language of the Chinese vocabulary are read in other language packages, and finally, all data (the Chinese vocabulary and the corresponding other language vocabularies) are generated into an excel file, namely a second multilingual vocabulary file. The multilingual excel file in fig. 2 is also used to represent a second multilingual vocabulary file, and it should be noted that the second multilingual vocabulary file may not include the original content column (because the original content column is not used in generating the language package) or may include the original content column. As shown in excel of fig. 3, the contents of the original content column and the chinese vocabulary column are generally the same, and therefore, when the original content column is included in the second multilingual vocabulary file, the contents of the second multilingual vocabulary file and the first multilingual vocabulary file are also generally the same, and in fig. 2, the first multilingual vocabulary file and the second multilingual vocabulary file are both expressed as multilingual excel files.

According to the embodiment of the invention, when the excel vocabulary is incomplete or translation needs to be locally modified, the excel can be automatically and quickly exported by using the excel reverse function and the language package generation function so as to be modified, and the language package can be automatically and newly generated, so that the translation efficiency is reduced, the workload of a developer is greatly reduced, the development time consumption is greatly reduced, and meanwhile, the later maintenance cost is also greatly reduced. In the prior art, when the vocabulary and the excel are asynchronous and the translation needs to be locally modified in the later maintenance, developers need to manually find the missing words and manually input the words to be modified, so that the maintenance cost is very high. With a vocabulary of about 1500 and a project needing translation of 3 languages, the development time can be saved by more than 60% through the embodiment of the invention, and fig. 4 is a time consumption comparison schematic diagram of the international transformation process of the existing front-end system and the international transformation process of the front-end system in the embodiment of the invention.

Fig. 5 is a schematic diagram of main blocks of an implementation apparatus of a web system according to an embodiment of the present invention.

As shown in fig. 5, an apparatus 500 for implementing a web system according to an embodiment of the present invention mainly includes: a vocabulary mining module 501, a vocabulary replacing module 502, a language package generating module 503 and a web system realizing module 504.

The vocabulary mining module 501 is configured to perform vocabulary mining on the source code of the first language web system to obtain a first language vocabulary file including a first language vocabulary and a corresponding vocabulary identifier.

And a vocabulary replacement module 502, configured to replace a first language vocabulary in the source code of the first language web system with a corresponding vocabulary identifier according to the first language vocabulary file, so as to obtain a target source code.

The language package generating module 503 is configured to obtain a first multilingual vocabulary file, where the first multilingual vocabulary file is obtained by adding another language to the first language vocabulary file, and generate language packages of different languages according to the first multilingual vocabulary file, where each language includes the first language and another language.

And the web system implementation module 504 is configured to implement web systems of different languages according to the target source code and the language packages of different languages.

In one embodiment, the vocabulary mining module 501 is specifically configured to: traversing a code library file of the first language web system to match first language vocabularies in the code library file; and generating a corresponding vocabulary identification for the matched first language vocabulary, and generating a first language vocabulary file comprising the matched first language vocabulary and the corresponding vocabulary identification.

In one embodiment, the vocabulary replacement module 502 is specifically configured to: and searching the file content of the code library file to which the first language vocabulary belongs for characters matched with the original content corresponding to the first language vocabulary, and replacing the searched characters with vocabulary identification corresponding to the first language vocabulary, wherein the original content corresponding to the first language vocabulary is recorded in the first language vocabulary file.

The vocabulary identification corresponding to the vocabulary of the first language may include: and the path, the file name and the vocabulary index value of the code library file to which the vocabulary of the first language belongs are used for acquiring the file content.

In one embodiment, the language pack generation module 503 is specifically configured to: generating language package files of various languages according to the language quantity and the language name in the first multilingual vocabulary file; and taking out each vocabulary identification and each corresponding language vocabulary from the first multilingual vocabulary file, and writing the vocabulary identification and each corresponding language vocabulary into the language packet file of the corresponding language in a specific data form respectively, wherein each language vocabulary comprises the first language vocabulary and the vocabulary of other languages.

The apparatus 500 for implementing a web system may further include a vocabulary multiplexing module configured to: searching the vocabulary which is the same as the first language vocabulary in the first language vocabulary file in the stored multi-language vocabulary file; and acquiring vocabularies of other languages corresponding to the searched vocabularies from the stored multilingual vocabulary files, and adding the vocabularies into the first language vocabulary file.

The apparatus 500 for implementing a web system may further include a multilingual vocabulary file export module for: respectively reading the vocabulary in the language packet of the first language and the vocabulary in the language packets of other corresponding languages from the language packets of the languages so as to generate a second multilingual vocabulary file to be modified.

The language pack generation module 503 may be further configured to regenerate the language packs of the respective languages according to the modified second multilingual vocabulary files after the second multilingual vocabulary files are modified.

The web system implementation module 504 may be further configured to implement the web systems of different languages respectively according to the target source code and the regenerated language packages of different languages.

In addition, the detailed implementation contents of the implementation apparatus of the web system in the embodiment of the present invention have been described in detail in the implementation method of the web system, so that repeated contents are not described herein.

Fig. 6 illustrates an exemplary system architecture 600 of a web system implementation method or web system implementation apparatus to which embodiments of the invention may be applied.

As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.

A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. The terminal devices 601, 602, 603 may have installed thereon various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).

The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.

The server 605 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 601, 602, 603. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.

It should be noted that the implementation method of the web system provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the implementation apparatus of the web system is generally disposed in the server 605.

It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.

Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use in implementing a terminal device or server of an embodiment of the present application. The terminal device or the server shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.

As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.

The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.

In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program executes the above-described functions defined in the system of the present application when executed by the Central Processing Unit (CPU) 701.

It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.

The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor comprises a vocabulary mining module, a vocabulary replacing module, a language package generating module and a web system realizing module. The names of these modules do not in some cases constitute a limitation on the modules themselves, for example, the vocabulary mining module may also be described as a "module for vocabulary mining source code of a first language web system to obtain a first language vocabulary file including a first language vocabulary and corresponding vocabulary identification".

As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: performing vocabulary mining on a source code of the first language web system to obtain a first language vocabulary file comprising a first language vocabulary and a corresponding vocabulary identifier; replacing the first language vocabulary in the source code of the first language web system with a corresponding vocabulary identifier according to the first language vocabulary file to obtain a target source code; and acquiring a first multilingual vocabulary file, wherein the first multilingual vocabulary file is obtained by adding other languages into the first language vocabulary file, and language packages of various languages are respectively generated according to the first multilingual vocabulary file so as to respectively realize web systems of various languages according to the target source code and the language packages of various languages, wherein the various languages comprise the first language and the other languages.

According to the technical scheme of the embodiment of the invention, vocabulary mining is carried out on the source code of the first language web system to obtain a first language vocabulary file; replacing the first language vocabulary in the source code of the first language web system with a corresponding vocabulary identifier according to the first language vocabulary file to obtain a target source code; and acquiring a first multilingual vocabulary file obtained by adding other languages in the first language vocabulary file, respectively generating language packages of various languages according to the first multilingual vocabulary file, and respectively realizing web systems of various languages according to the target source code and the language packages of various languages. The workload of the international transformation of the web system can be reduced, the transformation time is saved, the transformation efficiency and the translation efficiency are improved, and the maintenance cost when the conditions that the vocabulary and the vocabulary file are asynchronous and the translation needs to be locally modified and the like are generated in the later stage is reduced.

The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

19页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种机器翻译模型性能检测方法、以及相关设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!