CN107402746A - A kind of method and device of automatic code generating file - Google Patents

A kind of method and device of automatic code generating file Download PDF

Info

Publication number
CN107402746A
CN107402746A CN201610341016.8A CN201610341016A CN107402746A CN 107402746 A CN107402746 A CN 107402746A CN 201610341016 A CN201610341016 A CN 201610341016A CN 107402746 A CN107402746 A CN 107402746A
Authority
CN
China
Prior art keywords
language
file
code
variable name
language text
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610341016.8A
Other languages
Chinese (zh)
Other versions
CN107402746B (en
Inventor
何文俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610341016.8A priority Critical patent/CN107402746B/en
Publication of CN107402746A publication Critical patent/CN107402746A/en
Application granted granted Critical
Publication of CN107402746B publication Critical patent/CN107402746B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/22Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Machine Translation (AREA)
  • Stored Programmes (AREA)

Abstract

This application provides a kind of method and device of automatic code generating file.This method includes:First code file is traveled through, searches some first language texts in the first code file;Some first language texts are replaced with into corresponding variable name;Corresponding relation based on variable name Yu first language text, generate first language file;First language text in first language file is translated into second language text, to generate second language file, the second language file includes the corresponding relation of second language text and variable name;Based on second language file, the variable name in first code file is replaced with into corresponding second language text to generate second code file.The application provides the scheme of an automatic code generating file for the multilingual requirements of front end, multilingual requirements have been peeled off out well from development, so that developer need to only pay close attention to function realization, the working strength of developer is greatly reduced, improves operating efficiency.

Description

A kind of method and device of automatic code generating file
Technical field
The application belongs to technical field of information processing, more particularly to a kind of method and device of automatic code generating file.
Background technology
Multilingual requirements are frequently encountered in the exploitation of item file, generally, developer encodes in exploitation It is preceding to put official documents and correspondence information in order in advance, and to every word information definition alias, on stream if there is text information All replaced with alias.But such scheme can aggravate developer's burden, such as developer is needed for each bar text information Defalias, the definition of alias will be with whole development processes with searching use.
For multilingual translation scheme in conventional items file development burden it is larger the problem of, not yet propose at present effective Solution.
The content of the invention
The application purpose is to provide a kind of method and device of automatic code generating file so that developer can picture It is the same to develop monolingual project, is directly filled at the word place of showing using single language (such as Chinese), it is not necessary to after consideration Phase replaces the problems such as translation, greatly reduces the working strength of developer, improves operating efficiency.
The application provides what a kind of method and device of automatic code generating file was realized in:
A kind of method of automatic code generating file, methods described include:First code file is traveled through, searches the first generation Some first language texts in code file;Some first language texts are replaced with into corresponding variable name;It is based on The corresponding relation of the variable name and the first language text, generate first language file;By in the first language file First language text translate into second language text, to generate second language file, the second language file includes the second language Say the corresponding relation of text and the variable name;Based on the second language file, described in the first code file Variable name replaces with corresponding second language text to generate second code file.
A kind of device of automatic code generating file, described device include:Searching unit, for traveling through first code text Part, search some first language texts in the first code file;First replacement unit, for by some first languages Text replaces with corresponding variable name;File generating unit, for based on the variable name and the first language text Corresponding relation, generate first language file;Translation unit, for the first language text in the first language file to be turned over Second language text is translated into, to generate second language file, the second language file includes second language text and the variable The corresponding relation of name;Second replacement unit, for based on the second language file, described in the first code file Variable name replaces with corresponding second language text to generate second code file.
The method and device for the automatic code generating file that the application provides, for the multilingual requirements of front end (page end) Provide one and automatically extract language message and the scheme translated in code, multilingual requirements are shelled well from development From out so that developer need to only pay close attention to function realization, and developer can be as developing monolingual project one Sample, directly filled at the word place of showing using single language (such as Chinese), the later stage can be according to the second of multilingual type The language that language text translates above-mentioned single language translation into needs, greatly reduces the working strength of developer, and reduction is opened The burden of hair personnel, improve operating efficiency.
Brief description of the drawings
, below will be to embodiment or existing in order to illustrate more clearly of the embodiment of the present application or technical scheme of the prior art There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this Some embodiments described in application, for those of ordinary skill in the art, do not paying the premise of creative labor Under, other accompanying drawings can also be obtained according to these accompanying drawings.
Fig. 1 is a kind of method flow diagram of the embodiment for the automatic code generating document method that the application proposes;
Fig. 2 is a kind of method flow diagram for the embodiment for automatically generating language file method that the application proposes;
Fig. 3 is a kind of structural representation of embodiment of device of herein described automatic code generating file;
Fig. 4 is a kind of structural representation of embodiment of herein described searching unit;
Fig. 5 is that herein described variable name formulates a kind of structural representation of embodiment of unit;
Fig. 6 is a kind of structural representation of embodiment of herein described second replacement unit.
Embodiment
In order that those skilled in the art more fully understand the technical scheme in the application, it is real below in conjunction with the application The accompanying drawing in example is applied, the technical scheme in the embodiment of the present application is clearly and completely described, it is clear that described implementation Example only some embodiments of the present application, rather than whole embodiments.It is common based on the embodiment in the application, this area The every other embodiment that technical staff is obtained under the premise of creative work is not made, it should all belong to the application protection Scope.
On " first " used herein, " second " ... etc., not especially censure the meaning of order or cis-position, Be not used to limit the present invention, its only for distinguish with constructed term description element or operation.
The style recognition methods of commodity described herein and device are described in detail below in conjunction with the accompanying drawings.Although This application provides such as following embodiments or method operating procedure shown in the drawings or apparatus structure, but based on conventional or need not Performing creative labour can include more or less operating procedure or modular structure in methods described or device.In logic In the step of necessary causality is not present in property or structure, the execution sequence of these steps or the modular structure of device are not limited to The execution sequence or modular structure that the embodiment of the present application provides.The device in practice of described method or modular structure or end , can either method or modular structure shown in the drawings connect carry out order execution or simultaneously according to embodiment when holding the product to perform Row performs (such as environment of parallel processor or multiple threads).Fig. 1 is the automatic code generating file that the application proposes The method flow diagram of a kind of embodiment of method, as shown in figure 1, the one kind for the automatic code generating document method that the application provides Embodiment can include:
Step S101, first code file is traveled through, searches some first language texts in the first code file;
Step S102, some first language texts are replaced with into corresponding variable name;
Step S103, the corresponding relation based on above-mentioned variable name Yu above-mentioned first language text, generate first language file;
Step S104, the first language text in first language file is translated into second language text, to generate second Language file, the second language file include the corresponding relation of second language text and variable name;
Step S105, based on second language file, the variable name in first code file is replaced with into corresponding second language Text is sayed to generate second code file.
The method for the automatic code generating file that the application provides, is provided for the multilingual requirements of front end (page end) One automatically extracts language text in code and the scheme translated, and multilingual requirements well have been peeled off from development Come so that developer need to only pay close attention to function realization, and developer can be as developing monolingual project, in text The word place of showing directly is filled in using single language (such as Chinese), and the later stage will be upper according to the second language text of multilingual type The language that single language translation is translated into needs is stated, greatly reduces the working strength of developer, reduces the burden of developer, Improve operating efficiency.
In this application, some first language texts searched in first code file are real by following preferred embodiment It is existing:The code in first code file is traveled through, searches the Chinese information in addition to Chinese annotation in code;The Chinese that will be found Information is defined as first language text.In project development process, because the developer of CHINESE REGION is usually Chinese, because This, developer uses Chinese information in exploitation coding stage habituation, and certain the application is limited not to this, for practising The project that the used developer using English is developed, what is found is then english information.
Some first language texts searched in first code file can be by a node js (Java script fortune Row environment) realize, it can also be realized by other programming languages such as java, python, c++ etc..Some first languages found Speech text can be stored with js forms, can also be stored with data memory formats such as txt, csv, database tables.
Before some first language texts are replaced with into corresponding variable name, can according to preset rules formulate with Variable name corresponding to first language text.For the preset rules in the application, can according to actual conditions sets itself, below Two kinds of more handy, preferable preset rules of using effect are introduced, the first is:According to the code before first language text with Variable, the set membership between, formulate variable name corresponding with first language text;It is for second, according to first language The location of code before text, formulate variable name corresponding with first language text., can based on above-mentioned preset rules Formulate and each one-to-one variable name of first language text.
It should be noted that the second language file in the application, can be more parts of files, used in per text document Language form is different, such as can be Chinese language file, english language file, Russian language file etc..Below with the first language Exemplified by speech text is Chinese information, the generating process of multilingual file is introduced:First, based on variable name and Chinese information Corresponding relation, generation Chinese language file (i.e. above-mentioned first language file), described in the Chinese language file is each The corresponding relation of individual variable name and Chinese information;Then, Chinese language file is translated, by the change in Chinese language file It is constant to measure name reservation, Chinese information corresponding with each variable name is translated as other language, such as English or Russian etc.; Finally, the second language file of corresponding generation multilingual type, such as english language file or Russian language file.
After the second language file of generation multilingual type, first language text can be entered according to replacement demand Row is replaced, and specifically, determines that first language text needs the language form (such as Russian) replaced according to replacement demand;Transfer with Second language file corresponding to the language form (such as Russian language file);Based on second language file, by first code text Variable name in part replaces with corresponding second language text to generate second code file., can be by developer based on this The Chinese information write in cataloged procedure is developed replaces with Russian information, and translation process is simply efficient, while reduces exploit person The burden of member, improve development efficiency.
In this application, the type of first code file comprises at least:Js, html, jsp, php or vm.For html For type file, it is impossible to directly carry out the replacement of first code file, it is necessary to which html type files first are converted into js types File.Follow-up replacement translating operation is performed again.
It should be noted that after first code document upgrading, such as developer develops again to first code file, Or extend some New functions, then the first language text newly increased is required to look up, then according to preset rules formulation and newly Variable name corresponding to increased first language text, finally by the variable name and the corresponding pass of the first language text newly increased System, fills into first language file.That is, the content in the first language file generated before will not be capped, it is only necessary to will be new Content cover.So as to reduce the renewal duration of multilingual file, repeated work is avoided.
Separately below by taking js files and html files as an example, two kinds of preset rules for formulating variable name are introduced.
(1) js files
1st, the first code file under technical routine file is traveled through.
2nd, the first language text in first code file is transferred.
Msg:{
noReplaceTip:' not needing the variable replaced '
}
3rd, variable name corresponding with the first language text is formulated according to preset rules, then replaces the first language text It is changed to variable name.
For example, it can be formulated and the according to the code before first language text and variable, the set membership between Variable name corresponding to one language text:appName_msg_noReplaceTip.The variable name represents to apply the change under appName The noReplaceTip under msg is measured, it is convenient to position in the future, in favor of follow-up replacement.Wherein, using appName and variable msg It is set membership, appName is father, and msg is son;Variable msg and noReplaceTip is set membership, and msg is father, NoReplaceTip is son.
Code after replacement is as follows:
Msg:{
noReplaceTip:translate(‘appName_msg_noReplaceTip’)
}
(2) html files
1st, html files are converted into js files.
2nd, js files are traveled through, transfer first language text.
<Lable class=" desc-title " for=" udfComment ">Description</lable>
3rd, variable name corresponding with the first language text is formulated according to preset rules, then replaces the first language text It is changed to variable name.
For example, it can be formulated corresponding with first language text according to the location of code before first language text Variable name:appName_templates_UDFDetail_2.In the variable name, " 2 " represent:Above-mentioned first language text " is retouched State " it is the 2nd first language occurred in the html (first code file) for applying the variable under appName to be UDFDetail Text, it is convenient to be accurately positioned in the future, beneficial to follow-up quick and precisely replacement.
Code after replacement is as follows:
<Lable class=" desc-title " for=" udfComment ">
translate(‘appName_templates_UDFDetail_2’)
</lable>
By that analogy, can be formulated and first language text according to above two preset rules or other preset rules Corresponding variable name, then according to the corresponding relation of variable name and first language text, establish Chinese language file (i.e. above-mentioned the One language file).
Chinese language file is as follows:
Then, Chinese language file is translated, the second language file of remaining language form can be translated as, this Corresponding relation comprising second language text and variable name in two language files.The variable name in code is replaced according to the actual requirements The second code file of other language forms is changed to, so as to realize international multilingual exploitation.
When first code file is developed again, extends some functions, as long as running the technology of the application again Scheme, just it can obtain the first language file after a renewal, new first language text and its variable name can be added to former the In one language file, translation generation second language file is then corresponded to, translation achievement before will not be capped.
Fig. 2 is a kind of method flow diagram for the embodiment for automatically generating language file method that the application proposes, such as Fig. 2 institutes Show, another embodiment for automatically generating language file method of the application offer can include:
Step S201, travel through each first code file in project folder.It is of course also possible to technical routine is literary on demand Traversal scope in part folder.
Step S202, judge the file type of first code file;If js files, then step S204 is performed, if It is html files, then performs step S203.
Step S203, html files are converted into js files.Then step S204 is performed.
Step S204, extract some first language texts in first code file.
Step S205, generate variable name corresponding with first language text.
Step S206, first language text is replaced according to variable name.
Step S207, judge whether second language file is existing;If it is, step S209 is performed, if it is not, then holding Row step S208.
Step S208, according to variable name and the corresponding relation of first language text, generate first language file.By the first language First language text in speech file translates into second language text, to generate second language file, the second language file bag The corresponding relation of text containing second language and variable name.
Step S209, integrate renewal second language file.
Based on such scheme, developer only needs to be accustomed to carrying out code development according to Chinese, is run before each issue Such scheme, that is, complete the multilingual exploitation of internationalization.
Based on the method identical inventive concept with above-mentioned automatic code generating file, the application provides one kind and automatically generated The device of code file, as described in example below.Due to the automatic code generating file device solve problem principle with The method of automatic code generating file is similar, therefore the implementation of the device of the automatic code generating file may refer to automatically generate The implementation of the method for code file, repeat part and repeat no more.
Fig. 3 is a kind of structural representation of embodiment of device of herein described automatic code generating file, such as Fig. 3 institutes Show, described device can include:
Searching unit 10, for traveling through first code file, search some first languages text in the first code file This;Searching unit 10 is automatically generated the part that first language text is searched in the device of code file, can be software, hardware Or the combination of the two, such as can complete the components such as input/output interface, the process chip of information searching function.
First replacement unit 20, for some first language texts to be replaced with into corresponding variable name;First replaces Unit 20 is automatically generated the part that information in the device of code file is replaced, and can be software, hardware or the combination of the two, example Such as can be input/output interface, the process chip component for completing information replacement function.
File generating unit 30, for the corresponding relation based on variable name Yu first language text, generation first language text Part;File generating unit 30 is automatically generated the part that file is generated in the device of code file, can be software, hardware or two The combination of person, such as can complete the components such as input/output interface, the process chip of file generated function.
Translation unit 40, for the first language text in first language file to be translated into second language text, with life Into second language file, the second language file includes the corresponding relation of second language text and the variable name;Translation unit 40 are automatically generated the part that text translation is carried out in the device of code file, can be software, hardware or the combination of the two, example Such as can be input/output interface, the process chip component for completing text interpretative function.
Second replacement unit 50, for based on second language file, the variable name in first code file is replaced with pair The second language text answered is to generate second code file.Second replacement unit 50, which is automatically generated in the device of code file, to be believed The part replaced is ceased, can be software, hardware or the combination of the two, such as can be the input and output for completing information replacement function The components such as interface, process chip.
The device for the automatic code generating file that the application provides, is provided for the multilingual requirements of front end (page end) One automatically extracts language text in code and the scheme translated, and multilingual requirements well have been peeled off from development Come so that developer need to only pay close attention to function realization, and developer can be as developing monolingual project, in text The word place of showing directly is filled in using single language (such as Chinese), and the later stage will be upper according to the second language text of multilingual type The language that single language translation is translated into needs is stated, greatly reduces the working strength of developer, reduces the burden of developer, Improve operating efficiency.
Fig. 4 is a kind of structural representation of embodiment of herein described searching unit, as shown in figure 4, above-mentioned searching unit 10 include:Spider module 12, for traveling through the code in first code file, search in above-mentioned code in addition to Chinese annotation Chinese information;Determining module 14, for the above-mentioned Chinese information found to be defined as into first code file.Search first code File can be realized by node js (a Java script running environment), can also be by other programming languages such as Java, python, c++ etc. are realized.The first code file found can be stored with js forms, can also be with txt, csv, number Stored according to data memory formats such as storehouse tables.
Fig. 5 is that herein described variable name formulates a kind of structural representation of embodiment of unit, as shown in figure 5, above-mentioned dress Putting also includes:Variable name formulate unit 60, for according to the code before above-mentioned first language text and variable, between Set membership, formulate variable name corresponding with above-mentioned first language text;Or for before according to above-mentioned first language text The location of code, formulate variable name corresponding with above-mentioned first language text.Generally, one of which is only taken Preset rules.
It should be noted that the second language file in the application, can be more parts of files, used in per text document Language form is different, such as can be Chinese language file, english language file, Russian language file etc..Below with the first language Exemplified by speech text is Chinese information, the generating process of multilingual file is introduced:First, based on variable name and Chinese information Corresponding relation, generation Chinese language file (i.e. above-mentioned first language file), described in the Chinese language file is each The corresponding relation of individual variable name and Chinese information;Then, Chinese language file is translated, by the change in Chinese language file It is constant to measure name reservation, Chinese information corresponding with each variable name is translated as other language, such as English or Russian etc.; Finally, the second language file of corresponding generation multilingual type, such as english language file or Russian language file.
Fig. 6 is a kind of structural representation of embodiment of herein described second replacement unit, as shown in fig. 6, above-mentioned second Replacement unit 50 includes:Language determining module 52, for determining that first language text needs the language replaced according to replacement demand Type;File transfers module 54, for transferring second language file corresponding with above-mentioned language form;Replacement module 56, is used for Based on second language file, the variable name in first code file is replaced with into corresponding second language text to generate the second generation Code file.So as to realize the multilingual exploitation of internationalization.
In this application, the type of first code file comprises at least:Js, html, jsp, php or vm.For html For type file, it is impossible to directly carry out the replacement of first language text, it is necessary to which html type files first are converted into js types File.Follow-up replacement translating operation is performed again.Therefore, said apparatus also includes:Type conversion unit, for judging above-mentioned The type of one code file;If html type files, then above-mentioned html type files are converted into js type files.
It should be noted that after first code document upgrading, such as developer develops again to first code file, Or extend some New functions, then the first language text newly increased is required to look up, then according to preset rules formulation and newly Variable name corresponding to increased first language text, finally by the variable name and the corresponding pass of the first language text newly increased System, fills into first language file.That is, the content in the language file generated before will not be capped, it is only necessary in new Appearance covers.Based on this, this application provides a kind of preferred embodiment, i.e. said apparatus also includes:Updating block, use In after first code document upgrading, searching the first language text that newly increases;According to preset rules formulate with newly increase the Variable name corresponding to one language text;By variable name and the corresponding relation of the first language text newly increased, first language is filled into File.So as to reduce the renewal duration of multilingual file, repeated work is avoided.
It was found from description more than, the application devises a kind of scheme from automatic code generating file, will be multilingual Demand has been peeled off out well from development so that developer need to only pay close attention to function realization.Developer can So that as developing monolingual project, the word place of showing directly is filled in using Chinese, it is not necessary to considers later stage variable replacement etc. Problem.Source code is modified without developer in multilingual requirements, reduces the volume burden of developer, improves Development efficiency.
Although this application provides the method operating procedure as described in embodiment or flow chart, based on conventional or noninvasive The work for the property made can include more or less operating procedures.The step of being enumerated in embodiment order is only numerous steps A kind of mode in execution sequence, does not represent unique execution sequence., can when device or client production in practice performs So that according to embodiment, either method shown in the drawings order is performed or parallel performed (such as at parallel processor or multithreading The environment of reason).
The device or module that above-described embodiment illustrates, can specifically be realized by computer chip or entity, or by with The product of certain function is realized.For convenience of description, it is divided into various modules during description apparatus above with function to describe respectively. The function of each module can be realized in same or multiple softwares and/or hardware when implementing the application.It is of course also possible to The module for realizing certain function is combined into realization by multiple submodule or subelement.
Method, apparatus described herein or module can be realized in a manner of computer readable program code controller by Any appropriate mode is realized, for example, controller can take such as microprocessor or processor and storage can be by (micro-) The computer-readable medium of the computer readable program code (such as software or firmware) of computing device, gate, switch, specially With integrated circuit (Application Specific Integrated Circuit, ASIC), programmable logic controller (PLC) and embedding Enter the form of microcontroller, the example of controller includes but is not limited to following microcontroller:ARC 625D、Atmel AT91SAM、 Microchip PIC18F26K20 and Silicone Labs C8051F320, Memory Controller are also implemented as depositing A part for the control logic of reservoir.It is also known in the art that except real in a manner of pure computer readable program code , completely can be by the way that method and step be carried out into programming in logic come controller with gate, switch, special beyond existing controller The form of integrated circuit, programmable logic controller (PLC) and embedded microcontroller etc. realizes identical function.Therefore this controller A kind of hardware component is considered, and what its inside was included is used to realize that the device of various functions can also to be considered as hardware Structure in part.Or even, can by for realize the device of various functions be considered as both can be implementation method software Module can be the structure in hardware component again.
Part of module in herein described device can be in the general of computer executable instructions Described in context, such as program module.Usually, program module includes performing particular task or realizes specific abstract data class The routine of type, program, object, component, data structure, class etc..The application can also be put into practice in a distributed computing environment, In these DCEs, by performing task by communication network and connected remote processing devices.In distribution In computing environment, program module can be located in the local and remote computer-readable storage medium including storage device.
As seen through the above description of the embodiments, those skilled in the art can be understood that the application can Realized by the mode of software plus required hardware.Based on such understanding, the technical scheme of the application is substantially in other words The part to be contributed to prior art can be embodied in the form of software product, can also pass through the implementation of Data Migration During embody.The computer software product can be stored in storage medium, such as ROM/RAM, magnetic disc, CD, bag Some instructions are included to so that a computer equipment (can be that personal computer, mobile terminal, server, or network are set It is standby etc.) perform method described in some parts of each embodiment of the application or embodiment.
Each embodiment in this specification is described by the way of progressive, same or analogous portion between each embodiment Divide mutually referring to what each embodiment stressed is the difference with other embodiment.The whole of the application or Person part can be used in numerous general or special purpose computing system environments or configuration.Such as:Personal computer, server calculate Machine, handheld device or portable set, laptop device, mobile communication terminal, multicomputer system, based on microprocessor it is System, programmable electronic equipment, network PC, minicom, mainframe computer include the distribution of any of the above system or equipment Formula computing environment etc..
Although depicting the application by embodiment, it will be appreciated by the skilled addressee that the application have it is many deformation and Change is without departing from spirit herein, it is desirable to which appended claim includes these deformations and changed without departing from the application's Spirit.

Claims (14)

  1. A kind of 1. method of automatic code generating file, it is characterised in that methods described includes:
    First code file is traveled through, searches some first language texts in the first code file;
    Some first language texts are replaced with into corresponding variable name;
    Corresponding relation based on the variable name Yu the first language text, generate first language file;
    First language text in the first language file is translated into second language text, to generate second language file, The second language file includes the corresponding relation of second language text and the variable name;
    Based on the second language file, the variable name in the first code file is replaced with into corresponding second language Text is to generate second code file.
  2. 2. according to the method for claim 1, it is characterised in that traversal first code file, search the first code file In some first language texts, including:
    The code in the first code file is traveled through, searches the Chinese information in addition to Chinese annotation in the code;
    The Chinese information found is defined as first language text.
  3. 3. according to the method for claim 1, it is characterised in that replace with some first language texts corresponding Variable name before, in addition to:
    According to the code before the first language text and variable, the set membership between, formulate and first language Say variable name corresponding to text;Or
    According to the location of code before the first language text, variable corresponding with the first language text is formulated Name.
  4. 4. according to the method for claim 1, it is characterised in that based on the second language file, by the first code The variable name in file replaces with corresponding second language text to generate second code file, including:
    Determine that the first language text needs the language form replaced according to replacement demand;
    Transfer second language file corresponding with the language form;
    Based on the second language file, the variable name in the first code file is replaced with into corresponding second language Text is to generate second code file.
  5. 5. according to the method for claim 1, it is characterised in that methods described also includes:
    Judge the type of the first code file;
    If html type files, then the html type files are converted into js type files.
  6. 6. according to the method for claim 5, it is characterised in that the type of the first code file includes:js、html、 Jsp, php or vm.
  7. 7. according to the method for claim 1, it is characterised in that methods described also includes:
    After the first code document upgrading, the first language text newly increased is searched;
    Variable name corresponding with the first language text newly increased is formulated according to the preset rules;
    By the variable name and the corresponding relation of the first language text newly increased, the first language file is filled into.
  8. 8. a kind of device of automatic code generating file, it is characterised in that described device includes:
    Searching unit, for traveling through first code file, search some first language texts in the first code file;
    First replacement unit, for some first language texts to be replaced with into corresponding variable name;
    File generating unit, for the corresponding relation based on the variable name Yu the first language text, generate first language File;
    Translation unit, for the first language text in the first language file to be translated into second language text, with generation Second language file, the second language file include the corresponding relation of second language text and the variable name;
    Second replacement unit, for based on the second language file, the variable name in the first code file to be replaced Corresponding second language text is changed to generate second code file.
  9. 9. device according to claim 8, it is characterised in that the searching unit includes:
    Spider module, for traveling through the code in the first code file, search in the code in addition to Chinese annotation Chinese information;
    Determining module, for the Chinese information found to be defined as into first language text.
  10. 10. device according to claim 8, it is characterised in that described device also includes:
    Variable name formulates unit, for being closed according to the code before the first language text and variable, the father and son between System, formulate variable name corresponding with the first language text;Or for according to the code before the first language text Location, formulate variable name corresponding with the first language text.
  11. 11. device according to claim 8, it is characterised in that second replacement unit includes:
    Language determining module, for determining that the first language text needs the language form replaced according to replacement demand;
    File transfers module, for transferring second language file corresponding with the language form;
    Replacement module, for based on the second language file, the variable name in the first code file to be replaced with Corresponding second language text is to generate second code file.
  12. 12. device according to claim 8, it is characterised in that described device also includes:
    Type conversion unit, for judging the type of the first code file;If html type files, then by described in Html type files are converted to js type files.
  13. 13. device according to claim 12, it is characterised in that the type of the first code file includes:js、 Html, jsp, php or vm.
  14. 14. device according to claim 8, it is characterised in that described device also includes:
    Updating block, for after the first code document upgrading, searching the first language text newly increased;According to described pre- If Rulemaking variable name corresponding with the first language text newly increased;By the variable name with it is described newly increase the The corresponding relation of one language text, fill into the first language file.
CN201610341016.8A 2016-05-20 2016-05-20 Method and device for automatically generating code file Active CN107402746B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610341016.8A CN107402746B (en) 2016-05-20 2016-05-20 Method and device for automatically generating code file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610341016.8A CN107402746B (en) 2016-05-20 2016-05-20 Method and device for automatically generating code file

Publications (2)

Publication Number Publication Date
CN107402746A true CN107402746A (en) 2017-11-28
CN107402746B CN107402746B (en) 2020-08-04

Family

ID=60389553

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610341016.8A Active CN107402746B (en) 2016-05-20 2016-05-20 Method and device for automatically generating code file

Country Status (1)

Country Link
CN (1) CN107402746B (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109200581A (en) * 2018-07-25 2019-01-15 深圳点猫科技有限公司 Method, the electronic equipment of game role are controlled by python code
CN109684096A (en) * 2018-12-29 2019-04-26 北京超图软件股份有限公司 A kind of software program recycling processing method and device
CN109918166A (en) * 2019-03-12 2019-06-21 天津字节跳动科技有限公司 Applet process method, apparatus and electronic equipment
CN110018876A (en) * 2019-04-16 2019-07-16 成都四方伟业软件股份有限公司 The international method, apparatus of software application and electronic equipment
CN110413574A (en) * 2019-07-30 2019-11-05 深圳市携众通科技有限公司 A kind of method of automatic code generating internationalized resources
CN110704154A (en) * 2019-10-12 2020-01-17 杭州行至云起科技有限公司 Multi-language template issuing method and system
WO2020206837A1 (en) * 2019-04-12 2020-10-15 深圳壹账通智能科技有限公司 Code segment positioning method and device, computer apparatus, and storage medium
CN111813474A (en) * 2020-06-28 2020-10-23 深圳市元征科技股份有限公司 Multi-language display method and device and electronic equipment
CN111966584A (en) * 2020-07-30 2020-11-20 上海泛微网络科技股份有限公司 Automatic detection method and device for jsp code language specification
CN112199962A (en) * 2020-09-30 2021-01-08 京东数字科技控股股份有限公司 Code processing method and device, computer equipment and storage medium
CN112286557A (en) * 2020-11-05 2021-01-29 苏州帝博信息技术有限公司 Method and device for updating code content in non-covering mode
CN113011201A (en) * 2021-03-19 2021-06-22 北京沃东天骏信息技术有限公司 Code file processing method and device
CN113312057A (en) * 2021-06-17 2021-08-27 上海小熊星教育科技有限公司 Code processing method, programming assisting method, medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120204160A1 (en) * 2011-02-09 2012-08-09 Particle Code, Inc. Managing Non-Common Features for Program Code Translation
CN102637168A (en) * 2012-03-19 2012-08-15 深圳市共进电子股份有限公司 Method for realizing automatic language translation in graphical user interface
US20140033184A1 (en) * 2012-07-26 2014-01-30 Eric Addkison Pendergrass Localizing computer program code
CN104915204A (en) * 2015-06-08 2015-09-16 小米科技有限责任公司 Web processing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120204160A1 (en) * 2011-02-09 2012-08-09 Particle Code, Inc. Managing Non-Common Features for Program Code Translation
CN102637168A (en) * 2012-03-19 2012-08-15 深圳市共进电子股份有限公司 Method for realizing automatic language translation in graphical user interface
US20140033184A1 (en) * 2012-07-26 2014-01-30 Eric Addkison Pendergrass Localizing computer program code
CN104915204A (en) * 2015-06-08 2015-09-16 小米科技有限责任公司 Web processing method and device

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109200581B (en) * 2018-07-25 2021-05-25 深圳点猫科技有限公司 Method and electronic device for controlling game role through python code
CN109200581A (en) * 2018-07-25 2019-01-15 深圳点猫科技有限公司 Method, the electronic equipment of game role are controlled by python code
CN109684096A (en) * 2018-12-29 2019-04-26 北京超图软件股份有限公司 A kind of software program recycling processing method and device
CN109918166A (en) * 2019-03-12 2019-06-21 天津字节跳动科技有限公司 Applet process method, apparatus and electronic equipment
CN109918166B (en) * 2019-03-12 2022-04-01 天津字节跳动科技有限公司 Applet processing method and device and electronic equipment
WO2020206837A1 (en) * 2019-04-12 2020-10-15 深圳壹账通智能科技有限公司 Code segment positioning method and device, computer apparatus, and storage medium
CN110018876A (en) * 2019-04-16 2019-07-16 成都四方伟业软件股份有限公司 The international method, apparatus of software application and electronic equipment
CN110413574A (en) * 2019-07-30 2019-11-05 深圳市携众通科技有限公司 A kind of method of automatic code generating internationalized resources
CN110704154A (en) * 2019-10-12 2020-01-17 杭州行至云起科技有限公司 Multi-language template issuing method and system
CN111813474A (en) * 2020-06-28 2020-10-23 深圳市元征科技股份有限公司 Multi-language display method and device and electronic equipment
CN111966584A (en) * 2020-07-30 2020-11-20 上海泛微网络科技股份有限公司 Automatic detection method and device for jsp code language specification
CN112199962A (en) * 2020-09-30 2021-01-08 京东数字科技控股股份有限公司 Code processing method and device, computer equipment and storage medium
CN112286557A (en) * 2020-11-05 2021-01-29 苏州帝博信息技术有限公司 Method and device for updating code content in non-covering mode
CN112286557B (en) * 2020-11-05 2024-03-22 苏州帝博信息技术有限公司 Method and device for updating code content in non-coverage mode
CN113011201A (en) * 2021-03-19 2021-06-22 北京沃东天骏信息技术有限公司 Code file processing method and device
CN113312057A (en) * 2021-06-17 2021-08-27 上海小熊星教育科技有限公司 Code processing method, programming assisting method, medium and electronic equipment
CN113312057B (en) * 2021-06-17 2023-10-03 上海小熊星教育科技有限公司 Code processing method, programming auxiliary method, medium and electronic equipment

Also Published As

Publication number Publication date
CN107402746B (en) 2020-08-04

Similar Documents

Publication Publication Date Title
CN107402746A (en) A kind of method and device of automatic code generating file
US10679148B2 (en) Implicit bridging of machine learning tasks
US11423222B2 (en) Method and apparatus for text error correction, electronic device and storage medium
CN111325020B (en) Event argument extraction method and device and electronic equipment
US8903707B2 (en) Predicting pronouns of dropped pronoun style languages for natural language translation
US9720908B2 (en) Generating a context for translating strings based on associated application source code and markup
US11914964B2 (en) Method and apparatus for training semantic representation model, device and computer storage medium
EP3851977A1 (en) Method, apparatus, electronic device, and storage medium for extracting spo triples
WO2021174864A1 (en) Information extraction method and apparatus based on small number of training samples
CN110532487B (en) Label generation method and device
CN107291692B (en) Artificial intelligence-based word segmentation model customization method, device, equipment and medium
CN113220836A (en) Training method and device of sequence labeling model, electronic equipment and storage medium
CN105339889A (en) Techniques for language translation localization for computer applications
JP2023027194A (en) Translation method, apparatus, electronic device, readable storage medium and computer program
CN107885719B (en) Vocabulary category mining method and device based on artificial intelligence and storage medium
US11645452B2 (en) Performance characteristics of cartridge artifacts over text pattern constructs
CN111858880A (en) Method and device for obtaining query result, electronic equipment and readable storage medium
CN111985251A (en) Translation quality evaluation method and device
CN111310481B (en) Speech translation method, device, computer equipment and storage medium
CN108959343A (en) A kind of method and device of text modification
KR20200017600A (en) Apparatus and Method for Providing Translation Service
CN114327492A (en) Code translation method, device and equipment
Ljubešic et al. Easily accessible language technologies for Slovene, Croatian and Serbian
CN114781384A (en) Intelligent labeling method, device and equipment for named entities and storage medium
KR20230138714A (en) Method for providing translations correction editor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20201014

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20201014

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Advanced innovation technology Co.,Ltd.

Address before: Greater Cayman, British Cayman Islands

Patentee before: Alibaba Group Holding Ltd.

TR01 Transfer of patent right