Summary of the invention
The main purpose of the application is to provide a kind of web page translation method, with solve can not while web page translation it is real
The problem of now editing.
To achieve the goals above, according to the one aspect of the application, a kind of web page translation method is provided.
Include: according to the web page translation method of the application
The webpage of editor to be translated is saved, to obtain preservation webpage;
The preservation webpage is parsed, to obtain analyzing web page, wherein parsing the preservation webpage and including:
Html file parsing, to obtain html file parsing result;
CSS document analysis, to obtain CSS document analysis result;
JS document analysis, to obtain JS document analysis result;
Html object parsing, to obtain html object parsing result;
According to the html file parsing result, the CSS document analysis result, the JS document analysis result and described
The analyzing web page is translated and edited to html object parsing result, translates editor's webpage to obtain;And
Export the translation editor webpage.
Further, parsing the preservation webpage includes: to parse to obtain html document tree by html file, is positioned each
The coordinate address of content tab, and split and extract the web page contents of editor to be translated;Pass through CSS document analysis and JS file solution
The rendering data for analysing the current static page obtained, is split and is read, and coordinate, the displaying freely edited are positioned.
Further, translating and editing the analyzing web page includes: pretranslation, essence translation and editor;The wherein rollover
Translate includes: to extract the class label of special translating purpose language, and split and extract the editor to be translated obtained by machine translation
Content of pages to obtain pretranslation content, and show fractionation rule and layout;It is described it is translated include: that essence translates the rollover
Content is translated, essence translation content has been obtained.
Further, the editor includes: to save by the edited essence translation content to corresponding positioning coordinate,
Corresponding content in the preservation webpage is replaced, to obtain the preservation webpage by editor.
Further, exporting the translation editor webpage includes: the rendering preservation webpage by editor, by the warp
It crosses in the preservation webpage of editor and is rendered into the initial page layout of the webpage of editor to be translated again by the content of editor.
To achieve the goals above, according to the another aspect of the application, a kind of webpage web page translation system is provided.
Include: according to the webpage web page translation system of the application
Preserving module, for saving the webpage of editor to be translated, to obtain preservation webpage;
Parsing module, for parsing the preservation webpage, to obtain analyzing web page;
Editor module is translated, for translating and editing the analyzing web page, translates editor's webpage to obtain;And
Export module, for exporting the translation editor webpage.
Further, the parsing module includes: html file parsing module, obtains html document tree for parsing, fixed
The coordinate address of each content tab in position, and split and extract the web page contents of editor to be translated;CSS document analysis module is used
It in the rendering data for the current static page that parsing obtains, is split and is read, position coordinate, the exhibition freely edited
Show;JS document analysis module is split and is read, positioning is sat for parsing the rendering data of the current static page obtained
Mark, the displaying freely edited;And html object parsing.
To achieve the goals above, according to the another aspect of the application, a kind of computer equipment is provided.
Computer equipment according to the application include: memory, processor and storage in the memory and can be by institute
The computer program of processor operation is stated, the processor realizes side described in any of the above embodiments when executing the computer program
Method.
To achieve the goals above, according to the another aspect of the application, a kind of computer readable storage medium is provided.
Computer readable storage medium according to the application includes: non-volatile readable storage medium, is stored with meter
Calculation machine program, the computer program realize method described in any of the above embodiments when executed by the processor
To achieve the goals above, according to the another aspect of the application, a kind of computer program product is provided.
Include: according to the computer program product of the application, including computer-readable code, when the computer-readable generation
When code is executed by computer equipment, the computer equipment is caused to execute method described in any of the above embodiments
In the embodiment of the present application, by first saving original editor's webpage to be translated, then the webpage is edited in translation, finally
Again by the mode of the edited webpage export replacement original web page of the translation, realizes and can be realized editor's while translation
Technical problem.
Specific embodiment
In order to make those skilled in the art more fully understand application scheme, below in conjunction in the embodiment of the present application
Attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment is only
The embodiment of the application a part, instead of all the embodiments.Based on the embodiment in the application, ordinary skill people
Member's every other embodiment obtained without making creative work, all should belong to the model of the application protection
It encloses.
It should be noted that term " includes " and " having " and their any deformation, it is intended that covering is non-exclusive
Include, for example, the process, method, system, product or equipment for containing a series of steps or units are not necessarily limited to clearly arrange
Those of out step or unit, but may include be not clearly listed or it is solid for these process, methods, product or equipment
The other step or units having.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase
Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
As shown in Figure 1, providing a kind of web page translation method in one embodiment of the application, comprising:
S102: saving the webpage of editor to be translated, to obtain preservation webpage;
S104: parsing the preservation webpage, to obtain analyzing web page, wherein parsing the preservation webpage and including:
Html file parsing, to obtain html file parsing result;
CSS document analysis, to obtain CSS document analysis result;
JS document analysis, to obtain JS document analysis result;
Html object parsing, to obtain html object parsing result;
S106: according to the html file parsing result, the CSS document analysis result, the JS document analysis result
And the analyzing web page is translated and edited to the html object parsing result, translates editor's webpage to obtain;And
S108: webpage is edited in the export translation.
2. web page translation method according to claim 1, which is characterized in that the parsing preservation webpage includes: logical
It crosses html file parsing and obtains html document tree, position the coordinate address of each content tab, and split and extract volume to be translated
The web page contents collected;By the rendering data for the current static page that CSS document analysis and JS document analysis obtain, split
And reading, position coordinate, the displaying freely edited.
Personnel serve as interpreter when carrying out translation, is mirror image by webpage pattern buffered in advance, Context resolution is gone out sentence by sentence,
Carry out preliminary pretranslation by machine translation, then proofreaded and modified by translator, it is to be translated after the completion of again by the pattern of webpage also
Original, and then complete the conversion of the content language of a whole webpage.
In the present embodiment, the webpage of editor to be translated is obtained by uploading html file or the address URL, but simultaneously
It is not limited only to this.When the webpage of editor to be translated be by upload that html file or the address URL obtain when, save user institute
Request target file.When user requests URL address of the translation needed for some or when html file, target needed for dns resolution
Location, all associated documents under being saved in the form of binary file, to be parsed.
As shown in Fig. 2, parsing the preservation webpage includes: in one embodiment of the application
S1021:HTML document analysis obtains html document tree, positions the coordinate address of each content tab, and split with
Extract the web page contents of editor to be translated;
The rendering data for the current static page that S1022:CSS document analysis obtains, is split and is read, and positioning is sat
Mark, the displaying freely edited;
S1023:JS document analysis, the rendering data of the current static page of acquisition, is split and is read, and positioning is sat
Mark, the displaying freely edited;
S1024:HTML analysis of object;
As shown in figure 3, in one embodiment of the application, translates and edit the analyzing web page and include:
S1061: the class label of special translating purpose language is extracted in pretranslation, and splits and extract acquisition by machine translation
The content of pages of the editor to be translated shows fractionation rule and layout to obtain pretranslation content;
S1062: essence translation, essence translate the pretranslation content, have obtained essence translation content;And
S1063: editor
In one embodiment of the application, the editor includes: to save by the edited essence translation content to corresponding
Positioning coordinate, corresponding content in the preservations webpage is replaced, to obtain the preservation webpage (as shown in Figure 3) by editing.
In one embodiment of the application, exporting the translation editor webpage includes: the rendering preservation net by editor
Page will be rendered into again the initial page of the webpage of editor to be translated by the content of editor in the preservation webpage by editor
In the layout of face.
According to embodiments of the present invention, it additionally provides a kind of for implementing the webpage web page translation system of above-mentioned web page translation method
System, the system include:
Preserving module, for saving the webpage of editor to be translated, to obtain preservation webpage;
Parsing module, for parsing the preservation webpage, to obtain analyzing web page;
Editor module is translated, for translating and editing the analyzing web page, translates editor's webpage to obtain;And
Export module, for exporting the translation editor webpage.
In one embodiment of the application, the parsing module includes: html file parsing module, obtains HTML for parsing
Document tree positions the coordinate address of each content tab, and splits and extract the web page contents of editor to be translated;CSS file solution
Module is analysed, for parsing the rendering data of the current static page obtained, is split and is read, position coordinate, carried out freely
The displaying of editor;JS document analysis module is split and is read for parsing the rendering data of the current static page obtained
It takes, positions coordinate, the displaying freely edited;And html object parsing module.
As shown in figure 4, additionally providing a kind of computer equipment, including memory, processing according to the another aspect of the application
Device executes the calculating with the computer program that can be run in the memory and by the processor, the processor is stored
Method described in any of the above embodiments is realized when machine program.
As shown in figure 5, a kind of computer readable storage medium is additionally provided according to the another aspect of the application, it is non-volatile
Property readable storage medium storing program for executing, is stored with computer program, the computer program realizes above-mentioned when executed by the processor
Method described in one.
According to the another aspect of the application, a kind of computer program product, including computer-readable code are additionally provided, when
When the computer-readable code is executed by computer equipment, the computer equipment is caused to execute side described in any of the above embodiments
Method.
It can be seen from the above description that the present invention realizes following technical effect:
1. then the webpage is edited in translation by first saving original editor's webpage to be translated, finally the translation is edited again
The mode of webpage export replacement original web page afterwards, realizes the technical issues of can be realized editor while translation.
2. by parsing of the bottom to web page files or network address, allow user can free content of edit, and to language
The translation of speech, the functions such as statistics, reaches the higher adjustment demand of freedom degree.
It should be noted that step shown in the flowchart of the accompanying drawings can be in such as a group of computer-executable instructions
It is executed in computer system, although also, logical order is shown in flow charts, and it in some cases, can be with not
The sequence being same as herein executes shown or described step.
Obviously, those skilled in the art should be understood that each module of the above invention or each step can be with general
Computing device realize that they can be concentrated on a single computing device, or be distributed in multiple computing devices and formed
Network on, optionally, they can be realized with the program code that computing device can perform, it is thus possible to which they are stored
Be performed by computing device in the storage device, perhaps they are fabricated to each integrated circuit modules or by they
In multiple modules or step be fabricated to single integrated circuit module to realize.In this way, the present invention is not limited to any specific
Hardware and software combines.
The foregoing is merely preferred embodiment of the present application, are not intended to limit this application, for the skill of this field
For art personnel, various changes and changes are possible in this application.Within the spirit and principles of this application, made any to repair
Change, equivalent replacement, improvement etc., should be included within the scope of protection of this application.