CN110262800A - Multilingual processing method and processing device - Google Patents
Multilingual processing method and processing device Download PDFInfo
- Publication number
- CN110262800A CN110262800A CN201910476101.9A CN201910476101A CN110262800A CN 110262800 A CN110262800 A CN 110262800A CN 201910476101 A CN201910476101 A CN 201910476101A CN 110262800 A CN110262800 A CN 110262800A
- Authority
- CN
- China
- Prior art keywords
- natural language
- source code
- spoken
- current
- language
- 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.)
- Pending
Links
- 238000012545 processing Methods 0.000 title claims abstract description 46
- 238000003672 processing method Methods 0.000 title claims abstract description 44
- 238000013519 translation Methods 0.000 claims abstract description 74
- 238000000034 method Methods 0.000 claims description 54
- 238000007689 inspection Methods 0.000 claims description 21
- 230000003068 static effect Effects 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 15
- 230000008569 process Effects 0.000 description 19
- 230000006870 function Effects 0.000 description 18
- 238000010586 diagram Methods 0.000 description 16
- 238000004891 communication Methods 0.000 description 8
- 230000007423 decrease Effects 0.000 description 7
- 238000011161 development Methods 0.000 description 5
- 230000018109 developmental process Effects 0.000 description 5
- 238000012423 maintenance Methods 0.000 description 5
- 238000011017 operating method Methods 0.000 description 4
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000004519 manufacturing process Methods 0.000 description 3
- 238000007639 printing Methods 0.000 description 3
- 239000000047 product Substances 0.000 description 3
- 230000008878 coupling Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000000750 progressive effect Effects 0.000 description 2
- 238000013518 transcription Methods 0.000 description 2
- 230000035897 transcription Effects 0.000 description 2
- 230000007306 turnover Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 239000007795 chemical reaction product Substances 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 239000004744 fabric Substances 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 230000033772 system development Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
- 238000012800 visualization Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/43—Checking; Contextual analysis
- G06F8/436—Semantic checking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/447—Target code generation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Machine Translation (AREA)
Abstract
The present invention provides a kind of multilingual processing method and processing device, multilingual processing method includes: the current natural language identified in the source code according to the character separator in source code;It is identified according to the current spatial term spoken and written languages, the spoken and written languages are identified as in preset translation database and character corresponding to the current natural language and target natural language;The corresponding target natural language of the spoken and written languages mark is searched in the translation database.The present invention can save a large amount of exploitation coding work, improve the reliability of software systems.
Description
Technical field
The present invention relates to software programming process fields, more particularly to a kind of multilingual processing method and processing device.
Background technique
Software systems are more and more the case where all parts of the world uses, in order to meet the use of different regions, different language
Person, interface and prompt need to show the spoken and written languages of country variant, area.In order to solve the above technical problems, being opened in software systems
In hair, current way is: multilingual transfer function is used in source code, is embedded in spoken and written languages mark, key assignments title, and
Generate the associated with of spoken and written languages mark, key assignments title and concrete syntax text and key assignments data.When software systems are run, lead to
It crosses and dynamically associates concrete syntax text/key assignments data and be shown.In the whole life cycle of software systems, this method exist with
Lower problem:
(1) in source code be embedded in spoken and written languages mark after, developer can not directly understanding language words identification represent
Meaning, the readable decline of source code, causes subsequent software maintenance and upgrade cost to improve.Similar language words identification: PUB_
COMPANY_000, PRI_T5270_MO_001 etc..
(2) source code is related to spoken and written languages processing, includes interface script, printing script, service logic program.Its median surface
After script and printing script are converted to spoken and written languages mark, since the word length of insertion changes, original visualizing will be upset
The page format of view is developed, it is the most unfavorable for later maintenance.For example " company " accounts for 4 characters, is converted to multilingual mark
15 characters are occupied after PUB_COMPANY_000, in certain visual development views, are shown therefore length will extend, are influenced
Whole effect of visualization.
(3) incidence relation of spoken and written languages mark, spoken and written languages mark and concrete syntax text is embedded in source code, this two
Item work belongs to the function of non-traffic logic, but needs to be embedded in business logic codes, increases the work of service logic exploitation
Amount and difficulty, influence the development progress of project.
(4) mother tongue in translation service demand needs developer to disassemble entry or sentence, is supplied to translator and turns over
It translates, translation is processed into associated with by developer again, occupies the time that service logic is realized, influences the development progress of project.
To sum up, the current one kind that lacks not only can satisfy multizone multiplexing, but also can reduce development amount and improve generation
Multilingual processing method in the maintainable software systems source code of code.
Summary of the invention
For the problems of the prior art, the present invention provides one kind can save global software system development and maintenance
The multilingual processing method and processing device for handling the human cost of work in the process, this method save a large amount of exploitation coding works
Make, while also improving the reliability of software systems.
In order to solve the above technical problems, the present invention the following technical schemes are provided:
In a first aspect, the present invention provides a kind of multilingual processing method, comprising:
The current natural language in source code is identified according to the character separator in source code;
It is identified according to current spatial term spoken and written languages, spoken and written languages are identified as in preset translation database and work as
Character corresponding to preceding natural language and target natural language;
The corresponding target natural language of spoken and written languages mark is searched in translation database.
Preferably, multilingual processing method further include: with the current natural language in target natural language replacement source code.
Preferably, character separator includes annotation symbol and assignment symbol.
Preferably, multilingual processing method further include: the character string of source code is scanned, the word in character string is obtained
Accord with separator.
Preferably, the current natural language in source code is identified according to the character separator in source code, comprising:
Static semantic inspection is carried out to source code, generates the inspection result of static semantic;
According to inspection result, abstract syntax tree is generated;
According to abstract syntax tree, the current natural language in source code is identified.
Preferably, multilingual processing method further include: by current natural language translation be target natural language, and be stored in turn over
Translate database.
Preferably, multilingual processing method further include: replaced according to operator, spoken and written languages mark and by current natural language
Source code after being changed to target natural language generates intermediate code;
Intermediate code is compiled, the source code with object language is generated.
Second aspect, the present invention provide a kind of multilingual processing unit, which includes:
Natural language recognition unit, for identifying the current nature in source code according to the character separator in source code
Language;
Spoken and written languages identification generation unit, for being identified according to current spatial term spoken and written languages, spoken and written languages mark
Know be preset translation database in character corresponding to current natural language and target natural language;
Natural language searching unit, for searching the corresponding target nature language of spoken and written languages mark in translation database
Speech.
Preferably, multilingual processing unit further include: replacement unit, for working as in target natural language replacement source code
Preceding natural language.
Preferably, multilingual processing unit further include: source scan unit is swept for the character string to source code
It retouches, obtains the character separator in character string.
Preferably, natural language recognition unit includes:
Static semantic checks module, for carrying out static semantic inspection to source code, generates the inspection result of static semantic;
Abstract syntax tree generation module, for generating abstract syntax tree according to inspection result;
Current natural language recognition module, for identifying the current natural language in source code according to abstract syntax tree.
Preferably, multilingual processing unit, further includes:
Intermediate code generation unit, for replacing with mesh according to operator, spoken and written languages mark and by current natural language
Source code after marking natural language generates intermediate code;
Object language source code generation unit generates the source generation with object language for being compiled to intermediate code
Code.
The third aspect, the present invention provides a kind of electronic equipment, including memory, processor and storage are on a memory and can
The step of computer program run on a processor, processor realizes multilingual processing method when executing program.
Fourth aspect, the present invention provide a kind of computer readable storage medium, are stored thereon with computer program, the calculating
The step of machine program realizes multilingual processing method when being executed by processor.
As can be seen from the above description, multilingual processing method and processing device provided by the invention, passes through the word in identification source code
Separator and its context are accorded with, can identify the current natural language in source code, and look into preset translation database
Look for target natural language corresponding to current natural language, and then generate have target natural language source code.Serve as interpreter
In database be not present current natural language when, the present invention also provides how by the current natural language how to be translated as target from
Right language, and the method being stored in translation data, it is specific: after being object language for current natural language translation, to turn over
It translates and increases corresponding spoken and written languages mark in database newly and by the target natural language after current natural language translation, deposit simultaneously
Enter into translation database.Multilingual processing work in source code is removed and is compiled by multilingual processing method provided by the invention
Code link, and put it to compiling link and be automatically performed, a large amount of exploitation coding work is saved, simultaneously because the present invention uses
Unartificial processing source code, and then improve the reliability of software systems, solve transnational, trans-regional software systems in exploitation and
It is the problem of dynamic shows different language text and source code readability is caused to decline in maintenance process.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is the present invention
Some embodiments for those of ordinary skill in the art without creative efforts, can also basis
These attached drawings obtain other attached drawings.
Fig. 1 is method in the embodiment of the present invention10Flow diagram;
Fig. 2 is the flow diagram of step 100 in the embodiment of the present invention;
Fig. 3 is method in the embodiment of the present invention20Flow diagram;
Fig. 4 is multilingual processing method in specific application example of the invention30Flow diagram;
Fig. 5 is the flow diagram of multilingual processing method in specific application example of the invention;
Fig. 6 is multilingual file generated flow diagram in specific application example of the invention;
Fig. 7 is the structural schematic diagram one of multilingual processing unit in specific application example of the invention;
Fig. 8 is the structural schematic diagram two of multilingual processing unit in specific application example of the invention;
Fig. 9 is the structural schematic diagram three of multilingual processing unit in specific application example of the invention;
Figure 10 is the structural schematic diagram of the electronic equipment in the embodiment of the present invention.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, the technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art
Every other embodiment obtained without creative efforts, shall fall within the protection scope of the present invention.
Current natural language and target natural language used in the embodiment of the present invention refer both to as natural language, such as Russia
Text, Japanese etc.;Program language is computer language, such as Java.
It not only can satisfy multizone multiplexing in view of one kind is lacked in the prior art, but also development amount and raising can be reduced
Multilingual processing method in the software systems source code of code maintainability.The embodiment of the present invention provides a kind of multilingual place
The specific embodiment of reason method, referring to Fig. 1 this method10Specifically include following content:
Step 100: the current natural language in source code is identified according to the character separator in source code.
Step 100 in the specific implementation, can be scanned the character string of source code, obtain the character point in character string
Every symbol, and go out according to character separator and its context identification the current natural language in source code.
Step 200: being identified according to current spatial term spoken and written languages, spoken and written languages are identified as preset translation data
In library with character corresponding to current natural language and target natural language.
Source language text is converted into spoken and written languages mark, and multi-language data is written into incidence relation between the two
Library, it is to be understood that context need to be identified in spoken and written languages simultaneously when required and increase relevant treatment function.
Step 300: the corresponding target natural language of spoken and written languages mark is searched in translation database.
Translation database in step 300 is stored with spoken and written languages mark, current natural language and target natural language
Incidence relation.
In one embodiment, need to judge whether to have existed the text of language corresponding to target natural language in translation database
Word mark, if it does not, needing to increase newly corresponding spoken and written languages mark in translation database and turning over current natural language
Target natural language after translating, while being deposited into translation database.
As can be seen from the above description, multilingual processing method provided by the invention, is separated by the character in identification source code
Symbol and its context, can identify the current natural language in source code, and search and work as in preset translation database
Target natural language corresponding to preceding natural language, and then generate the source code with target natural language.This method saves
A large amount of exploitation coding work, and improve the reliability of software systems, solve transnational, trans-regional software systems in exploitation and
It is the problem of dynamic shows different language text and source code readability is caused to decline in maintenance process.
In one embodiment, multilingual processing method further includes step S100:
S100: with the current natural language in target natural language replacement source code.
In one embodiment, character separator includes annotation symbol and assignment symbol.
It should be noted that the character separator of different program language types is not exactly the same, such as in c programming language
Middle single quotation marks can be used as character separator, and single quotation marks cannot function as character separator in Java, before step 100,
Need to identify the computer language of source code, that is, determine source code in computer language classification and then according to word
Symbol separator identifies the current natural language in source code..
In one embodiment, multilingual processing method further includes step S200:
S200: being scanned the character string of source code, obtains the character separator in character string.
Step 200 in the specific implementation, is scanned the source codes such as interface script, printing script, service logic program,
Identify the character separator in source code, including all kinds of constants and their context.
Referring to table 1 and table 2, such as (" company name please be inputted for Text=" from date " and this.showPrompt
Claim ") source code, the character separator identified are as follows: "=" and " " " " further identification character separator context, such as:
Text ,=, be directed toward constant " from date " address pointer;This, point identification accord with the pointer of the address showPrompt, refer to
To the pointer of constant " Business Name please be input " address.In the process, the language of source code computer language need to be ensured compliance with
Specification, and identify the constant pointer that carry out multilingual processing.
1 character separator of table and its contextual example one
Word | Classification |
Text | Keyword |
= | Operator |
″ | Bound symbol |
From date | Constant |
″ | Bound symbol |
2 character separator of table and its contextual example two
Word | Classification |
this | Keyword |
. | Operator |
showPrompt | Identifier |
( | Bound symbol |
″ | Bound symbol |
It please input Business Name | Constant |
″ | Bound symbol |
) | Bound symbol |
; | Bound symbol |
In one embodiment, referring to fig. 2, step 100 includes:
Step 101: static semantic inspection being carried out to source code, generates the inspection result of static semantic.
Step 102: according to inspection result, generating abstract syntax tree.
Step 103: according to abstract syntax tree, identifying the current natural language in source code.
In step 101-103, static semantic inspection is carried out according to linguistic norm, abstract syntax tree is generated, identifies source
Spoken and written languages: such as sentence " this.showPrompt (" Business Name please be input ") ", after generating abstract syntax parsing tree, inspection
Look into whether showPrompt is the function that this allows then checks whether " please input Business Name " is showPrompt letter
The legal input data of number, and the semanteme being directed toward according to showPrompt determine that " please input Business Name " is current natural
Language then increases a semantic processes node on abstract syntax parsing tree, indicates that " please input Business Name " is current natural
Language becomes the operator of spoken and written languages mark.
In one embodiment, multilingual processing method further includes step S300:
S300: it is target natural language by current natural language translation, and is stored in translation database.
Target natural language corresponding with current natural language and spoken and written languages mark are stored in translation database.With
And the corresponding relationship between three, in addition, not storing target corresponding to current natural language text in database of serving as interpreter
When natural language and spoken and written languages identify, need to increase newly corresponding spoken and written languages mark in translation database and will be currently natural
Target natural language after language translation, while being deposited into translation database.
In one embodiment, referring to Fig. 3, multilingual processing method further includes method20:
Step 301: after replacing with target natural language according to operator, spoken and written languages mark and by current natural language
Source code generates intermediate code.
The same example in step 200, current natural language are identified by spoken and written languages and are replaced, it may be assumed that Text ,=, refer to
To the pointer of the address constant " PRI_T5267_MO_002 ";This, the pointer of the point identification symbol address showPrompt, direction
The pointer of the address constant " PRI_T5267_MO_046 ".
Step 302: intermediate code being compiled, the source code with object language is generated.
Source code (also referred to as source program) refers to the uncompiled text text according to certain programming language specification writing
Part is the readable computer language instruction of series of human.The final purpose of computer source code is by human-readable text
Translation becomes the binary instruction that computer can execute, and this process is called compiling.It is understood that step 302 is having
Body further includes optimizing to intermediate code when implementing.When system is run, is identified according to the spoken and written languages in source code and be
The area of system operation, chooses corresponding target natural language and is shown, printed or prompted.
To further explain this programme, the present invention is to provide by taking an XML source code and a JAVA source code as an example
The specific application example of multilingual processing method, the specific application example specifically include following content30, referring to fig. 4 to Fig. 6.
S0: word string scanning is carried out to source code, identifies character separator.
Such as the source code for Text=" from date " and this.showPrompt (" Business Name please be input "),
Word not Chu character separator are as follows: "=" and " " " ".Source code at this time remains with current natural language, referring to Fig. 5.
S1: the context of character separator is identified.
Further identify character separator context, such as: Text ,=, be directed toward constant " from date " address pointer;
This, point identification accord with the pointer of the address showPrompt, are directed toward the pointer of constant " please input Business Name " address.Herein
In the process, the linguistic norm of source code computer language need to be ensured compliance with, and identifies that the constant that carry out multilingual processing refers to
Needle.
S2: current natural language is gone out according to character separator and its context identification.
According to source code computer language specification carry out static semantic inspection, generate abstract syntax tree, identify it is current from
Right language: such as sentence " this.showPrompt (" please input Business Name ") " after generating abstract syntax parsing tree, checks
ShowPrompt whether be this allow function, then check " Business Name please be input " whether be showPrompt function close
The input data of method, and the semanteme being directed toward according to showPrompt determine that " please input Business Name " is current natural language.
S3: it is identified according to current spatial term spoken and written languages.
It is understood that spoken and written languages are identified as in preset translation database and current natural language and target nature
Character corresponding to language.The corresponding relationship of spoken and written languages mark and current natural language is stored in the translation database.
After being determined that " please input Business Name " is current natural language, increase by one on abstract syntax parsing tree
Semantic processes node indicates that " please input Business Name " current natural language text becomes the operator of spoken and written languages mark.
S4: current natural language is replaced with by spoken and written languages mark according to operator, and is stored in translation database.
S5: intermediate code is generated.
Spoken and written languages mark is searched in translation database, and the current natural language in source code is replaced with into language text
Word mark, it should be noted that the current natural language in source code is replaced via spoken and written languages mark at this time.
In the specific implementation, need to judge whether to have existed target natural language institute in translation database referring to Fig. 5, S5
Corresponding spoken and written languages mark, if it does not, needing to increase newly corresponding spoken and written languages mark in translation database and will work as
Target natural language after preceding natural language translation, while being deposited into translation database, it will referring to Fig. 6, such as transcription platform
Current natural language translation is at target natural language.It is understood that in the process, translation database is by country, area
Generate multilingual file.
S6: being compiled intermediate code, generates the object code with target natural language.
S6 in the specific implementation, can be compiled the multilingual text that simultaneously combining translation database generates to intermediate code
Part generates object code.
As can be seen from the above description, multilingual processing method provided by the invention, is separated by the character in identification source code
Symbol and its context, can identify the current natural language in source code, and search and work as in preset translation database
Target natural language corresponding to preceding natural language, and then generate the source code with target natural language.Serve as interpreter database
In when current natural language is not present, the present invention also provides how how the current natural language to be translated as target nature language
Speech, and the method being stored in translation data, it is specific: after being object language for current natural language translation, in translation number
According to increasing corresponding spoken and written languages mark in library newly and by the target natural language after current natural language translation, be deposited into simultaneously
In translation database.Multilingual processing work in source code is removed coding collar by multilingual processing method provided by the invention
Section, and put it to compiling link and be automatically performed, a large amount of exploitation coding work is saved, simultaneously because the present invention is using inhuman
Work handles source code, and then improves the reliability of software systems, solves transnational, trans-regional software systems and is developing and safeguarding
It in the process, is the problem of dynamic shows different language text and source code readability is caused to decline.
Based on the same inventive concept, the embodiment of the present application also provides multilingual processing units, can be used to implement above-mentioned
Method described in embodiment, such as the following examples.The principle solved the problems, such as due to multilingual processing unit and multilingual place
Reason method is similar, therefore the implementation of multilingual processing unit may refer to multilingual processing method and implement, and it is no longer superfluous to repeat place
It states.Used below, the combination of the software and/or hardware of predetermined function may be implemented in term " unit " or " module ".To the greatest extent
System described in pipe following embodiment is preferably realized with software, but the combined reality of hardware or software and hardware
Now and may and it be contemplated.
The embodiment of the present invention provides a kind of specific reality of multilingual processing unit that can be realized multilingual processing method
Mode is applied, referring to Fig. 7, multilingual processing unit specifically includes following content:
Natural language recognition unit 10, for identifying working as in the source code according to the character separator in source code
Preceding natural language;
Spoken and written languages identification generation unit 20, it is described for being identified according to the current spatial term spoken and written languages
Spoken and written languages are identified as in preset translation database and character corresponding to the current natural language and target natural language;
Natural language searching unit 30, for being searched in the translation database corresponding to the spoken and written languages mark
Target natural language.
Preferably, referring to Fig. 8, multilingual processing unit further include: replacement unit 40 is used for target natural language replacing source
Current natural language in code.
Preferably, referring to Fig. 9, multilingual processing unit further include: source scan unit 50, for the word to source code
Symbol string is scanned, and obtains the character separator in character string.
Preferably, natural language recognition unit includes:
Static semantic checks module, for carrying out static semantic inspection to source code, generates the inspection result of static semantic;
Abstract syntax tree generation module, for generating abstract syntax tree according to inspection result;
Current natural language recognition module, for identifying the current natural language in source code according to abstract syntax tree.
Preferably, multilingual processing unit, further includes:
Intermediate code generation unit, for replacing with mesh according to operator, spoken and written languages mark and by current natural language
Source code after marking natural language generates intermediate code;
Object language source code generation unit generates the source generation with object language for being compiled to intermediate code
Code.
As can be seen from the above description, multilingual processing unit provided by the invention, is separated by the character in identification source code
Symbol and its context, can identify the current natural language in source code, and search and work as in preset translation database
Target natural language corresponding to preceding natural language, and then generate the source code with target natural language.Serve as interpreter database
In when current natural language is not present, the present invention also provides how how the current natural language to be translated as target nature language
Speech, and the method being stored in translation data, it is specific: after being object language for current natural language translation, in translation number
According to increasing corresponding spoken and written languages mark in library newly and by the target natural language after current natural language translation, be deposited into simultaneously
In translation database.Multilingual processing work in source code is removed coding collar by multilingual processing method provided by the invention
Section, and put it to compiling link and be automatically performed, a large amount of exploitation coding work is saved, simultaneously because the present invention is using inhuman
Work handles source code, and then improves the reliability of software systems, solves transnational, trans-regional software systems and is developing and safeguarding
It in the process, is the problem of dynamic shows different language text and source code readability is caused to decline.
Embodiments herein, which also provides, can be realized Overall Steps in the multilingual processing method in above-described embodiment
The specific embodiment of a kind of electronic equipment, referring to Figure 10, electronic equipment specifically includes following content:
Processor (processor) 1201, memory (memory) 1202, communication interface (Communications
Interface) 1203 and bus 1204;
Wherein, processor 1201, memory 1202, communication interface 1203 complete mutual communication by bus 1204;
Communication interface 1203 passes for realizing the information between the relevant devices such as server-side devices, transcription platform and ustomer premises access equipment
It is defeated.
Processor 1201 is used to call the computer program in memory 1202, and processor is realized when executing computer program
The Overall Steps in multilingual processing method in above-described embodiment, for example, being realized when processor execution computer program following
Step:
Step 100: the current natural language in the source code is identified according to the character separator in source code;
Step 200: being identified according to the current spatial term spoken and written languages, the spoken and written languages are identified as preset
In translation database with character corresponding to the current natural language and target natural language;
Step 300: the corresponding target natural language of the spoken and written languages mark is searched in the translation database.
As can be seen from the above description, the electronic equipment in the embodiment of the present application, passes through the character separator in identification source code
And its context, can identify the current natural language in source code, and search in preset translation database with it is current
Target natural language corresponding to natural language, and then generate the source code with target natural language.Serve as interpreter in database
There is no when current natural language, the present invention also provides how how the current natural language being translated as target natural language,
And it is stored in the method in translation data, it is specific: after being object language for current natural language translation, in translation database
In increase corresponding spoken and written languages mark newly and by the target natural language after current natural language translation, while being deposited into translation
In database.Multilingual processing work removing in source code is encoded link by multilingual processing method provided by the invention,
And put it to compiling link and be automatically performed, a large amount of exploitation coding work is saved, simultaneously because the present invention is using unartificial
Source code is handled, and then improves the reliability of software systems, transnational, trans-regional software systems is solved and is developing and safeguarding
Cheng Zhong is the problem of dynamic shows different language text and source code readability is caused to decline.
Embodiments herein, which also provides, can be realized Overall Steps in the multilingual processing method in above-described embodiment
A kind of computer readable storage medium is stored with computer program on computer readable storage medium, which is located
Reason device realizes the Overall Steps of the multilingual processing method in above-described embodiment when executing, for example, processor executes computer journey
Following step is realized when sequence:
Step 100: the current natural language in the source code is identified according to the character separator in source code;
Step 200: being identified according to the current spatial term spoken and written languages, the spoken and written languages are identified as preset
In translation database with character corresponding to the current natural language and target natural language;
Step 300: the corresponding target natural language of the spoken and written languages mark is searched in the translation database.
As can be seen from the above description, the computer readable storage medium in the embodiment of the present application, by identification source code
Character separator and its context can identify the current natural language in source code, and in preset translation database
Lookup and target natural language corresponding to current natural language, and then generate the source code with target natural language.When turning over
When translating in database there is no current natural language, the present invention also provides how how the current natural language to be translated as target
Natural language, and the method being stored in translation data, specific: after being object language for current natural language translation,
Increase corresponding spoken and written languages mark in translation database newly and by the target natural language after current natural language translation, simultaneously
It is deposited into translation database.Multilingual processing method provided by the invention removes the multilingual processing work in source code
Link is encoded, and puts it to compiling link and is automatically performed, a large amount of exploitation coding work is saved, simultaneously because the present invention adopts
With unartificial processing source code, and then the reliability of software systems is improved, solves transnational, trans-regional software systems and developing
It is the problem of dynamic shows different language text and source code readability is caused to decline in maintenance process.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for hardware+
For program class embodiment, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to side
The part of method embodiment illustrates.
It is above-mentioned that this specification specific embodiment is described.Other embodiments are in the scope of the appended claims
It is interior.In some cases, the movement recorded in detail in the claims or step can be come according to the sequence being different from embodiment
It executes and desired result still may be implemented.In addition, process depicted in the drawing not necessarily require show it is specific suitable
Sequence or consecutive order are just able to achieve desired result.In some embodiments, multitasking and parallel processing be also can
With or may be advantageous.
Although this application provides the method operating procedure of such as embodiment or flow chart, based on routine or without creativeness
Labour may include more or less operating procedure.The step of enumerating in embodiment sequence is only that numerous steps execute
One of sequence mode, does not represent and unique executes sequence.It, can be by when device in practice or client production execute
It is executed according to embodiment or method shown in the drawings sequence or parallel executes (such as parallel processor or multiple threads
Environment).
Although this specification embodiment provides the method operating procedure such as embodiment or flow chart, based on conventional or
It may include more or less operating procedure without creative means.The step of enumerating in embodiment sequence is only numerous
One of step execution sequence mode does not represent and unique executes sequence.When device or end product in practice executes,
Can be executed according to embodiment or the execution of method shown in the drawings sequence or parallel (such as parallel processor or multithreading
The environment of processing, even distributed data processing environment).The terms "include", "comprise" or its any other variant are intended to
Cover non-exclusive inclusion, so that the process, method, product or the equipment that include a series of elements not only include those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, product or setting
Standby intrinsic element.In the absence of more restrictions, being not precluded is including process, method, the product of the element
Or there is also other identical or equivalent elements in equipment.
For convenience of description, it is divided into various modules when description apparatus above with function to describe respectively.Certainly, implementing this
The function of each module can be realized in the same or multiple software and or hardware when specification embodiment, it can also be by reality
Show the module of same function by the combination realization etc. of multiple submodule or subelement.Installation practice described above is only
Schematically, for example, the division of the unit, only a kind of logical function partition, can there is other draw in actual implementation
The mode of dividing, such as multiple units or components can be combined or can be integrated into another system, or some features can be ignored,
Or it does not execute.Another point, shown or discussed mutual coupling, direct-coupling or communication connection can be by one
The indirect coupling or communication connection of a little interfaces, device or unit can be electrical property, mechanical or other forms.
It is also known in the art that other than realizing controller in a manner of pure computer readable program code, it is complete
Entirely can by by method and step carry out programming in logic come so that controller with logic gate, switch, specific integrated circuit, programmable
Logic controller realizes identical function with the form for being embedded in microcontroller etc..Therefore this controller is considered one kind
Hardware component, and the structure that the device for realizing various functions that its inside includes can also be considered as in hardware component.Or
Person even, can will be considered as realizing the device of various functions either the software module of implementation method can be hardware again
Structure in component.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product
Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions
The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs
Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce
A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real
The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
In a typical configuration, calculating equipment includes one or more processors (CPU), input/output interface, net
Network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable medium
Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or
Any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, computer
Readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
It will be understood by those skilled in the art that the embodiment of this specification can provide as the production of method, system or computer program
Product.Therefore, in terms of this specification embodiment can be used complete hardware embodiment, complete software embodiment or combine software and hardware
Embodiment form.Moreover, it wherein includes computer available programs that this specification embodiment, which can be used in one or more,
Implement in the computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) of code
The form of computer program product.
This specification embodiment can describe in the general context of computer-executable instructions executed by a computer,
Such as program module.Generally, program module includes routines performing specific tasks or implementing specific abstract data types, journey
Sequence, object, component, data structure etc..This specification embodiment can also be practiced in a distributed computing environment, in these points
Cloth calculates in environment, by executing task by the connected remote processing devices of communication network.In distributed computing ring
In border, program module can be located in the local and remote computer storage media including storage equipment.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality
For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method
Part explanation.In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ",
The description of " specific example " or " some examples " etc. means specific features described in conjunction with this embodiment or example, structure, material
Or feature is contained at least one embodiment or example of this specification embodiment.In the present specification, to above-mentioned term
Schematic representation be necessarily directed to identical embodiment or example.Moreover, description specific features, structure, material or
Person's feature may be combined in any suitable manner in any one or more of the embodiments or examples.In addition, in not conflicting feelings
Under condition, those skilled in the art by different embodiments or examples described in this specification and different embodiment or can show
The feature of example is combined.
The foregoing is merely the embodiments of this specification embodiment, are not limited to this specification embodiment.It is right
For those skilled in the art, this specification embodiment can have various modifications and variations.It is all in this specification embodiment
Any modification, equivalent replacement, improvement and so within spirit and principle, the right that should be included in this specification embodiment are wanted
Within the scope of asking.
Claims (14)
1. a kind of multilingual processing method characterized by comprising
The current natural language in the source code is identified according to the character separator in source code;
It is identified according to the current spatial term spoken and written languages, the spoken and written languages are identified as in preset translation database
With character corresponding to the current natural language and target natural language;
The corresponding target natural language of the spoken and written languages mark is searched in the translation database.
2. multilingual processing method according to claim 1, which is characterized in that further include: with the target natural language
Replace the current natural language in the source code.
3. multilingual processing method according to claim 1, which is characterized in that the character separator include annotation symbol and
Assignment symbol.
4. multilingual processing method according to claim 1, which is characterized in that further include: to the character string of source code into
Row scanning, obtains the character separator in the character string.
5. multilingual processing method according to claim 1, which is characterized in that the character according in the source code
Separator identifies the current natural language in the source code, comprising:
Static semantic inspection is carried out to the source code, generates the inspection result of static semantic;
According to the inspection result, abstract syntax tree is generated;
According to abstract syntax tree, the current natural language in the source code is identified.
6. multilingual processing method according to claim 1, which is characterized in that further include: by the current natural language
It is translated as the target natural language, and is stored in the translation database.
7. multilingual processing method according to claim 2, which is characterized in that further include:
Source code after indicating according to operator, the spoken and written languages and replacing with current natural language target natural language,
Generate intermediate code;
Intermediate code is compiled, the source code with the object language is generated.
8. a kind of multilingual processing unit characterized by comprising
Natural language recognition unit, for identifying the current nature in the source code according to the character separator in source code
Language;
Spoken and written languages identification generation unit, for being identified according to the current spatial term spoken and written languages, the language text
Word is identified as in preset translation database and character corresponding to the current natural language and target natural language;
Natural language searching unit, for searching the corresponding target of the spoken and written languages mark in the translation database certainly
Right language.
9. multilingual processing unit as claimed in claim 8, which is characterized in that further include: replacement unit is used for the target
Natural language replaces the current natural language in the source code.
10. multilingual processing unit as claimed in claim 8, which is characterized in that further include: source scan unit is used for
The character string of source code is scanned, the character separator in the character string is obtained.
11. multilingual processing unit as claimed in claim 8, which is characterized in that natural language recognition unit includes:
Static semantic checks module, for carrying out static semantic inspection to the source code, generates the inspection result of static semantic;
Abstract syntax tree generation module, for generating abstract syntax tree according to the inspection result;
Current natural language recognition module, for identifying the current natural language in the source code according to abstract syntax tree.
12. multilingual processing unit as claimed in claim 8, which is characterized in that further include:
Intermediate code generation unit, for replacing with mesh according to operator, spoken and written languages mark and by current natural language
Source code after marking natural language generates intermediate code;
Object language source code generation unit generates the source generation with the object language for being compiled to intermediate code
Code.
13. a kind of electronic equipment including memory, processor and stores the calculating that can be run on a memory and on a processor
Machine program, which is characterized in that the processor realizes any one of claim 1 to 7 multilingual place when executing described program
The step of reason method.
14. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program quilt
The step of any one of claim 1 to the 7 multilingual processing method is realized when processor executes.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910476101.9A CN110262800A (en) | 2019-06-03 | 2019-06-03 | Multilingual processing method and processing device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910476101.9A CN110262800A (en) | 2019-06-03 | 2019-06-03 | Multilingual processing method and processing device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110262800A true CN110262800A (en) | 2019-09-20 |
Family
ID=67916411
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910476101.9A Pending CN110262800A (en) | 2019-06-03 | 2019-06-03 | Multilingual processing method and processing device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110262800A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110879933A (en) * | 2019-10-17 | 2020-03-13 | 中国第一汽车股份有限公司 | Component list file processing method and device, terminal and storage medium |
CN111160045A (en) * | 2019-12-27 | 2020-05-15 | 苏州亿歌网络科技有限公司 | Game resource file translation method, device and equipment |
CN111729313A (en) * | 2020-05-06 | 2020-10-02 | 完美世界(北京)软件科技发展有限公司 | Language configuration method and device, storage medium and electronic device |
CN111813474A (en) * | 2020-06-28 | 2020-10-23 | 深圳市元征科技股份有限公司 | Multi-language display method and device and electronic equipment |
CN112612448A (en) * | 2020-12-16 | 2021-04-06 | 平安普惠企业管理有限公司 | Front-end internationalized multi-page packaging method and device and computer equipment |
CN112988290A (en) * | 2019-12-12 | 2021-06-18 | 腾讯科技(深圳)有限公司 | Multi-language configuration file generation method, page display method, device and terminal |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050131672A1 (en) * | 2003-12-12 | 2005-06-16 | International Business Machines Corporation | Language-enhanced programming tools |
CN109799990A (en) * | 2017-11-16 | 2019-05-24 | 中标软件有限公司 | Source code annotates automatic generation method and system |
-
2019
- 2019-06-03 CN CN201910476101.9A patent/CN110262800A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050131672A1 (en) * | 2003-12-12 | 2005-06-16 | International Business Machines Corporation | Language-enhanced programming tools |
CN109799990A (en) * | 2017-11-16 | 2019-05-24 | 中标软件有限公司 | Source code annotates automatic generation method and system |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110879933A (en) * | 2019-10-17 | 2020-03-13 | 中国第一汽车股份有限公司 | Component list file processing method and device, terminal and storage medium |
CN112988290A (en) * | 2019-12-12 | 2021-06-18 | 腾讯科技(深圳)有限公司 | Multi-language configuration file generation method, page display method, device and terminal |
CN112988290B (en) * | 2019-12-12 | 2024-01-26 | 腾讯科技(深圳)有限公司 | Multi-language configuration file generation method, page display method, device and terminal |
CN111160045A (en) * | 2019-12-27 | 2020-05-15 | 苏州亿歌网络科技有限公司 | Game resource file translation method, device and equipment |
CN111729313A (en) * | 2020-05-06 | 2020-10-02 | 完美世界(北京)软件科技发展有限公司 | Language configuration method and device, storage medium and electronic device |
CN111813474A (en) * | 2020-06-28 | 2020-10-23 | 深圳市元征科技股份有限公司 | Multi-language display method and device and electronic equipment |
CN112612448A (en) * | 2020-12-16 | 2021-04-06 | 平安普惠企业管理有限公司 | Front-end internationalized multi-page packaging method and device and computer equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110262800A (en) | Multilingual processing method and processing device | |
CN111399853B (en) | Templated deployment method for machine learning model and custom operator | |
US6523171B1 (en) | Enhanced source code translator from procedural programming language (PPL) to an object oriented programming language (OOPL) | |
US20070033520A1 (en) | System and method for web page localization | |
US6219831B1 (en) | Device and method for converting computer programming languages | |
Cheatham Jr | The introduction of definitional facilities into higher level programming languages | |
CN109491658A (en) | The generation method and device of computer-executable code data | |
CN108595171B (en) | Object model generation method, device, equipment and storage medium | |
CN105446725A (en) | Method and system for model driven development | |
CN112416788B (en) | Hierarchical standard Web application UI automatic test method | |
CN114706660B (en) | DAS-based custom function expansion method, device, equipment and storage medium | |
CN113821616A (en) | Domain-adaptive slot filling method, device, equipment and storage medium | |
CN115688690A (en) | Dynamic conversion method for converting Word document content into XML fragment conforming to S1000D standard | |
JP2760682B2 (en) | Hardware design support system | |
CN115169370A (en) | Corpus data enhancement method and device, computer equipment and medium | |
CN113918165A (en) | Method and system for compiling text description type flow description into application automatic operation script | |
CN110554860B (en) | Construction method and code generation method of software project natural language programming interface (NLI) | |
CN108628606B (en) | Method and system for generating WEB network management application program of embedded equipment | |
CN111831288A (en) | Method and system for automatically generating Thrift IDL data structure and automatic transfer function | |
CN116719514B (en) | Automatic RPA code generation method and device based on BERT | |
Cimini | A declarative validator for GSOS languages | |
CN113157257B (en) | Rapid development device for banking system | |
US20240004620A1 (en) | Automated generation of web applications based on wireframe metadata generated from user requirements | |
CN114035726B (en) | Method and system for robot flow automatic page element identification process | |
Bose | Instruction set design for support of high-level languages |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190920 |