CN104899010A - Multilingualization method and system of source code - Google Patents

Multilingualization method and system of source code Download PDF

Info

Publication number
CN104899010A
CN104899010A CN201410076610.XA CN201410076610A CN104899010A CN 104899010 A CN104899010 A CN 104899010A CN 201410076610 A CN201410076610 A CN 201410076610A CN 104899010 A CN104899010 A CN 104899010A
Authority
CN
China
Prior art keywords
text string
language
source code
target language
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
CN201410076610.XA
Other languages
Chinese (zh)
Other versions
CN104899010B (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.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co 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 Beijing Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201410076610.XA priority Critical patent/CN104899010B/en
Publication of CN104899010A publication Critical patent/CN104899010A/en
Application granted granted Critical
Publication of CN104899010B publication Critical patent/CN104899010B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the invention provides a multilingualization method and system of a source code. A programming language type of the source code can be automatically determined, an original language text string in the source code can be automatically extracted according to different programming language types, and a corresponding target language text string is obtained to generate the source code of a target language version. The multilingualization method and system does not need to use an intermediate function, so that data reading efficiency is high, and programming technicians do not need to master the intermediate function. The multilingualization method and system realizes the automation of a multilingualization process and is high in processing speed and low in error rate. After the source code is automatically transformed, according to an error prompt, the programming technicians only need to carry out revision processing on the original language text string which is not successfully replaced, so that multilingualization efficiency is improved. The programming technicians do not need to learn an original monolingual source code, workload is reduced, and a multilingualization work progress is quickened.

Description

The multi-lingual opinion on public affairs method and system of source code
Technical field
The present invention relates to language source code version modify technical field, particularly relate to the multi-lingual opinion on public affairs method and system of source code.
Background technology
Along with intellectuality and the universalness of electronic equipment, the application program on various electronic equipment also gets more and more.Country variant is also got more and more by the situation of carrying out exchanging with a application program (as Facebook) with the people in area.But the language used due to country variant and area is not quite similar, and therefore software business man also needs to provide the application program of multiple different language version for different user.Especially at this state comparative maturity and well-known software, when wishing that carrying out globalization sells, software vendor will be faced with a difficult problem for a multi-lingual opinion on public affairs, or again writes code, or carries out the transformation of multi-lingual opinion on public affairs to original source code.
The existing method of the application program with multiple different language version that provides is as follows:
In source code compiling procedure, when needing to export text string, intermediate function is used to realize multi-language version expansion.This intermediate function needs first to obtain current language type (as Chinese), then obtains corresponding language file (multilingual storehouse) according to current language type, extracts the text string (as Japanese) of coupling to show from language file.
Visible, said method needs programming technique personnel just to write intermediate function to obtain text string and to show when programming, the write of intermediate function reduces the reading efficiency of data, simultaneously just use this intermediate function because needs programming technique personnel grasp intermediate function and often run into text string in programming process, also result in compiling procedure slowly and error rate high.When most software starts to create, might not write according to the long-range demand of multi-lingual opinion on public affairs, therefore when the later stage carries out multi-lingual opinion on public affairs again, programming technique personnel are needed to learn original single language source code, then on original single language source code basis, intermediate function is write, carry out the transformation of multi-lingual opinion on public affairs, this will cause workload to increase, and delay the process that multilingual chemical industry is done.
Summary of the invention
The object of the embodiment of the present invention is the multi-lingual opinion on public affairs method and system providing a kind of source code, to improve the work efficiency of source code being carried out to multi-lingual opinion on public affairs.
For achieving the above object, the embodiment of the invention discloses a kind of multi-lingual opinion on public affairs method of source code, comprising:
Obtain the source language text string in original source code;
Obtain the target language text string corresponding with described source language text string;
Generate corresponding stored and have described source language text string and the language profile of target language text string described at least one;
According to described language profile and described original source code, generate the source code of target language version.
Preferably, also comprise: the application program by the compilation of source code of described target language version being described target language version.
Preferably, the source language text string in described acquisition original source code, comprising:
Determine the text string separator in original source code;
Obtain the source language text string between described text string separator mutually corresponding in described original source code.
Preferably, the described text string separator determined in original source code, comprising:
Obtain the program language type of original source code;
According to described program language type, the text string separator mated is defined as the text string separator in described original source code with described program language type.
Preferably, the program language type of described acquisition original source code, comprising:
Obtain the program language type of the original source code of user's input;
Or, the program language type of original source code is identified, obtains the program language type of described original source code.
Preferably, the target language text string that described acquisition is corresponding with described source language text string, comprising:
Receive user to the first selection instruction of language form;
According to the type of described first selection instruction determination target language;
Described source language text string is translated as the target language text string corresponding with described source language text string, and the language form of described target language text string belongs to the type of described target language.
Preferably, described according to described language profile and described original source code, generate the source code of target language version, comprising:
Receive user to the second selection instruction of determined target language type;
The source code of the target language version corresponding with described second selection instruction is generated according to described language profile and described original source code.
Preferably, the described source code generating the target language version corresponding with described second selection instruction according to described language profile and described original source code, comprising:
According to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in described original source code is replaced with the target language text string corresponding with described second selection instruction, generates the source code with the corresponding target language version of described second selection instruction;
Or, obtain the copy of described original source code, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with the target language text string corresponding with described second selection instruction, generates the source code with the corresponding target language version of described second selection instruction.
Preferably, the described source code generating target language version according to described language profile and described original source code, comprising:
The source code of the target language version corresponding with described first selection instruction is generated according to described language profile and described original source code.
Preferably, the described source code generating the target language version corresponding with described first selection instruction according to described language profile and described original source code, comprising:
According to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generates the source code with the corresponding target language version of described first selection instruction;
Or, obtain the copy of described original source code, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generates the source code with the corresponding target language version of described first selection instruction.
Preferably, the type of the target language determined according to described first selection instruction is n kind, described source language text string is translated to n target language text string of each source language text string corresponding n type target language in the language profile of rear generation, user is m kind by the type of the target language selected by described second selection instruction, m and n is positive integer, and n >=m, the copy of the described original source code of described acquisition, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with the target language text string corresponding with described second selection instruction, generate the source code with the corresponding target language version of described second selection instruction, comprise:
Obtain m copy of described original source code;
According to the corresponding relation of language text string original in described language profile with at least one target language text string, respectively the source language text string in the m of a described original source code copy is replaced with the target language text string of a kind of target language corresponding with described second selection instruction, generate the source code of m the target language version corresponding with described second selection instruction.
Preferably, the type of the target language determined according to described first selection instruction is n kind, described source language text string is translated to n target language text string of each source language text string corresponding n type target language in the language profile of rear generation, n is positive integer, the copy of the described original source code of described acquisition, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generate the source code with the corresponding target language version of described first selection instruction, comprise:
Obtain n copy of described original source code;
According to the corresponding relation of language text string original in described language profile with at least one target language text string, respectively the source language text string in the n of a described original source code copy is replaced with the target language text string of a kind of target language corresponding with described source language text string in described language profile, generate the source code of n the target language version corresponding with described first selection instruction.
Preferably, according to described language profile and described original source code, after generating the source code of target language version, also comprise:
Judge whether there is described source language text string in the source code of described target language version, if existed, then export information to point out user.
Preferably, described output information, to point out user, comprising:
Obtain in the source code of described target language version the positional information of the described source language text string existed;
Described positional information is exported to user.
A multi-lingual opinion on public affairs system for source code, comprising: source language text string obtains unit, target language text string obtains unit, file generating unit and target language code generating unit,
Described source language text string obtains unit, for obtaining the source language text string in original source code;
Described target language text string obtains unit, for obtaining the target language text string corresponding with described source language text string;
Described file generating unit, has described source language text string and the language profile of target language text string described at least one for generating corresponding stored;
Described target language code generating unit, for generating the source code of target language version according to described language profile and described original source code.
Preferably, also comprise: compiling of application unit, for by the compilation of source code of described target language version being the application program of described target language version.
Preferably, described source language text string obtains unit, comprising: separator determination subelement and text string obtain subelement,
Described separator determination subelement, for determining the text string separator in original source code;
Described text string obtains subelement, for obtaining the source language text string between described text string separator mutually corresponding in described original source code.
Preferably, described separator determination subelement, comprising: language form obtains subelement and separator subelement,
Described language form obtains subelement, for obtaining the program language type of original source code;
Described separator subelement, for according to described program language type, is defined as the text string separator in described original source code by the text string separator mated with described program language type.
Preferably, described language form obtains subelement, comprising: user inputs subelement or recognin unit,
Described user inputs subelement, for obtaining the program language type of the original source code of user's input;
Described recognin unit, for identifying the program language type of original source code, obtains the program language type of described original source code.
Preferably, described target language text string obtains unit, comprising: the first command reception subelement, target language determination subelement and translation subelement;
Described first command reception subelement, for receiving first selection instruction of user to language form;
Described target language determination subelement, for the type according to described first selection instruction determination target language;
Described translation subelement, for described source language text string is translated as the target language text string corresponding with described source language text string, the language form of described target language text string belongs to the type of described target language.
Preferably, described target language code generating unit, comprising: the second command reception subelement and first code generate subelement;
Described second command reception subelement, for receiving second selection instruction of user to determined target language type;
Described first code generates subelement, for generating the source code of the target language version corresponding with described second selection instruction according to described language profile and described original source code.
Preferably, described first code generates subelement, comprising: first code replaces subelement or subelement replaced by the first authentic copy,
Described first code replaces subelement, for the corresponding relation according to language text string original in described language profile and at least one target language text string, source language text string in described original source code is replaced with the target language text string corresponding with described second selection instruction, generates the source code with the corresponding target language version of described second selection instruction;
Subelement replaced by the described first authentic copy, for obtaining the copy of described original source code, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with the target language text string corresponding with described second selection instruction, generates the source code with the corresponding target language version of described second selection instruction.
Preferably, described target language code generating unit, for generating the source code of the target language version corresponding with described first selection instruction according to described language profile and described original source code.
Preferably, described target language code generating unit, comprising: second code replaces subelement or triplicate replaces subelement,
Described second code replaces subelement, for the corresponding relation according to language text string original in described language profile and at least one target language text string, source language text string in described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generates the source code with the corresponding target language version of described first selection instruction;
Described triplicate replaces subelement, for obtaining the copy of described original source code, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generates the source code with the corresponding target language version of described first selection instruction.
Preferably, the type of the target language determined according to described first selection instruction is n kind, described source language text string is translated to n target language text string of each source language text string corresponding n type target language in the language profile of rear generation, user is m kind by the type of the target language selected by described second selection instruction, m and n is positive integer, and n >=m, subelement replaced by the described first authentic copy, comprise: the first authentic copy obtains module and first authentic copy replacement module
The described first authentic copy obtains module, for obtaining m copy of described original source code;
Described first authentic copy replacement module, for the corresponding relation according to language text string original in described language profile and at least one target language text string, respectively the source language text string in the m of a described original source code copy is replaced with the target language text string of a kind of target language corresponding with described second selection instruction, generate the source code of m the target language version corresponding with described second selection instruction.
Preferably, the type of the target language determined according to described first selection instruction is n kind, described source language text string is translated to n target language text string of each source language text string corresponding n type target language in the language profile of rear generation, n is positive integer, described triplicate replaces subelement, comprise: triplicate obtains module and triplicate replacement module
Described triplicate obtains module, for obtaining n copy of described original source code;
Described triplicate replacement module, for the corresponding relation according to language text string original in described language profile and at least one target language text string, respectively the source language text string in the n of a described original source code copy is replaced with the target language text string of a kind of target language corresponding with described source language text string in described language profile, generate the source code of n the target language version corresponding with described first selection instruction.
Preferably, also comprise: judging unit and Tip element,
Described judging unit, for at described target language code generating unit according to described language profile and described original source code, after generating the source code of target language version, judge whether there is described source language text string in the source code of described target language version, if so, then described Tip element is triggered;
Described Tip element, for exporting information to point out user.
Preferably, described Tip element, comprising: position obtains unit and position output unit,
Described position obtains unit, for obtaining the positional information of the described source language text string existed in the source code of described target language version;
Described position output unit, for exporting to user by described positional information.
A kind of plug-in unit, described plug-in unit can by the first application call, and described plug-in unit comprises: source language text string obtains unit, target language text string obtains unit, file generating unit and target language code generating unit,
Described source language text string obtains unit, for obtaining the source language text string in original source code;
Described target language text string obtains unit, for obtaining the target language text string corresponding with described source language text string;
Described file generating unit, has described source language text string and the language profile of target language text string described at least one for generating corresponding stored;
Described target language code generating unit, for generating the source code of target language version according to described language profile and described original source code.
Preferably, described first application program is Program Appliance program or compiling application program.
The multi-lingual opinion on public affairs method and system of the source code that the embodiment of the present invention provides, can the programming language type of automatic decision source code, also obtain corresponding target language text string according to the source language text string in the automatic extraction source code of different programming language types, be generated as the source code of target language version.The present invention does not need to use intermediate function, and therefore the reading efficiency of data is higher, does not also need programming technique personnel to grasp intermediate function.Present invention achieves the robotization of the process of multi-lingual opinion on public affairs, processing speed is very fast, and error rate is low.After automatic transformation completes, according to miscue, programming technique personnel only need to make an amendment the source language text string of unsuccessful replacement to process, and improve the efficiency of multi-lingual opinion on public affairs.The present invention also makes programming technique personnel not need to learn original single language source code, and less workload, accelerates the process of the work of multi-lingual opinion on public affairs.
Certainly, arbitrary product of the present invention is implemented or method might not need to reach above-described all advantages simultaneously.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
The process flow diagram of the multi-lingual opinion on public affairs method of a kind of source code that Fig. 1 provides for the embodiment of the present invention;
The process flow diagram of the multi-lingual opinion on public affairs method of the another kind of source code that Fig. 2 provides for the embodiment of the present invention;
The process flow diagram of the multi-lingual opinion on public affairs method of the another kind of source code that Fig. 3 provides for the embodiment of the present invention;
The process flow diagram of the multi-lingual opinion on public affairs method of the another kind of source code that Fig. 4 provides for the embodiment of the present invention;
The process flow diagram of the multi-lingual opinion on public affairs method of the another kind of source code that Fig. 5 provides for the embodiment of the present invention;
The process flow diagram of the multi-lingual opinion on public affairs method of the another kind of source code that Fig. 6 provides for the embodiment of the present invention;
The process flow diagram of the multi-lingual opinion on public affairs method of the another kind of source code that Fig. 7 provides for the embodiment of the present invention;
The process flow diagram of the multi-lingual opinion on public affairs method of the another kind of source code that Fig. 8 provides for the embodiment of the present invention;
The process flow diagram of the multi-lingual opinion on public affairs method of the another kind of source code that Fig. 9 provides for the embodiment of the present invention;
The process flow diagram of the multi-lingual opinion on public affairs method of the another kind of source code that Figure 10 provides for the embodiment of the present invention;
The process flow diagram of the multi-lingual opinion on public affairs method of the another kind of source code that Figure 11 provides for the embodiment of the present invention;
The process flow diagram of the multi-lingual opinion on public affairs method of the another kind of source code that Figure 12 provides for the embodiment of the present invention;
The structural representation of the multi-lingual opinion on public affairs system of a kind of source code that Figure 13 provides for the embodiment of the present invention;
The structural representation of the multi-lingual opinion on public affairs system of the another kind of source code that Figure 14 provides for the embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
First vocabulary used in the present invention is described: present invention uses source language, target language, these three vocabulary of program language, wherein source language and target language all refer to natural language, as Chinese, English etc.; Program language is computerese, as C language, also claims programming language.
As shown in Figure 1, the multi-lingual opinion on public affairs method of a kind of source code that the embodiment of the present invention provides, can comprise:
S100, the source language text string obtained in original source code;
Wherein, source code is the text according to certain programming language specification writing do not compiled.Source code (also claiming source program) is the readable computerese instruction of series of human.In modern procedures language, source code can be occur with the form of books or tape, but form the most conventional is text, and the object of this typical format is to compile out computer program.Can be the binary command that computing machine can perform by compilation of source code by compiler.
Optionally, source language version can be Chinese version.Draw after analyzing various programming language, application program and user interactions be shown gives the text string of user (as the text in notifying, text etc. in menu) in source code, usually be comprised in specific text string separator, as " ", <>, (), ' ', { }, <%%>, (" ") etc.Wherein, the text string separator that different program language types is mated is not quite similar.Program language type can have multiple, as C language, JAVA, JavaScript, PHP etc.For example, the single quotation marks in JavaScript is text string separator, and in C language single quotation marks not as text string separator.
The information being shown to user in software interface needs the process carrying out multi-lingual opinion on public affairs, read to facilitate the user grasping different language, due to the source code that different programming languages is write out, different text string separators can be adopted to be shown in marker software interface the information of user, therefore need first to determine in original source code, which text needs to carry out the process of multi-lingual opinion on public affairs.
Wherein, how to obtain source language text string, as shown in Figure 2, S100 can comprise S110 and S120:
S110, the text string separator determined in original source code;
Wherein, S110 can comprise:
Obtain the program language type of original source code;
According to described program language type, the text string separator mated is defined as the text string separator in described original source code with described program language type.
Wherein, obtain the program language type of original source code, can comprise:
Obtain the program language type of the original source code of user's input;
Or, the program language type of original source code is identified, obtains the program language type of described original source code.
Concrete, the key word, statement, operational symbol etc. that occur in original source code can be obtained, according to one of the key word, statement, operational symbol of first trip, judge which kind of programming language source code adopts write, as unique a kind of programming language can not be judged, then obtain one of the key word, statement, operational symbol of original source code next line, judge, until the programming language of source code can be determined.After obtaining programming language type, the type according to this programming language obtains all text string separators being applicable to this programming language type.Certainly, also can by user's direct input routine language form.
The invention provides a kind of plug-in unit or system, the display interface of this plug-in unit or system with user loading routine language form, can save the time of determining program language form like this, determines that original source code is which kind of programming language is write by user.Concrete, the option of each program language type can be provided on display interface to select for user, after reception user is to the selection instruction of program language type, just according to the program language type preset and the matching relationship of text string separator, the text string separator matched can be determined.
S120, to obtain in described original source code source language text string between mutually corresponding described text string separator.
Concrete, in original source code, search text string separator one by one, after finding a text string separator, the text string between text string decollator is extracted, namely obtains source language text string.
S200, obtain the target language text string corresponding with described source language text string;
S300, generation corresponding stored have the language profile of described source language text string and target language text string described at least one;
In actual applications, only can generate the language profile that stores all source language text strings and all target language text strings, also can generate multiple language profile, in each language profile, store the target language text string of part source language text string and correspondence.Certainly, in language profile in other embodiments of the present invention, all source language text strings and partial target language text string also can be stored.
Concrete, can according to source language text string and target language text string relation one to one, production language configuration file, preserves source language text string and target language text string one to one in this language profile.
In actual applications, can first generate the language profile storing source language text string, after obtaining the target language text string corresponding with described source language text string, set up the corresponding relation of source language text string and target language text string, then by target language text string corresponding stored in described language profile.Wherein, language profile is only that the present invention is to the one name of corresponding source language text string and target language text string being preserved the file of rear generation, in other embodiments of the present invention, other can also be had to name, as the text string table of comparisons, translation storehouse etc.
Wherein, target language text string translates rear acquisition to source language text string, and preferably, source language text string can be translated as target language text string by the present invention automatically.Concrete, first user can select language, thus determines target language, and the target language that user selects can comprise multiple, as English, Japanese, Korean, Malaysian language etc.
Concrete, in language profile, original language text string and target language text string can use forms mode to store, and Hash table also can be used to store, and JSON grammer also can be used to store.
The open a kind of Hash table that uses stores source language text string " hello " and the target language text string " hello " of correspondence thereof, the citing of " こ ん To Chi は " below, as follows:
In above-mentioned citing, separator is " ", and target language comprises: Americanese and Japanese.
Wherein, as shown in Figure 3, in another embodiment of the invention, S300 can comprise:
S310, reception user are to the first selection instruction of language form;
Concrete, the present invention provides the function of input language type for user, is intended adopting which kind of language form to present to user by the software after user specifies original source code to compile.
S320, type according to described first selection instruction determination target language;
Concrete, after reception user selects the instruction of language form, can determine that the software that target source code programming becomes is intended adopting which kind of language form to present to user according to this instruction, the first selection instruction such as receiving user is that software interface adopts Japanese to present, then target language is marked as Japanese.
S330, described source language text string is translated as the target language text string corresponding with described source language text string, the language form of described target language text string belongs to the type of described target language.
Concrete, source language text string is translated as the target language text string of target language type, such as, the source language text string in source code is translated as the target language text string of Japanese.
The user of making embodiment illustrated in fig. 3 selects the type of the target language that will be translated as, thus determines text string source language text string being translated as which kind of language.User only can select current language form of carrying out required for multi-lingual opinion on public affairs to source code, also can select more language form.Such as: user needs the source code source code of Chinese version being revised as English edition, so first selection instruction of user can only select English to translate, and so just only can generate the source code of english language version; Certainly, first selection instruction of user also can select English and Japanese to translate simultaneously, when generating the source code of target language version, only can generate the source code of english language version, also can generate the source code of english language version and japanese version simultaneously.Although application program progressively enters country variant, the language version that technician can select the country likely entered to use in advance is translated, and obtains the text string of this language version stored in language profile.Like this follow-up need to enter this country time, just directly can be generated the source code of corresponding language version by language profile, translation be shifted to an earlier date, improves the formation speed of the source code of target language version.
S400, according to described language profile and described original source code, generate the source code of target language version.
Concrete, according to the corresponding relation of language text string original in language profile with at least one target language text string, search the source language text string in original source code or original source code copy, and according to the corresponding entry in language profile, source language text is replaced with target language text, the source code of the target language version generated subsequently, can be compiled as the application program of target language version.
Concrete, on basis embodiment illustrated in fig. 3, S400 can be any one in the following two kinds mode:
Mode one:
As shown in Figure 4, S400 can comprise:
S410, reception user are to the second selection instruction of determined target language type;
S420, generate the source code of the target language version corresponding with described second selection instruction according to described language profile and described original source code.
In embodiment illustrated in fig. 4, user can select the target language version of the source code that will generate further, such as: the language form of the target language text string mated with source language text string in language profile has three kinds, be respectively English, Japanese and Korean, then user selects these three kinds of target languages, thus determine that the source code of target language version is planted in generation which kind of or which, such as user selects English and Japanese, then S420 generates the source code of English edition and the source code of Japanese version.Certainly, user also can select a kind of target language by means of only the second selection instruction, thus only generates a kind of source code of target language version.
In other embodiments of the present invention, the generation of the generation of language profile and the source code of target language version can be completed by identical or different technician, such as carried out the work of production language configuration file by Zhang, the language profile obtained after being worked according to Zhang by Lee carries out the work of the source code generating target language version.
Certainly, in other embodiments of the present invention, the generation of language profile and the generation of the source code of target language version also can complete within identical time period or different time periods, such as the first half of the year production language configuration file, the second half year generates the source code of target language version according to generated language profile.
Certainly, also above-mentioned two situations can be carried out any combination, such as: certain company will internationalize to certain Chinese software, but uncertain due to the entry time in the market of country variant, the language therefore will translated is also uncertain.Worker's first is responsible for the generation of language profile, the language of the country that he may enter according to company, and translation generates the language profile of the text string containing English, Japan and Korea S., method, these five kinds of language of moral.After half a year, the said firm rate will be introduced into Japanese market, so worker's second is according to the language profile generated before, selects Japanese as the language version of the source code that will generate, the source code of this application program is revised as the source code of japanese version.
Wherein, as shown in Figure 5, S420 can comprise: S421, corresponding relation according to language text string original in described language profile and at least one target language text string, source language text string in described original source code is replaced with the target language text string corresponding with described second selection instruction, generates the source code with the corresponding target language version of described second selection instruction;
Or, as shown in Figure 6, S420 can comprise: S422, obtain the copy of described original source code, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced the target language text string corresponding with described second selection instruction, generates the source code with the corresponding target language version of described second selection instruction.
Because S421 directly carries out text string replacement in original source code, be therefore more suitable for the source code only original source code being converted into a kind of target language version.And S422 carries out text string replacement on the copy of original source code, during replacement, amendment can not being caused to original source code, therefore when original source code being converted into another kind of target language version source code, can continue to use original source code.Visible, S422 is more suitable for the source code a kind of original source code being converted into plurality of target language version.Certainly, the application of the present invention to above two kinds of modes does not limit, S421 also goes for the source code a kind of original source code being converted into plurality of target language version, and S422 also goes for the source code only original source code being converted into a kind of target language version.
Mode two, as shown in Figure 7, S400 can comprise: S430, generate the source code of the target language version corresponding with described first selection instruction according to described language profile and described original source code.
Mode two, for mode one, does not need user again to select target language, can the direct source code of each target language version in production language configuration file, more efficient and convenient.Such as: the language form of the target language text string mated with source language text string in language profile has three kinds, be respectively English, Japanese and Korean, then S330 generates the source code of the source code of English edition, the source code of Japanese version and Korean version.
Wherein, as shown in Figure 8, S430 can comprise: S431, corresponding relation according to language text string original in described language profile and at least one target language text string, source language text string in described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generates the source code with the corresponding target language version of described first selection instruction;
Or, as shown in Figure 9, S430 can comprise: S432, obtain the copy of described original source code, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generates the source code with the corresponding target language version of described first selection instruction.
The difference of S431 and S432 and the difference of S421 and S422 similar, repeat no more.
For mode one, when generating the source code of plurality of target language version, generation can be taken up in order of priority one by one: each copy obtaining an original source code, then this copy is revised as the source code of one of them target language, and then obtain a copy, continue the source code generating other target languages; Also can generate simultaneously, first obtain the copy of the source code of multiple source language, then each copy is revised as respectively the source code of a target language version.
Therefore, when the target language determined according to described first selection instruction can be n, described source language text string is translated to n target language text string of each source language text string corresponding n kind target language in the language profile of rear generation, user is m by the target language selected by described second selection instruction, m and n is positive integer, and during n >=m, S422 can comprise:
Obtain m copy of described original source code;
According to the corresponding relation of language text string original in described language profile with at least one target language text string, respectively the source language text string in the m of a described original source code copy is replaced with the target language text string of a kind of target language corresponding with described second selection instruction, generate the source code of m the target language version corresponding with described second selection instruction.
Equally, for mode two, when the target language determined according to described first selection instruction is n, described source language text string is translated to n target language text string of each source language text string corresponding n kind target language in the language profile of rear generation, when n is positive integer, S432 can comprise:
Obtain n copy of described original source code;
According to the corresponding relation of language text string original in described language profile with at least one target language text string, respectively the source language text string in the n of a described original source code copy is replaced with the target language text string of a kind of target language corresponding with described source language text string in described language profile, generate the source code of n the target language version corresponding with described first selection instruction.
In mode one and mode two, when carrying out text string and replacing, the copy of original source code and original source code can be traveled through, if traverse the source language text string in language profile, then replaced with corresponding target language text string.Certainly, also can have other replacement methods and replacement order, the present invention does not limit.
The multi-lingual opinion on public affairs method of a kind of source code that the embodiment of the present invention provides, can the programming language type of automatic decision source code, also obtain corresponding target language text string according to the source language text string in the automatic extraction source code of different programming language types, be generated as the source code of target language version.The present invention does not need to use intermediate function, and therefore the reading efficiency of data is higher, does not also need programming technique personnel to grasp intermediate function.Present invention achieves the robotization of the process of multi-lingual opinion on public affairs, processing speed is very fast, and error rate is low.After automatic transformation completes, according to miscue, programming technique personnel only need to make an amendment the source language text string of unsuccessful replacement to process, and improve the efficiency of multi-lingual opinion on public affairs.The present invention also makes programming technique personnel not need to learn original single language source code, and less workload, accelerates the process of the work of multi-lingual opinion on public affairs.
As shown in Figure 10, in the multi-lingual opinion on public affairs method of the another kind of source code that the embodiment of the present invention provides, can also comprise:
S500, be the application program of described target language version by the compilation of source code of described target language version.
After the source code obtaining target language version, if there is not the situation of reporting an error, subsequently by the application program that the compilation of source code of target language is target language version, or can be compiled it as the application program of target language version by compiler etc., to carry out issue for user.
As shown in figure 11, on basis embodiment illustrated in fig. 1, the multi-lingual opinion on public affairs method of the another kind of source code that the embodiment of the present invention provides, after S400, can also comprise:
S440, judge described target language version source code in whether there is described source language text string, if existed, then perform S450, otherwise can not carry out processing or performing S500 as shown in figure 11;
S450, output information are to point out user.
Due to technician's possibility also non-fully specification when writing source code, therefore when S100 extracts the source language text string in original source code, possibly cannot extract whole source language text strings, as: splicing character string does not use String.format (), character not to use html entity etc.
Such as, the ways of writing led to errors is:
$ (' body') .html (' hello for <b> Li Lei </b>, today is: <b> </b>' on Wednesday)
Var string='<a> owns '+_ map [type]+' </a>'
Var msg=' successfully moves <span class=" success-file-number " >'+len_ok+'</spanGreatT.GreaT .GT file for you, failed <span class=" fail-file-number " >'+len_fail+'</spanGreatT.Gre aT.GT file '
Correct a kind of ways of writing is:
$ (' body') .html (' { hello for 0}, today is: 1}'.format (' <b> Li Lei </b>', ' <b> </b>' on Wednesday))
Var string='<a>{0}'+_map [type]+' </a>'.format (' all ')
Var msg=' is successfully for you move { 0} file, failure 1} file ' .format (' <span class=" success-file-number " >'+len_ok+'</spanGreatT.GreaT .GT', ' <span class=" fail-file-number " >'+len_fail+'</spanGreatT.Gre aT.GT')
In this case, source language text string will also be left in the source code of the target language version of generation.Embodiment illustrated in fig. 2 when judgement know still leave source language text string time, can point out user this information, whether inquiry user processes, and avoids owing to extracting the infull problem of the language version " translation " that not exclusively causes.Concrete, when pointing out user profile, the position that there is described source language text string in the source code of target language version can be marked, record line number and columns, and the position of pointing out user to mark may have problems, and record more detailed logging (as i18n.unmatched.md) and point out developer.These informations by screen display to user.
How to judge whether to leave source language text string, concrete, when the word of source language is the non-ISO8859-1 characters such as Chinese, Japan, Korean, can determine whether that translation is complete by the detection of non-ISO8859-1 character in the source code to the target language version generated, be such as the source code of Chinese version for source language, if untranslated complete, then may leave untranslated Chinese, now just can find it by the detection of non-ISO8859-1 character, and the position of recording its place is to point out user.SO8859-1, also known as Latin-1 or " Western-European languages ", is first 8 character set of ISO/IEC8859 in ISO (International Standards Organization).It is based on ASCII, in the scope of vacant 0xA0-0xFF, adds 96 letters and symbol, uses the Latin alphabet language use for cedilla.
As shown in figure 12, on basis embodiment illustrated in fig. 11, in the multi-lingual opinion on public affairs method of the another kind of source code that the embodiment of the present invention provides, S450 can comprise:
S451, obtain the positional information of the described source language text string existed in the source code of described target language version;
S452, described positional information is exported to user.
The source code possibility of writing due to programming technique personnel is also lack of standardization, the text string separator that programming technique personnel therefore can be caused to use and the present invention's determined text string separator are also not quite identical, text string in inconsistent text string separator cannot be translated and replace, and then cause the text string of residual source language.Therefore, the information that the nonstandard information of source code and proposed amendments are specification source code can be included in information.Further, the example of specification source code can also be included in information, with programming by prompting technician simultaneously.
By the output of positional information, the present invention can help programming technique personnel quick position to leave the position of source language text string, thus is modified by programming technique personnel.In other embodiments of the present invention, can also set up according to positional information the jump instruction jumping to this position, and on display interface, provide button etc. to trigger this jump instruction for user's click, thus directly jump to this position, user is no longer needed manually to search, more convenient.
The embodiment of the multi-lingual opinion on public affairs method of a kind of source code of the present invention is provided below:
Step 1: extract the non-ISO8859-1 character in original source code;
Concrete, also can according to demand, other encoding schemes beyond assigned I SO8859-1 coding.Illustrate with the most frequently used ISO8859-1 below.
Citing one, the non-ISO8859-1 character that extracts comprise: " operation failure please tries after a while again " and " making great efforts into your deletion { 0} file ".
Be understandable that, in the source code of the application program of Chinese version, the source language text string in text string separator is non-ISO8859-1 character.
As there is several continuous non-ISO08859-1 character, can merger being a string text string, carrying out translating, replacing as a word or sentence when translating.
Step 2: receive user to the selection instruction of target language, generate the language profile including source language text string;
Above-mentioned citing one is still used to be described: the target language that user selects is Americanese and Japanese, then can generate the configuration file comprising following content:
Above-mentioned language profile can called after i18n.lang.js.
Step 3: obtain the target language text string corresponding with described source language text string, by target language text string language corresponding stored in language profile.
Concrete, automatically or manually the source language text string in source language text string can be translated as target language text string.
Still one to be described to illustrate, the source language text string in language profile i18n.lang.js to be translated as Americanese and Japanese, and to be stored in language profile.Content in language profile is:
Concrete, the extraction of source language text string can be carried out to the source code of multiple application program respectively and obtain corresponding target language text string, by the target language text string of the source language text string of multiple application program and correspondence all stored in a language profile, like this, text string in this language profile just more horn of plenty, certain application program is being carried out in multi-lingual opinion on public affairs process, owing to storing the target language text string that in this source code, part or all of source language text string is corresponding in this language profile, therefore can translate the source language text string stored in language profile again, target language text string corresponding in direct acquisition language profile.When running into non-existent source language text string in this language profile, the target language text of this source language text string and correspondence can be continued to serially add in this language profile.After multi-lingual opinion on public affairs process after a while, above-mentioned language profile can no longer carry out text string renewal as final complete packet file, in this case, can revise the title of this language profile.
Step 4: the copy obtaining described original source code, replaces with corresponding target language text string by the source language text string in the copy of described original source code, generate the source code of target language version;
Step 5: the application program source code of described target language version being configured to described target language version.
Corresponding with said method embodiment, as shown in figure 13, present invention also offers a kind of multi-lingual opinion on public affairs system of source code, comprising: source language text string obtains unit 100, target language text string obtains unit 200, file generating unit 300 and target language code generating unit 400
Described source language text string obtains unit 100, for obtaining the source language text string in original source code;
Wherein, source language text string obtains unit 100, can comprise: separator determination subelement and text string obtain subelement,
Described separator determination subelement, for determining the text string separator in original source code;
Described text string obtains subelement, for obtaining the source language text string between described text string separator mutually corresponding in described original source code.Wherein, described separator determination subelement, can comprise: language form obtains subelement and separator subelement,
Described language form obtains subelement, for obtaining the program language type of original source code;
Described separator subelement, for according to described program language type, is defined as the text string separator in described original source code by the text string separator mated with described program language type.
Wherein, language form obtains subelement, can comprise: user inputs subelement or recognin unit,
Described user inputs subelement, for obtaining the program language type of the original source code of user's input;
Described recognin unit, for identifying the program language type of original source code, obtains the program language type of described original source code.
Described target language text string obtains unit 200, for obtaining the target language text string corresponding with described source language text string;
File generating unit 300, has described source language text string and the language profile of target language text string described at least one for generating corresponding stored;
Wherein, target language text string obtains unit 200, can comprise: the first command reception subelement, target language determination subelement and translation subelement;
Described first command reception subelement, for receiving first selection instruction of user to language form;
Described target language determination subelement, for the type according to described first selection instruction determination target language;
Described translation subelement, for described source language text string is translated as the target language text string corresponding with described source language text string, the language form of described target language text string belongs to the type of described target language.
Described target language code generating unit 400, for generating the source code of target language version according to described language profile and described original source code.
Wherein, described target language code generating unit 400, can have two kinds of specific embodiments:
Scheme one, target language code generating unit 400 comprise: the second command reception subelement and first code generate subelement;
Described second command reception subelement, for receiving second selection instruction of user to determined target language type;
Described first code generates subelement, for generating the source code of the target language version corresponding with described second selection instruction according to described language profile and described original source code.
Wherein, described first code generates subelement, can comprise: first code replaces subelement or subelement replaced by the first authentic copy,
Described first code replaces subelement, for the corresponding relation according to language text string original in described language profile and at least one target language text string, source language text string in described original source code is replaced with the target language text string corresponding with described second selection instruction, generates the source code with the corresponding target language version of described second selection instruction;
Subelement replaced by the described first authentic copy, for obtaining the copy of described original source code, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with the target language text string corresponding with described second selection instruction, generates the source code with the corresponding target language version of described second selection instruction.
Scheme two, target language code generating unit 400, may be used for: the source code generating the target language version corresponding with described first selection instruction according to described language profile and described original source code.
In scheme two, target language code generating unit 400, can comprise: second code replaces subelement or triplicate replaces subelement,
Described second code replaces subelement, for the corresponding relation according to language text string original in described language profile and at least one target language text string, source language text string in described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generates the source code with the corresponding target language version of described first selection instruction;
Described triplicate replaces subelement, for obtaining the copy of described original source code, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generates the source code with the corresponding target language version of described first selection instruction.
For scheme one, when the type of the target language determined according to described first selection instruction is n kind, described source language text string is translated to n target language text string of each source language text string corresponding n type target language in the language profile of rear generation, user is m kind by the type of the target language selected by described second selection instruction, m and n is positive integer, and during n >=m, subelement replaced by the described first authentic copy, can comprise: the first authentic copy obtains module and first authentic copy replacement module
The described first authentic copy obtains module, for obtaining m copy of described original source code;
Described first authentic copy replacement module, for the corresponding relation according to language text string original in described language profile and at least one target language text string, respectively the source language text string in the m of a described original source code copy is replaced with the target language text string of a kind of target language corresponding with described second selection instruction, generate the source code of m the target language version corresponding with described second selection instruction.
For scheme two, when the type of the target language determined according to described first selection instruction is n kind, described source language text string is translated to n target language text string of each source language text string corresponding n type target language in the language profile of rear generation, when n is positive integer, described triplicate replaces subelement, can comprise: triplicate obtains module and triplicate replacement module
Described triplicate obtains module, for obtaining n copy of described original source code;
Described triplicate replacement module, for the corresponding relation according to language text string original in described language profile and at least one target language text string, respectively the source language text string in the n of a described original source code copy is replaced with the target language text string of a kind of target language corresponding with described source language text string in described language profile, generate the source code of n the target language version corresponding with described first selection instruction.
The multi-lingual opinion on public affairs system of a kind of source code that the embodiment of the present invention provides, can the programming language type of automatic decision source code, also obtain corresponding target language text string according to the source language text string in the automatic extraction source code of different programming language types, be generated as the source code of target language version.The present invention does not need to use intermediate function, and therefore the reading efficiency of data is higher, does not also need programming technique personnel to grasp intermediate function.Present invention achieves the robotization of the process of multi-lingual opinion on public affairs, processing speed is very fast, and error rate is low.After automatic transformation completes, according to miscue, programming technique personnel only need to make an amendment the source language text string of unsuccessful replacement to process, and improve the efficiency of multi-lingual opinion on public affairs.The present invention also makes programming technique personnel not need to learn original single language source code, and less workload, accelerates the process of the work of multi-lingual opinion on public affairs.
The multi-lingual opinion on public affairs system of the another kind of source code that the embodiment of the present invention provides, as shown in figure 14, can also comprise: compiling of application unit 500, for by the compilation of source code of described target language version being the application program of described target language version.After the source code obtaining target language version, just can be compiled it as the application program of target language version by compiler etc., to carry out issue for user.
The multi-lingual opinion on public affairs system of the another kind of source code that the embodiment of the present invention provides, can also comprise: judging unit and Tip element,
Described judging unit, for at described target language code generating unit according to described language profile and described original source code, after generating the source code of target language version, judge whether there is described source language text string in the source code of described target language version, if so, then described Tip element is triggered;
Described Tip element, for exporting information to point out user.
Preferably, described Tip element can comprise: position obtains unit and position output unit,
Described position obtains unit, for obtaining the positional information of the described source language text string existed in the source code of described target language version;
Described position output unit, for exporting to user by described positional information.
Wherein, include in described information: the nonstandard information of source code and proposed amendments are the information of specification source code.
Present invention also offers a kind of plug-in unit, this plug-in unit can by the first application call, and this plug-in unit can comprise: source language text string obtains unit, target language text string obtains unit, file generating unit and target language code generating unit,
Described source language text string obtains unit, for obtaining the source language text string in original source code;
Described target language text string obtains unit, for obtaining the target language text string corresponding with described source language text string;
Described file generating unit, has described source language text string and the language profile of target language text string described at least one for generating corresponding stored;
Described target language code generating unit, for generating the source code of target language version according to described language profile and described original source code.
Wherein, described first application program is Program Appliance program or compiling application program.
It should be noted that, in this article, the such as relational terms of first and second grades and so on is only used for an entity or operation to separate with another entity or operational zone, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment comprising described key element and also there is other identical element.
Each embodiment in this instructions all adopts relevant mode to describe, between each embodiment identical similar part mutually see, what each embodiment stressed is the difference with other embodiments.Especially, for system embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
The foregoing is only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention.All any amendments done within the spirit and principles in the present invention, equivalent replacement, improvement etc., be all included in protection scope of the present invention.

Claims (30)

1. a multi-lingual opinion on public affairs method for source code, is characterized in that, comprising:
Obtain the source language text string in original source code;
Obtain the target language text string corresponding with described source language text string;
Generate corresponding stored and have described source language text string and the language profile of target language text string described at least one;
According to described language profile and described original source code, generate the source code of target language version.
2. method according to claim 1, is characterized in that, also comprises: the application program by the compilation of source code of described target language version being described target language version.
3. method according to claim 1 and 2, is characterized in that, the source language text string in described acquisition original source code, comprising:
Determine the text string separator in original source code;
Obtain the source language text string between described text string separator mutually corresponding in described original source code.
4. method according to claim 3, is characterized in that, the described text string separator determined in original source code, comprising:
Obtain the program language type of original source code;
According to described program language type, the text string separator mated is defined as the text string separator in described original source code with described program language type.
5. method according to claim 4, is characterized in that, the program language type of described acquisition original source code, comprising:
Obtain the program language type of the original source code of user's input;
Or, the program language type of original source code is identified, obtains the program language type of described original source code.
6. method according to claim 1, is characterized in that, the target language text string that described acquisition is corresponding with described source language text string, comprising:
Receive user to the first selection instruction of language form;
According to the type of described first selection instruction determination target language;
Described source language text string is translated as the target language text string corresponding with described source language text string, and the language form of described target language text string belongs to the type of described target language.
7. method according to claim 6, is characterized in that, described according to described language profile and described original source code, generates the source code of target language version, comprising:
Receive user to the second selection instruction of determined target language type;
The source code of the target language version corresponding with described second selection instruction is generated according to described language profile and described original source code.
8. method according to claim 7, is characterized in that, the described source code generating the target language version corresponding with described second selection instruction according to described language profile and described original source code, comprising:
According to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in described original source code is replaced with the target language text string corresponding with described second selection instruction, generates the source code with the corresponding target language version of described second selection instruction;
Or, obtain the copy of described original source code, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with the target language text string corresponding with described second selection instruction, generates the source code with the corresponding target language version of described second selection instruction.
9. method according to claim 6, is characterized in that, the described source code generating target language version according to described language profile and described original source code, comprising:
The source code of the target language version corresponding with described first selection instruction is generated according to described language profile and described original source code.
10. method according to claim 9, is characterized in that, the described source code generating the target language version corresponding with described first selection instruction according to described language profile and described original source code, comprising:
According to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generates the source code with the corresponding target language version of described first selection instruction;
Or, obtain the copy of described original source code, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generates the source code with the corresponding target language version of described first selection instruction.
11. methods according to claim 8, it is characterized in that, the type of the target language determined according to described first selection instruction is n kind, described source language text string is translated to n target language text string of each source language text string corresponding n type target language in the language profile of rear generation, user is m kind by the type of the target language selected by described second selection instruction, m and n is positive integer, and n >=m, the copy of the described original source code of described acquisition, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with the target language text string corresponding with described second selection instruction, generate the source code with the corresponding target language version of described second selection instruction, comprise:
Obtain m copy of described original source code;
According to the corresponding relation of language text string original in described language profile with at least one target language text string, respectively the source language text string in the m of a described original source code copy is replaced with the target language text string of a kind of target language corresponding with described second selection instruction, generate the source code of m the target language version corresponding with described second selection instruction.
12. methods according to claim 10, it is characterized in that, the type of the target language determined according to described first selection instruction is n kind, described source language text string is translated to n target language text string of each source language text string corresponding n type target language in the language profile of rear generation, n is positive integer, the copy of the described original source code of described acquisition, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generate the source code with the corresponding target language version of described first selection instruction, comprise:
Obtain n copy of described original source code;
According to the corresponding relation of language text string original in described language profile with at least one target language text string, respectively the source language text string in the n of a described original source code copy is replaced with the target language text string of a kind of target language corresponding with described source language text string in described language profile, generate the source code of n the target language version corresponding with described first selection instruction.
13. methods according to claim 1 and 2, is characterized in that, according to described language profile and described original source code, after generating the source code of target language version, also comprise:
Judge whether there is described source language text string in the source code of described target language version, if existed, then export information to point out user.
14. methods according to claim 13, is characterized in that, described output information, to point out user, comprising:
Obtain in the source code of described target language version the positional information of the described source language text string existed;
Described positional information is exported to user.
The multi-lingual opinion on public affairs system of 15. 1 kinds of source codes, is characterized in that, comprising: source language text string obtains unit, target language text string obtains unit, file generating unit and target language code generating unit,
Described source language text string obtains unit, for obtaining the source language text string in original source code;
Described target language text string obtains unit, for obtaining the target language text string corresponding with described source language text string;
Described file generating unit, has described source language text string and the language profile of target language text string described at least one for generating corresponding stored;
Described target language code generating unit, for generating the source code of target language version according to described language profile and described original source code.
16. systems according to claim 15, is characterized in that, also comprise: compiling of application unit, for by the compilation of source code of described target language version being the application program of described target language version.
17. systems according to claim 15 or 16, is characterized in that, described source language text string obtains unit, comprising: separator determination subelement and text string obtain subelement,
Described separator determination subelement, for determining the text string separator in original source code;
Described text string obtains subelement, for obtaining the source language text string between described text string separator mutually corresponding in described original source code.
18. systems according to claim 17, is characterized in that, described separator determination subelement, comprising: language form obtains subelement and separator subelement,
Described language form obtains subelement, for obtaining the program language type of original source code;
Described separator subelement, for according to described program language type, is defined as the text string separator in described original source code by the text string separator mated with described program language type.
19. systems according to claim 18, is characterized in that, described language form obtains subelement, comprising: user inputs subelement or recognin unit,
Described user inputs subelement, for obtaining the program language type of the original source code of user's input;
Described recognin unit, for identifying the program language type of original source code, obtains the program language type of described original source code.
20. systems according to claim 15, is characterized in that, described target language text string obtains unit, comprising: the first command reception subelement, target language determination subelement and translation subelement;
Described first command reception subelement, for receiving first selection instruction of user to language form;
Described target language determination subelement, for the type according to described first selection instruction determination target language;
Described translation subelement, for described source language text string is translated as the target language text string corresponding with described source language text string, the language form of described target language text string belongs to the type of described target language.
21. systems according to claim 20, is characterized in that, described target language code generating unit, comprising: the second command reception subelement and first code generate subelement;
Described second command reception subelement, for receiving second selection instruction of user to determined target language type;
Described first code generates subelement, for generating the source code of the target language version corresponding with described second selection instruction according to described language profile and described original source code.
22. systems according to claim 21, is characterized in that, described first code generates subelement, comprising: first code replaces subelement or subelement replaced by the first authentic copy,
Described first code replaces subelement, for the corresponding relation according to language text string original in described language profile and at least one target language text string, source language text string in described original source code is replaced with the target language text string corresponding with described second selection instruction, generates the source code with the corresponding target language version of described second selection instruction;
Subelement replaced by the described first authentic copy, for obtaining the copy of described original source code, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with the target language text string corresponding with described second selection instruction, generates the source code with the corresponding target language version of described second selection instruction.
23. systems according to claim 20, is characterized in that, described target language code generating unit, for generating the source code of the target language version corresponding with described first selection instruction according to described language profile and described original source code.
24. systems according to claim 23, is characterized in that, described target language code generating unit, comprising: second code replaces subelement or triplicate replaces subelement,
Described second code replaces subelement, for the corresponding relation according to language text string original in described language profile and at least one target language text string, source language text string in described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generates the source code with the corresponding target language version of described first selection instruction;
Described triplicate replaces subelement, for obtaining the copy of described original source code, according to the corresponding relation of language text string original in described language profile with at least one target language text string, source language text string in the copy of described original source code is replaced with target language text string corresponding with described source language text string in described language profile, generates the source code with the corresponding target language version of described first selection instruction.
25. systems according to claim 22, it is characterized in that, the type of the target language determined according to described first selection instruction is n kind, described source language text string is translated to n target language text string of each source language text string corresponding n type target language in the language profile of rear generation, user is m kind by the type of the target language selected by described second selection instruction, m and n is positive integer, and n >=m, subelement replaced by the described first authentic copy, comprise: the first authentic copy obtains module and first authentic copy replacement module
The described first authentic copy obtains module, for obtaining m copy of described original source code;
Described first authentic copy replacement module, for the corresponding relation according to language text string original in described language profile and at least one target language text string, respectively the source language text string in the m of a described original source code copy is replaced with the target language text string of a kind of target language corresponding with described second selection instruction, generate the source code of m the target language version corresponding with described second selection instruction.
26. systems according to claim 24, it is characterized in that, the type of the target language determined according to described first selection instruction is n kind, described source language text string is translated to n target language text string of each source language text string corresponding n type target language in the language profile of rear generation, n is positive integer, described triplicate replaces subelement, comprising: triplicate obtains module and triplicate replacement module
Described triplicate obtains module, for obtaining n copy of described original source code;
Described triplicate replacement module, for the corresponding relation according to language text string original in described language profile and at least one target language text string, respectively the source language text string in the n of a described original source code copy is replaced with the target language text string of a kind of target language corresponding with described source language text string in described language profile, generate the source code of n the target language version corresponding with described first selection instruction.
27. systems according to claim 15 or 16, is characterized in that, also comprise: judging unit and Tip element,
Described judging unit, for at described target language code generating unit according to described language profile and described original source code, after generating the source code of target language version, judge whether there is described source language text string in the source code of described target language version, if so, then described Tip element is triggered;
Described Tip element, for exporting information to point out user.
28. systems according to claim 27, is characterized in that, described Tip element, comprising: position obtains unit and position output unit,
Described position obtains unit, for obtaining the positional information of the described source language text string existed in the source code of described target language version;
Described position output unit, for exporting to user by described positional information.
29. 1 kinds of plug-in units, is characterized in that, described plug-in unit can by the first application call, and described plug-in unit comprises: source language text string obtains unit, target language text string obtains unit, file generating unit and target language code generating unit,
Described source language text string obtains unit, for obtaining the source language text string in original source code;
Described target language text string obtains unit, for obtaining the target language text string corresponding with described source language text string;
Described file generating unit, has described source language text string and the language profile of target language text string described at least one for generating corresponding stored;
Described target language code generating unit, for generating the source code of target language version according to described language profile and described original source code.
30. plug-in units according to claim 29, is characterized in that, described first application program is Program Appliance program or compiling application program.
CN201410076610.XA 2014-03-04 2014-03-04 The multi-lingual opinion on public affairs method and system of source code Active CN104899010B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410076610.XA CN104899010B (en) 2014-03-04 2014-03-04 The multi-lingual opinion on public affairs method and system of source code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410076610.XA CN104899010B (en) 2014-03-04 2014-03-04 The multi-lingual opinion on public affairs method and system of source code

Publications (2)

Publication Number Publication Date
CN104899010A true CN104899010A (en) 2015-09-09
CN104899010B CN104899010B (en) 2018-12-21

Family

ID=54031689

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410076610.XA Active CN104899010B (en) 2014-03-04 2014-03-04 The multi-lingual opinion on public affairs method and system of source code

Country Status (1)

Country Link
CN (1) CN104899010B (en)

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106020918A (en) * 2016-04-29 2016-10-12 广州小百合信息技术有限公司 Television software compiling method and system
CN107247612A (en) * 2017-04-25 2017-10-13 北京航天飞行控制中心 job description method and device
CN107273549A (en) * 2017-07-24 2017-10-20 山东中创软件工程股份有限公司 A kind of entry method for transformation and device
CN107343082A (en) * 2017-05-24 2017-11-10 上海与德科技有限公司 The method and device of location code leak
CN107659555A (en) * 2016-08-30 2018-02-02 北京长亭科技有限公司 Detection method and device, terminal device and the computer-readable storage medium of network attack
CN109284145A (en) * 2018-08-28 2019-01-29 北京城市网邻信息技术有限公司 The generation of multilingual configuration file and methods of exhibiting and device, equipment and medium
CN109657249A (en) * 2018-11-21 2019-04-19 天津字节跳动科技有限公司 The automatic replacement method of the text of application program, device and electronic equipment
CN109871284A (en) * 2017-12-05 2019-06-11 北京元比特科技有限责任公司 The virtualization technology and method that a kind of application program is executed across Language Runtime
CN109976734A (en) * 2019-02-26 2019-07-05 林庆斌 A method of realizing mother tongue programming
CN110275712A (en) * 2019-06-27 2019-09-24 深圳前海微众银行股份有限公司 A kind of text replacement method, device and equipment
CN110471659A (en) * 2019-08-16 2019-11-19 珠海格力电器股份有限公司 Multilingual method and system, human-machine interface configuration software end and equipment end
CN111240790A (en) * 2020-01-21 2020-06-05 广州市百果园信息技术有限公司 Multi-language adaptation method and device for application, client and storage medium
WO2020206837A1 (en) * 2019-04-12 2020-10-15 深圳壹账通智能科技有限公司 Code segment positioning method and device, computer apparatus, and storage medium
WO2020206838A1 (en) * 2019-04-12 2020-10-15 深圳壹账通智能科技有限公司 Code snippet translation method and apparatus, computer device, and storage medium
CN111966433A (en) * 2020-06-30 2020-11-20 北京百度网讯科技有限公司 Method and device for changing languages in page, storage medium and electronic equipment
CN112347142A (en) * 2020-11-17 2021-02-09 上海幻电信息科技有限公司 Data processing method and device
WO2023179449A1 (en) * 2022-03-25 2023-09-28 华为技术有限公司 Task verification method, terminal device, server, and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090037830A1 (en) * 2007-08-03 2009-02-05 International Business Machines Corporation Software solution for localization of software applications using automatically generated placeholders
CN101667118A (en) * 2008-09-02 2010-03-10 华为技术有限公司 Method and device for multi-language version development and replacement
CN102693221A (en) * 2011-08-29 2012-09-26 新奥特(北京)视频技术有限公司 Method and system for converting resource file language

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090037830A1 (en) * 2007-08-03 2009-02-05 International Business Machines Corporation Software solution for localization of software applications using automatically generated placeholders
CN101667118A (en) * 2008-09-02 2010-03-10 华为技术有限公司 Method and device for multi-language version development and replacement
CN102693221A (en) * 2011-08-29 2012-09-26 新奥特(北京)视频技术有限公司 Method and system for converting resource file language

Cited By (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106020918A (en) * 2016-04-29 2016-10-12 广州小百合信息技术有限公司 Television software compiling method and system
CN106020918B (en) * 2016-04-29 2020-01-17 广州朗国电子科技有限公司 Television software compiling method and system
CN107659555A (en) * 2016-08-30 2018-02-02 北京长亭科技有限公司 Detection method and device, terminal device and the computer-readable storage medium of network attack
WO2018041114A1 (en) * 2016-08-30 2018-03-08 北京长亭科技有限公司 Method and apparatus for detecting network attack, terminal device, and computer storage medium
CN107247612A (en) * 2017-04-25 2017-10-13 北京航天飞行控制中心 job description method and device
CN107343082A (en) * 2017-05-24 2017-11-10 上海与德科技有限公司 The method and device of location code leak
CN107273549A (en) * 2017-07-24 2017-10-20 山东中创软件工程股份有限公司 A kind of entry method for transformation and device
CN109871284A (en) * 2017-12-05 2019-06-11 北京元比特科技有限责任公司 The virtualization technology and method that a kind of application program is executed across Language Runtime
CN109284145A (en) * 2018-08-28 2019-01-29 北京城市网邻信息技术有限公司 The generation of multilingual configuration file and methods of exhibiting and device, equipment and medium
CN109657249B (en) * 2018-11-21 2022-03-22 天津字节跳动科技有限公司 Automatic text replacement method and device for application program and electronic equipment
CN109657249A (en) * 2018-11-21 2019-04-19 天津字节跳动科技有限公司 The automatic replacement method of the text of application program, device and electronic equipment
CN109976734A (en) * 2019-02-26 2019-07-05 林庆斌 A method of realizing mother tongue programming
CN109976734B (en) * 2019-02-26 2022-07-12 林庆斌 Method for realizing native language programming
WO2020206838A1 (en) * 2019-04-12 2020-10-15 深圳壹账通智能科技有限公司 Code snippet translation method and apparatus, computer device, and storage medium
WO2020206837A1 (en) * 2019-04-12 2020-10-15 深圳壹账通智能科技有限公司 Code segment positioning method and device, computer apparatus, and storage medium
CN110275712A (en) * 2019-06-27 2019-09-24 深圳前海微众银行股份有限公司 A kind of text replacement method, device and equipment
CN110275712B (en) * 2019-06-27 2023-05-12 深圳前海微众银行股份有限公司 Text replacement method, device and equipment
CN110471659A (en) * 2019-08-16 2019-11-19 珠海格力电器股份有限公司 Multilingual method and system, human-machine interface configuration software end and equipment end
CN111240790A (en) * 2020-01-21 2020-06-05 广州市百果园信息技术有限公司 Multi-language adaptation method and device for application, client and storage medium
CN111966433A (en) * 2020-06-30 2020-11-20 北京百度网讯科技有限公司 Method and device for changing languages in page, storage medium and electronic equipment
CN112347142A (en) * 2020-11-17 2021-02-09 上海幻电信息科技有限公司 Data processing method and device
CN112347142B (en) * 2020-11-17 2024-03-01 上海幻电信息科技有限公司 Data processing method and device
WO2023179449A1 (en) * 2022-03-25 2023-09-28 华为技术有限公司 Task verification method, terminal device, server, and storage medium

Also Published As

Publication number Publication date
CN104899010B (en) 2018-12-21

Similar Documents

Publication Publication Date Title
CN104899010A (en) Multilingualization method and system of source code
CN106843840B (en) Source code version evolution annotation multiplexing method based on similarity analysis
CN105138350A (en) International multi-language implement method of configuration software
EP1890235A1 (en) Test case management
CN102804147A (en) Code inspection executing system for performing a code inspection of ABAP source codes
CN101667118A (en) Method and device for multi-language version development and replacement
CN103049098A (en) Device and method for input method shifting
CN102053958A (en) In-context exact (ICE) matching
CN103077062A (en) Method and device for detecting code change
CN102637168A (en) Method for realizing automatic language translation in graphical user interface
CN102402505B (en) Delta language translation method and system
JP5454783B2 (en) Variable name input support method in PLC programming, variable name input support device in PLC programming, and computer program
CN113076167A (en) Code processing method and related equipment
JP6440895B2 (en) Software analysis apparatus and software analysis method
CN103761095A (en) Method for generating universal header data information of upgraded file
US9436664B2 (en) Performing multiple scope based search and replace within a document
CN111158663A (en) Method and system for handling references to variables in program code
CN104933030A (en) Uygur language spelling examination method and device
CN113792027A (en) Universal database conversion device
CN101727451B (en) Method and device for extracting information
CN107577482A (en) The automatic switching method and device of software languages
CN105095184A (en) Method for spelling and grammar proofreading of text document
JP6022815B2 (en) Source code difference extraction method and system using parsing
CN107015955B (en) Document editing method and device
EP2535813A1 (en) Method and device for generating an alert during an analysis of performance of a computer application

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant