CN101667118A - Method and device for multi-language version development and replacement - Google Patents
Method and device for multi-language version development and replacement Download PDFInfo
- Publication number
- CN101667118A CN101667118A CN200810198258A CN200810198258A CN101667118A CN 101667118 A CN101667118 A CN 101667118A CN 200810198258 A CN200810198258 A CN 200810198258A CN 200810198258 A CN200810198258 A CN 200810198258A CN 101667118 A CN101667118 A CN 101667118A
- Authority
- CN
- China
- Prior art keywords
- code
- content
- language
- file
- replacement
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Stored Programmes (AREA)
Abstract
The embodiment of the invention discloses a method and device for realizing code replacement in multi-language version development, a method and a device for realizing multi-language version development and a computer readable medium. The method for realizing the code replacement in the multi-language version development comprises the following steps: traversing a source code file and searching afirst language code needing to be replaced; configuring a replacing content for the first language code searched out; and automatically replacing the first language in the source code file with the replacing content according to the result of the configuration. The methods, the devices and the medium solve the problems of leakage and large labor force cost which are caused by manual search and extraction and code replacement.
Description
Technical field
The present invention relates to computer realm, relate in particular to the method and apparatus that code is replaced in a kind of multi-language version exploitation, a kind of method and device of realizing the exploitation of multi-language version.
Background technology
Progressively formation along with science and technology development and economic globalization, infotech (Infonnation Technology, IT) the internationalization problem of service product is brought into schedule gradually, the language that promptly needs the multiple countries and regions of IT business product support gradually, the internationalization problem that how to solve the IT business product better is the focus that people pay close attention to and study.
In the prior art, realize supporting in the multilingual process of internationalization, need the developer manually from source code file, to extract the code information that to replace one by one, this process is an artificial pure physical operating process, artificial mistake appears easily, cause problems such as omission, and in case cause and need to spend bigger testing process after the omission and remedy, the code information that needs the developer manually one by one needs to be replaced is in addition replaced, and the described code information that will replace of interpretation of records manually and the corresponding relation of replacing content, expend great amount of manpower, can not release the multi-language version of product at short notice.
Summary of the invention
The embodiment of the invention is to provide method and the device that code is replaced in a kind of multi-language version exploitation, a kind of method and device of realizing the exploitation of multi-language version, solve manual search and extracted and replace code and the omission that causes, expended the problem of a large amount of manpowers.
In order to reach above-mentioned technique effect, the embodiment of the invention has proposed the method that code is replaced in a kind of multi-language version exploitation, and this method comprises the steps:
The ergodic source code file searches out the first language code that need replace;
Content is replaced in the described first language code configuration that searches out;
According to the configuration result of described configuration, automatically the described first language code in the described source code file is replaced to described replacement content.
Accordingly, the embodiment of the invention also discloses a kind of method that realizes the exploitation of multi-language version, it is characterized in that, comprise the steps:
The ergodic source code file searches out the first language code that need replace;
Content is replaced in the described first language code configuration that searches out;
According to the configuration result of described configuration, automatically first language code described in the described source code file is replaced to described replacement content;
And, set up the replacement mapping relations of described replacement content and at least a language version code according to described replacement content configuration resource file;
Resource file according to described configuration replaces to described at least a language version code with the described replacement content in the described source code file, and preserves the described source code file that the back generates of replacing.
Accordingly, the embodiment of the invention also discloses the device that code is replaced in a kind of multi-language version exploitation, it is characterized in that, comprising:
Spider module is used for the ergodic source code file, searches out the first language code that need replace;
The content configuration module, content is replaced in the first language code configuration that is used for described spider module is searched out;
Content is replaced module, is used for according to described content configuration modules configured result, automatically the described first language code in the described source code file is replaced to described replacement content.
Accordingly, the embodiment of the invention also discloses a kind of device of realizing the exploitation of multi-language version, it is characterized in that, comprising:
Spider module is used for the ergodic source code file, searches out the first language code that need replace;
The content configuration module, content is replaced in the first language code configuration that is used for described spider module is searched out;
Replace module, be used for, automatically the described first language code in the described source code file is replaced to described replacement content according to described content configuration modules configured result;
The file configuration module is used for setting up the replacement mapping relations of described replacement content and at least a language version code according to described replacement content configuration resource file;
File is replaced module, is used for according to the resource file of described file configuration block configuration the described replacement content of described source code file being replaced to described at least a language version code, and preserves the described source code file that the back generates of replacing.
Implement the embodiment of the invention, by the ergodic source code file, automatically search out the first language code information that all need be replaced, and be that content is replaced in described first language code configuration, automatically the described first language code in the described source code file is replaced to described replacement content according to configuration result, solve manual search and extracted and replace code and the omission that causes, expended the problem of a large amount of manpowers.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art, to do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art below, apparently, accompanying drawing in describing below only is some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the process flow diagram of method first embodiment that code is replaced in the multi-language version exploitation of the present invention;
Fig. 2 is the process flow diagram of the method embodiment that code is replaced in the multi-language version exploitation of the present invention;
Fig. 3 is the method flow diagram of exploitation of the realization multi-language version of the embodiment of the invention;
Fig. 4 is the structural representation of first embodiment of the device that code is replaced in the multi-language version exploitation of the present invention;
Fig. 5 is the structural representation of the spider module of the embodiment of the invention;
Fig. 6 is the structural representation of the configuration module of the embodiment of the invention;
Fig. 7 is the structural representation of the embodiment of the device that code is replaced in the multi-language version exploitation of the present invention;
Fig. 8 is the structural representation of device of exploitation of the realization multi-language version of the embodiment of the invention.
Embodiment
The embodiment of the invention provides the method and apparatus that code is replaced in a kind of multi-language version exploitation, a kind of method and apparatus and a kind of computer-readable medium of realizing the exploitation of multi-language version, by the ergodic source code file, automatically search out the first language code information that all need be replaced, and be that content is replaced in described first language code configuration, automatically the described first language code in the described source code file is replaced to described replacement content according to configuration result, the omission that has solved manual search extraction and replacement code and caused, expend the problem of a large amount of manpowers, and it is more convenient to make product finish international flow process, satisfies the support demand of overseas operator to local language more neatly.
See also Fig. 1, Fig. 1 shows the process flow diagram of method first embodiment that code is replaced in the multi-language version exploitation of the present invention, comprises the steps:
Step S101: the ergodic source code file searches out the first language code that need replace;
Particularly, described first language code can be cmi code, English code, Japanese code, French code etc.Described source code file can be in JSP source code file, Java source code file and the C Plus Plus source code file etc. any or its combination.
Step S102: content is replaced in the described first language code configuration that searches out;
Particularly, described configuration replacement content can comprise: for each code in the described first language code that searches out is provided with the replacement content; Generate the replacement mapping relations of described replacement content of database storing and described first language code.Described replacement content can be STRUTS replace label or self-defining replacement content (such as, the XML static function), such as, when the cmi code in the needs replacement JSP source code file, described replacement content can for replacement label<bean:message key=" label " of STRUTS/, the replacement mapping relations of generation can be: label=first language code.
For example, " China " in the JSP source code file, corresponding replacement label can be<bean:message key=" CN ".The replacement mapping relations that generate can be: CN=China;
" searching " in the JSP source code, corresponding replacement label can be<bean:message key=" search ".The replacement mapping relations that generate can be: search=searches.
When replacing the code of source code file such as C++ or Java when needs, the replacement content of described configuration can be the static function of certain class, as CMessage::GetMessage (LAN_FLAG, " label ").
Step S103:, automatically the described first language code in the described source code file is replaced to described replacement content according to described configuration result.Such as, a button is arranged " determining " on the original interface, in the JSP source code, be written as so<input type=" button " value=" determine ", the replacement label of corresponding described " determining " can be<bean:message key=' buttoncaption '〉"; after then the replacement content being determined to replace in described Chinese, described source code becomes<input type=" button " value="<bean:messagekey=' buttoncaption '〉".
The foregoing description, by the ergodic source code file, automatically search out the first language code information that all need be replaced, and be that content is replaced in described first language code configuration, automatically the described first language code in the described source code file is replaced to described replacement content according to configuration result, solve manual search and extracted and replace code and the omission that causes, expended the problem of a large amount of manpowers.
Realize the example of supporting that internationalization is multilingual below in conjunction with the product of the JSP Chinese version that is source code, further describe the method that code is replaced in the multi-language version exploitation of the present invention, the process flow diagram of the method embodiment that code is replaced in the multi-language version exploitation of the present invention as shown in Figure 2 comprises the steps:
Step S201: the file in the Ergodic Theory searches out and need carry out the JSP source code file that language version is replaced;
Particularly, system can utilize Windows Application Programming Interface, be called for short the file in the Windows api function Ergodic Theory, search out the source code file that to replace, as JSP source code file, C Plus Plus source code file etc.
Step S202: travel through the code in the described JSP source code file that searches out, in the code of described source code file, find out the not code between special character;
Particularly, code in the described JSP source code file that searches out is resolved into every row search processing, described special character comprises annotation symbol and/or character string symbol etc., described note character comprises double slashes symbol (i.e. " // " symbol) and "/* " symbol etc., described character string symbol comprises and singly draws symbol and two symbol etc. that draws, the described not code between special character is effective run time version, in the code of described source code file, find out the not code between described special character, be the effective run time version that in the code of described source code file, finds out except note code and/or character string code etc.
Step S203: detect in the described code that finds out whether contain Chinese character;
Particularly, if Chinese character then its high position data be greater than 128, then whole int value showing as<0, when described testing result when being, execution in step S204, when described testing result for not the time, execution in step S207.
Step S204: the code information of writing down all Chinese character correspondences of described detection;
Particularly, described code information comprises type of code (label, gauge outfit, button, to picture frame, bubbling etc.) code content, filename and described code content row in described file number etc., the type of difference record code, the Chinese content of each Chinese character correspondence in the code, row of the file at the title of the file at described Chinese character place and described Chinese character place number etc.
Step S205: to the replacement label of described Chinese character configuration STRUTS form;
Particularly, being the button of " determining " with one on the original interface is that example describes, form in the JSP source code is<input type=" button " value=" determine ", the replacement label of wherein Chinese character (promptly determining) configuration be can be<bean:message key=' buttoncaption '.
Step S206: described Chinese character is replaced to described replacement label according to described replacement label.
Particularly, being the button of " determining " with one on the above-mentioned original interface is that example describes, JSP source code<input type=" button " value=" determine " in Chinese character replace to described replacement label, the JSP source code form after replacing so is<input type=" button " value="<bean:messagekey=' buttoncaption ' ".
Need to prove, during execution in step S202, particularly, need carry out line by line word for word parsing at the file that searches out, can pre-defined Chinese switch and be single quotation marks in advance, double quotation marks, " // " symbol and "/* " symbol etc. define the sign switch respectively, and define before each sign waits for that this switch cuts out after switch opens, other sign switch does not allow to open (being that other special characters that occur between a certain special character will be left in the basket), under the situation that all sign switches all cut out, identifying current code is effective run time version, in addition, at greatly Chinese character is situation about appearing in the middle of the quotation marks, the developer can set under the situation of sign switch opens of quotation marks, and also identifying current code is effective run time version.After identifying effective run time version, search the Chinese character of described effective run time version, when detecting Chinese character, then described Chinese switch opens, detecting Chinese character finishes, then Chinese switch cuts out, and writes down Chinese switch opens and the code position when closing, and exports Chinese character in the described position by the code position information of record at last.
Distinguishingly, the special processing for some special characters in the JSP page generally is divided into following several middle situation:
1,<%...% situation,<%...%〉in Chinese character can not replace with label because the code in the middle of this carries out in service end, thus substitute mode should with existing in the alternative of right Java source code keep unified.For this situation the present invention is to carry out secondary by setting to replace and handle, promptly at first do not consider<%...% for the replacement of jsp file〉situation, after unification by the embodiment of the invention replaces it, the HTML statement of jsp file and the Chinese information in the JS script are by<bean:messagekey=" "/label replace and finished, then set carry out secondary replace in only at<%...% in content replace.Above-mentioned replacement operation can be provided with check box and control in the control interface.
2,, ﹠amp; Nbsp; Situation, as " " ﹠amp; Nbsp; Literary composition ", according to the Fen Xidao ﹠amp of normal logic when file; During symbol, the file analysis interface can think that Chinese finishes, and causes " " ﹠amp at last; Nbsp; Literary composition " be split into two sections Chinese information, therefore can judge combining characters Chuan ﹠amp; Nbsp; , by preestablishing combining characters Chuan ﹠amp; Nbsp; Situation, when combining characters Chuan ﹠amp during Chinese switch opens, occurring; Nbsp; Not being considered as Chinese finishes.
3, the situation of " English Chinese english ", described English and english make a general reference non-Chinese character, this situation need be provided with by rule, need to extract " Chinese " if preset, then select to carry out the quotation marks extracting section, if default need to extract " English Chinese english ", then to select to carry out the quotation marks full dose and extract, described quotation marks full dose is extracted expression and all is considered as Chinese and carries out resource and extract as long as occur then whole section quotation marks part of Chinese in the quotation marks.
Need to prove, during execution in step S206, particularly, if directly replace according to key word, can there be the problem that occurs the replacement of mistake because character string has relation of inclusion, retrieve needs such as system and replace Chinese information " group's attribute " and " group ", do not replace the character of the group in " group's attribute " when so just must guarantee to replace " group's attribute " separately, otherwise " group's attribute " will be replaced by<bean:message key=" "/form of attribute, rather than the handle " group's attribute " that the developer wishes replaces to<bean:message key=" "/form, thereby caused search and replaced disunity.In order to solve the replacement problem of above-mentioned appearance, improve the accuracy of replacing, before carrying out the step of replacing, can analyze file again, carry out the step of replacing then, promptly behind step S205, re-execute step S201 to step S203, finish reanalysing to the code of file, direct execution in step S206 then, particularly, re-executed step S203 after, promptly behind the cmi code that traversal search goes out once more, whether system can detect the cmi code that described traversal search once more goes out consistent with the code information of the described record of step S204, if the result of described detection is inconsistent, and promptly above-mentioned search out for twice Chinese inequality, process ends then, if the unanimity as a result of described detection, then execution in step S206 replaces the code that the needs that search out are replaced according to the replacement content that step S205 before disposes, avoided directly replacing the replacement problem of appearance, the accuracy that improves search and replace according to key word.
Need to prove, the step of the embodiment of the invention also comprises, "<%@taglib uri="/WEB-INF/struts-bean.tld " prefix=" bean " %〉" judged among the JSP and whether exists in the final step of replacing at file, if there is no, then add above-mentioned code line to file header for program automatically.
Below in conjunction with the method flow diagram of the exploitation of the realization multi-language version of the embodiment of the invention shown in Fig. 3, the method for exploitation of the realization multi-language version of the embodiment of the invention is described, comprise the steps:
Step S301: the ergodic source code file searches out the first language code that need replace;
Step S302: content is replaced in the described first language code configuration that searches out;
Step S303:, automatically the described first language code in the described source code file is replaced to described replacement content according to described configuration result.
Step S304:, set up the replacement mapping relations of described replacement content and at least a language version code according to described replacement content configuration resource file; Particularly, with the product of the JSP Chinese version that is source code realize supporting internationalization multilingual (, at least two kinds, such as, can comprise Chinese version, English edition Japanese versions etc.) be example, the resource file definable of JSP label is in the struts-config.xml file, and form is as follows:<message-resources parameter=" resources.Application_CN.properties "/.In described resource file, the corresponding relation of the corresponding replacement format content of the code of described multilingual version and described configuration is exported according to the form of label=value, as Chinese version and as described in the replacement mapping relations of replacement content be:
The groupAttrConfigMainFrame_jsp.ProdType=product type
GroupProdTypeAttrList_jsp.PropShowType=attribute display type
The replacement mapping relations of English edition and described replacement content are:
groupAttrConfigMainFrame_jsp.ProdType=stufftype
groupAttrConfigMainFrame_jsp.ProdType=configtype
Step S305: the resource file according to described configuration replaces to described at least a language version code with the described replacement content in the described source code file, and preserves the described source code file that the back generates of replacing.In the specific implementation, described source code file of replacing the back generation can be kept in the internal memory corresponding document, copy in the STUTS framework resources.Application_CN.properties file.In the time of also source code can being left in system's operation, in the addressable hard disk meeting exterior storage medium.
Structural representation below in conjunction with first embodiment of the device of code replacement in the multi-language version exploitation of the present invention shown in Fig. 4 illustrates the device that code is replaced in a kind of multi-language version exploitation in the embodiment of the invention, comprising:
Content is replaced module 44, is used for the configuration result according to described content configuration module 42 configurations, automatically the described first language code in the described source code file is replaced to described replacement content.Such as, a button is arranged " determining " on the original interface, in the JSP source code, be written as so<input type=" button " value=" determine ", the replacement label of corresponding described " determining " can be<bean:message key=' buttoncaption '〉"; after then described content replacement module 44 " was determined described Chinese " to replace to into the replacement content, described source code became<input type=" button " value="<bean:message key=' buttoncaption '〉".
The foregoing description, by the ergodic source code file, automatically search out the first language code information that all need be replaced, and be that content is replaced in described first language code configuration, automatically the described first language code in the described source code file is replaced to described replacement content according to configuration result, the omission that has solved manual search extraction and replacement code and caused, expend the problem of a large amount of manpowers, and it is more convenient to make product finish international flow process, satisfies the support demand of overseas operator to local language more neatly.
Need to prove, the device that code is replaced in the multi-language version exploitation of the embodiment of the invention can also comprise the traverse folder module, described traverse folder module can be utilized Windows ApplicationProgramming Interface, be called for short the file in the Windows api function Ergodic Theory, search out the source code file that to replace, as the JSP source code file, C Plus Plus source code file etc., travel through for spider module 40 then, from the source code file that described needs are replaced, search out the first language code that to replace.
Below in conjunction with the structural representation of the spider module 40 of the embodiment of the invention shown in Fig. 5, further describe the device that code is replaced in a kind of multi-language version exploitation of the embodiment of the invention, spider module 40 comprises:
Detect processing module 403, be used for searching the code that module 401 finds out and detecting and find out the first language code that to replace described.
Below in conjunction with the structural representation of the content configuration module 42 of the embodiment of the invention shown in Fig. 6, further describe the device that code is replaced in a kind of multi-language version exploitation of the embodiment of the invention, content configuration module 42 comprises:
Such as, when needs are replaced cmi code in the JSP source code file, described replacement content can for replacement label<bean:message key=" label " of STRUTS/, the replacement mapping relations of generation can be: label=first language code.
For example, " China " in the JSP source code file, the described replacement label that module 421 settings are set can be<bean:message key=" CN ".The replacement mapping relations that described memory module 423 generates can be: CN=China;
" searching " in the JSP source code, the described replacement label that module 421 settings are set can be<bean:message key=" search ".The replacement mapping relations that described memory module 423 generates can be: search=searches.
Structural representation below in conjunction with the embodiment of the device of code replacement in the multi-language version exploitation of the present invention shown in Fig. 7, further describe the device that code is replaced in a kind of multi-language version exploitation in the embodiment of the invention, except comprising above-mentioned spider module 40, content configuration module 42 and content replacement module 44, also comprise:
Realize the example of supporting that internationalization is multilingual below in conjunction with the product of the JSP Chinese version that is source code, further describe the function and the structure of the device that code is replaced in the multi-language version exploitation of the present invention:
The module 401 of searching in the spider module 40 finds out the not code between special character in the code of the source code file that searches out, described special character comprises annotation symbol and/or character string symbol etc., described note character comprises double slashes symbol (i.e. " // " symbol) and "/* " symbol etc., described character string symbol comprises and singly draws symbol and two symbol etc. that draws, the described not code between special character is effective run time version, in the code of described source code file, find out the not code between described special character, be the effective run time version that in the code of described source code file, finds out except note code and/or character string code etc.; Particularly, need carry out line by line word for word parsing at the file that searches out, can pre-defined Chinese switch and be single quotation marks in advance, double quotation marks, " // " symbol and "/* " symbol etc. define the sign switch respectively, and define before each sign waits for that this switch cuts out after switch opens, other sign switch does not allow to open (being that other special characters that occur between a certain special character will be left in the basket), under the situation that all sign switches all cut out, identifying current code is effective run time version, in addition, at greatly Chinese character is situation about appearing in the middle of the quotation marks, the developer can set under the situation of sign switch opens of quotation marks, and also identifying current code is effective run time version.After identifying effective run time version, search the Chinese character of described effective run time version, when detecting Chinese character, then described Chinese switch opens, detecting Chinese character finishes, then Chinese switch cuts out, and writes down Chinese switch opens and the code position when closing, and exports Chinese character in the described position by the code position information of record at last.
Distinguishingly, the special processing for some special characters in the JSP page generally is divided into following several middle situation:
1,<%...% situation,<%...%〉in Chinese character can not replace with label because the code in the middle of this carries out in service end, thus substitute mode should with existing in the alternative of right Java source code keep unified.For this situation the present invention is to carry out secondary by setting to replace and handle, promptly at first do not consider<%...% for the replacement of jsp file〉situation, after unification by the embodiment of the invention replaces it, the HTML statement of jsp file and the Chinese information in the JS script are by<bean:messagekey=" "/label replace and finished, then set carry out secondary replace in only at<%...% in content replace.Above-mentioned replacement operation can be provided with check box and control in the control interface.
2,, ﹠amp; Nbsp; Situation, as " " ﹠amp; Nbsp; Literary composition ", according to the Fen Xidao ﹠amp of normal logic when file; During symbol, the file analysis interface can think that Chinese finishes, and causes " " ﹠amp at last; Nbsp; Literary composition " be split into two sections Chinese information, therefore can judge combining characters Chuan ﹠amp; Nbsp; , by preestablishing combining characters Chuan ﹠amp; Nbsp; Situation, when combining characters Chuan ﹠amp during Chinese switch opens, occurring; Nbsp; Not being considered as Chinese finishes.
3, the situation of " English Chinese english ", described English and english make a general reference non-Chinese character, this situation need be provided with by rule, need to extract " Chinese " if preset, then select to carry out the quotation marks extracting section, if default need to extract " English Chinese english ", then to select to carry out the quotation marks full dose and extract, described quotation marks full dose is extracted expression and all is considered as Chinese and carries out resource and extract as long as occur then whole section quotation marks part of Chinese in the quotation marks.
Label is replaced in the Chinese character configuration that 42 pairs of described detection processing modules 403 of content configuration module detect, particularly, the pattern of replacement label of configuration is the pattern of the replacement logic that sets in advance, the pattern of the replacement logic that sets in advance as the developer is<bean:message key=" "/, being the button of " determining " with one on the original interface is that example describes, form in the code is<input type=" button " value=" determine ", to wherein Chinese character (promptly determining) configuration<bean:message key=' buttoncaption '〉the replacement label.
Content is replaced module 44 and automatically described Chinese character is replaced to described replacement label according to the replacement label that content configuration module 42 disposes, particularly, being the button of " determining " with one on the above-mentioned original interface is that example describes,<input type=" button " value=" determine " in Chinese character replace to described replacement label, the form after replacing so is<input type=" button " value="<bean:messagekey=' buttoncaption ' ".
Need to prove, content is replaced module 44 and is carried out when replacing, if directly replace according to key word, can there be the problem that occurs the replacement of mistake because character string has relation of inclusion, retrieve needs such as system and replace Chinese information " group's attribute " and " group ", do not replace the character of the group in " group's attribute " when so just must guarantee to replace " group's attribute " separately, otherwise " group's attribute " will be replaced by<bean:message key=" "/form of attribute, rather than the handle " group's attribute " that the developer wishes replaces to<bean:message key=" "/form, thereby caused search and replaced disunity.In order to solve the replacement problem of above-mentioned appearance, improve the accuracy of replacing, before content is replaced module 44 execution replacements, can trigger 40 pairs of files of spider module again analyzes once more, once more behind the first language code that traversal search goes out, whether can detect the first language code that described traversal search once more goes out consistent with the code information of logging modle 46 records, if the result of described detection is inconsistent, be that the first language code that searches out for twice of spider module 40 is inequality, process ends then, if the unanimity as a result of described detection, then replace according to the replacement content of content configuration module 42 configurations before, avoided directly replacing the replacement problem of appearance, the accuracy that improves search and replace according to key word.
Structural representation below in conjunction with the device of the exploitation of the realization multi-language version of the embodiment of the invention shown in Fig. 8, the device of exploitation of the realization multi-language version of the embodiment of the invention is described, except comprising above-mentioned spider module 40, content configuration module 42, content replacement module 44 and logging modle 46, also comprise:
File is replaced module 50, is used for according to the resource file of described file configuration module 48 configurations the described replacement content of described source code file being replaced to described at least a language version code, and preserves the described source code file that the back generates of replacing.
Particularly, with the product of the JSP Chinese version that is source code realize supporting internationalization multilingual (, at least two kinds, such as, can comprise Chinese version, English edition Japanese versions etc.) be example, the resource file definable of JSP label is in the struts-config.xml file, and form is as follows:<message-resourcesparameter=" resources.Application_CN.properties "/.In described resource file, the corresponding relation of the corresponding replacement format content of the code of described multilingual version and described configuration is exported according to the form of label=value, as Chinese version and as described in the replacement mapping relations of replacement content be:
The groupAttrConfigMainFrame_jsp.ProdType=product type
GroupProdTypeAttrList_jsp.PropShowType=attribute display type
The replacement mapping relations of English edition and described replacement content are:
groupAttrConfigMainFrame_jsp.ProdType=stufftype
groupAttrConfigMainFrame_jsp.ProdType=configtype
In the specific implementation, described source code file of replacing the back generation can be kept in the internal memory corresponding document, copy in the STUTS framework resources.Application_CN.properties file.In the time of also source code can being left in system's operation, in the addressable hard disk meeting exterior storage medium.
In sum, implement the embodiment of the invention, by the ergodic source code file, automatically search out the first language code information that all need be replaced, and be that content is replaced in described first language code configuration, automatically the described first language code in the described source code file is replaced to described replacement content according to configuration result, solved manual search and extracted and replace code and the omission that causes, expend the problem of a large amount of manpowers.
Need to prove that through the above description of the embodiments, those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential hardware platform, can certainly all implement by hardware.Based on such understanding, all or part of can the embodying that technical scheme of the present invention contributes to background technology with the form of software product, this computer software product can be stored in the storage medium, as ROM/RAM, magnetic disc, CD etc., comprise that some instructions are with so that a computer equipment (can be a personal computer, server, the perhaps network equipment etc.) carry out the described method of some part of each embodiment of the present invention or embodiment.
Above disclosed only is preferred embodiment in the embodiment of the invention, can not limit the present invention's interest field certainly with this, and therefore the equivalent variations of doing according to claim of the present invention still belongs to the scope that the present invention is contained.
Claims (15)
1, the method that code is replaced in a kind of multi-language version exploitation is characterized in that, comprises the steps:
The ergodic source code file searches out the first language code that need replace;
Content is replaced in the described first language code configuration that searches out;
According to the configuration result of described configuration, automatically the described first language code in the described source code file is replaced to described replacement content.
2, the method for claim 1 is characterized in that, the described first language code that need replace that searches out comprises:
Find out the not code between special character in described source code file, described special character comprises annotation symbol and/or character string symbol;
In the described code that finds out, detect and find out the first language code that to replace.
3, the method for claim 1 is characterized in that, and is described to before the described first language code configuration replacement content that searches out, and also comprises:
Write down the particular content and the positional information in described source code thereof of the first language code that the described needs that search out replace.
4, the method for claim 1 is characterized in that, the described first language code configuration that searches out described is replaced content and comprised:
For each code in the described first language code that searches out is provided with the replacement content;
Generate the replacement mapping relations of described replacement content of database storing and described first language code.
5, method as claimed in claim 4 is characterized in that, and is described according to described configuration result, automatically the described first language code in the described source code file replaced to described replacement content and comprises:
The ergodic source code file searches out the first national phonetic code that need replace once more;
Replacement mapping relations according to replacing content and described first language code described in the described database replace to described replacement content with the described first national phonetic code in the described source code file automatically.
6, method as claimed in claim 5, it is characterized in that, described according to the replacement mapping relations of replacing content and described first language code described in the described database, automatically the described first national phonetic code in the described source code file is replaced to described replacement content and comprise:
Whether detect first language code and position thereof that needs that described traversal search once more goes out replace identical with the code of described record;
According to replacing the replacement mapping relations of content described in the described database, automatic first language code identical with the code information of described record and position in the described source code is replaced to described replacement content with described first language code.
As each described method among the claim 1-6, it is characterized in that 7, described replacement content is that STRUTS replaces label or self-defining replacement content.
8, as the described method of claim 1-6, it is characterized in that, described source code file be in JSP source code file, Java source code file and the C Plus Plus source code file any.
9, a kind of method that realizes the exploitation of multi-language version is characterized in that, comprises the steps:
The ergodic source code file searches out the first language code that need replace;
Content is replaced in the described first language code configuration that searches out;
According to the configuration result of described configuration, automatically first language code described in the described source code file is replaced to described replacement content;
And, set up the replacement mapping relations of described replacement content and at least a language version code according to described replacement content configuration resource file;
Resource file according to described configuration replaces to described at least a language version code with the described replacement content in the described source code file, and preserves the described source code file that the back generates of replacing.
10, the device that code is replaced in a kind of multi-language version exploitation is characterized in that, comprising:
Spider module is used for the ergodic source code file, searches out the first language code that need replace;
The content configuration module, content is replaced in the first language code configuration that is used for described spider module is searched out;
Content is replaced module, is used for according to described content configuration modules configured result, automatically the described first language code in the described source code file is replaced to described replacement content.
11, device as claimed in claim 10 is characterized in that, described spider module comprises:
Search module, be used for finding out the not code between special character in described source code file, described special character comprises annotation symbol and/or character string symbol;
Detect processing module, be used for searching the code that module searches goes out and detecting and find out the first language code that to replace described.
12, device as claimed in claim 10 is characterized in that, described device also comprises:
Logging modle is used for writing down the particular content of the first language code that needs that described spider module searches out replace and in the positional information of described source code.
13, device as claimed in claim 10 is characterized in that, described content configuration module comprises:
Module is set, is used to each code in the described first language code that searches out that the replacement content is set;
Memory module is used to generate the replacement mapping relations of described replacement content of database storing and described first language code.
14, a kind of device of realizing the exploitation of multi-language version is characterized in that, comprising:
Spider module is used for the ergodic source code file, searches out the first language code that need replace;
The content configuration module, content is replaced in the first language code configuration that is used for described spider module is searched out;
Content is replaced module, is used for according to described content configuration modules configured result, automatically the described first language code in the described source code file is replaced to described replacement content;
The file configuration module is used for setting up the replacement mapping relations of described replacement content and at least a language version code according to described replacement content configuration resource file;
File is replaced module, is used for according to the resource file of described file configuration block configuration the described replacement content of described source code file being replaced to described at least a language version code, and preserves the described source code file that the back generates of replacing.
15, a kind of computer-readable medium is characterized in that, is stored with computer program, and described computer program can make one or more processors carry out as power 1 or weigh 9 described methods when moving.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200810198258A CN101667118A (en) | 2008-09-02 | 2008-09-02 | Method and device for multi-language version development and replacement |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200810198258A CN101667118A (en) | 2008-09-02 | 2008-09-02 | Method and device for multi-language version development and replacement |
Publications (1)
Publication Number | Publication Date |
---|---|
CN101667118A true CN101667118A (en) | 2010-03-10 |
Family
ID=41803745
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN200810198258A Pending CN101667118A (en) | 2008-09-02 | 2008-09-02 | Method and device for multi-language version development and replacement |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101667118A (en) |
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102467376A (en) * | 2010-11-10 | 2012-05-23 | 金蝶软件(中国)有限公司 | Modification method and device for character information |
CN104899010A (en) * | 2014-03-04 | 2015-09-09 | 北京金山云网络技术有限公司 | Multilingualization method and system of source code |
US9639348B2 (en) | 2012-12-06 | 2017-05-02 | International Business Machines Corporation | Program code library searching and selection in a networked computing environment |
CN107153607A (en) * | 2016-03-03 | 2017-09-12 | 展讯通信(天津)有限公司 | Check method, the apparatus and system of interface of mobile terminal language |
CN107273549A (en) * | 2017-07-24 | 2017-10-20 | 山东中创软件工程股份有限公司 | A kind of entry method for transformation and device |
CN107329957A (en) * | 2017-05-18 | 2017-11-07 | 网易(杭州)网络有限公司 | Replace the method and computer-readable recording medium of code Chinese character string |
CN107357568A (en) * | 2017-06-12 | 2017-11-17 | 北京天健通泰科技有限公司 | A kind of original language replacement method based on multi-lingual label |
CN107577482A (en) * | 2017-08-28 | 2018-01-12 | 北京锐安科技有限公司 | The automatic switching method and device of software languages |
CN108228179A (en) * | 2017-12-22 | 2018-06-29 | 东软集团股份有限公司 | The international processing method of the page, device, computer and storage medium |
CN110806896A (en) * | 2019-09-29 | 2020-02-18 | 上海派拉软件股份有限公司 | Method for realizing internationalized information extraction in software development based on maven plug-in |
CN110941441A (en) * | 2019-11-12 | 2020-03-31 | 望海康信(北京)科技股份公司 | Source code upgrading method and system |
WO2020259084A1 (en) * | 2019-06-27 | 2020-12-30 | 深圳前海微众银行股份有限公司 | Page information processing method and apparatus, and storage medium |
CN112256365A (en) * | 2020-09-27 | 2021-01-22 | 福建天泉教育科技有限公司 | Method and terminal for automatically managing multi-language versions |
CN112486623A (en) * | 2020-12-16 | 2021-03-12 | 恩亿科(北京)数据科技有限公司 | Development method, system and electronic equipment for automatically supporting multiple languages based on interface |
CN113760246A (en) * | 2021-09-06 | 2021-12-07 | 网易(杭州)网络有限公司 | Application program text language processing method and device, electronic equipment and storage medium |
CN113918254A (en) * | 2021-09-27 | 2022-01-11 | 腾讯科技(深圳)有限公司 | Language text management method and device, storage medium and electronic equipment |
-
2008
- 2008-09-02 CN CN200810198258A patent/CN101667118A/en active Pending
Cited By (25)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102467376B (en) * | 2010-11-10 | 2015-07-15 | 金蝶软件(中国)有限公司 | Modification method and device for character information |
CN102467376A (en) * | 2010-11-10 | 2012-05-23 | 金蝶软件(中国)有限公司 | Modification method and device for character information |
US9639348B2 (en) | 2012-12-06 | 2017-05-02 | International Business Machines Corporation | Program code library searching and selection in a networked computing environment |
CN103853549B (en) * | 2012-12-06 | 2017-05-10 | 国际商业机器公司 | Method and system for carrying out PROGRAM CODE LIBRARY SEARCHING AND SELECTION IN A NETWORKED COMPUTING ENVIRONMENT |
US9891896B2 (en) | 2012-12-06 | 2018-02-13 | International Business Machines Corporation | Program code library searching and selection in a networked computing environment |
US10169031B2 (en) | 2012-12-06 | 2019-01-01 | International Business Machines Corporation | Program code library searching and selection in a networked computing environment |
CN104899010B (en) * | 2014-03-04 | 2018-12-21 | 北京金山云网络技术有限公司 | The multi-lingual opinion on public affairs method and system of source code |
CN104899010A (en) * | 2014-03-04 | 2015-09-09 | 北京金山云网络技术有限公司 | Multilingualization method and system of source code |
CN107153607A (en) * | 2016-03-03 | 2017-09-12 | 展讯通信(天津)有限公司 | Check method, the apparatus and system of interface of mobile terminal language |
CN107329957A (en) * | 2017-05-18 | 2017-11-07 | 网易(杭州)网络有限公司 | Replace the method and computer-readable recording medium of code Chinese character string |
CN107329957B (en) * | 2017-05-18 | 2020-08-18 | 网易(杭州)网络有限公司 | Method for replacing code Chinese character string and computer readable storage medium |
CN107357568A (en) * | 2017-06-12 | 2017-11-17 | 北京天健通泰科技有限公司 | A kind of original language replacement method based on multi-lingual label |
CN107273549A (en) * | 2017-07-24 | 2017-10-20 | 山东中创软件工程股份有限公司 | A kind of entry method for transformation and device |
CN107577482A (en) * | 2017-08-28 | 2018-01-12 | 北京锐安科技有限公司 | The automatic switching method and device of software languages |
CN108228179A (en) * | 2017-12-22 | 2018-06-29 | 东软集团股份有限公司 | The international processing method of the page, device, computer and storage medium |
WO2020259084A1 (en) * | 2019-06-27 | 2020-12-30 | 深圳前海微众银行股份有限公司 | Page information processing method and apparatus, and storage medium |
CN110806896A (en) * | 2019-09-29 | 2020-02-18 | 上海派拉软件股份有限公司 | Method for realizing internationalized information extraction in software development based on maven plug-in |
CN110806896B (en) * | 2019-09-29 | 2020-11-13 | 上海派拉软件股份有限公司 | Method for realizing internationalized information extraction in software development based on maven extension plug-in |
CN110941441A (en) * | 2019-11-12 | 2020-03-31 | 望海康信(北京)科技股份公司 | Source code upgrading method and system |
CN112256365A (en) * | 2020-09-27 | 2021-01-22 | 福建天泉教育科技有限公司 | Method and terminal for automatically managing multi-language versions |
CN112256365B (en) * | 2020-09-27 | 2022-06-07 | 福建天泉教育科技有限公司 | Method and terminal for automatically managing multi-language versions |
CN112486623A (en) * | 2020-12-16 | 2021-03-12 | 恩亿科(北京)数据科技有限公司 | Development method, system and electronic equipment for automatically supporting multiple languages based on interface |
CN113760246A (en) * | 2021-09-06 | 2021-12-07 | 网易(杭州)网络有限公司 | Application program text language processing method and device, electronic equipment and storage medium |
CN113760246B (en) * | 2021-09-06 | 2023-08-11 | 网易(杭州)网络有限公司 | Application text language processing method and device, electronic equipment and storage medium |
CN113918254A (en) * | 2021-09-27 | 2022-01-11 | 腾讯科技(深圳)有限公司 | Language text management method and device, storage medium and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101667118A (en) | Method and device for multi-language version development and replacement | |
US7149971B2 (en) | Method, apparatus, and system for providing multi-language character strings within a computer | |
US7546315B2 (en) | Device for reporting software problem information | |
US10229115B2 (en) | System and method for creating an internationalized web application | |
CN108491199B (en) | Method and terminal for automatically generating interface | |
US7441184B2 (en) | System and method for internationalizing the content of markup documents in a computer system | |
US7165020B2 (en) | Multi-language phrase editor and method thereof | |
US8683324B2 (en) | Dynamic generation of target files from template files and tracking of the processing of target files | |
US8468494B2 (en) | In-line editor | |
US20080300859A1 (en) | System and Method for Automatic Natural Language Translation of Embedded Text Regions in Images During Information Transfer | |
US7398214B2 (en) | Method for translating slide presentations into different languages | |
US6466900B1 (en) | Multi-language phrase editor and method thereof | |
WO2009007181A1 (en) | A method, system and computer program for intelligent text annotation | |
US20110191381A1 (en) | Interactive System for Extracting Data from a Website | |
US20120109625A1 (en) | Synchro translation verification test for software applications | |
US9195653B2 (en) | Identification of in-context resources that are not fully localized | |
US7711548B2 (en) | Method and structures to enable national language support for dynamic data | |
CN106873971B (en) | Multi-language display method and system for flash application | |
CN112418875B (en) | Cross-platform tax intelligent customer service corpus migration method and device | |
CN104182479A (en) | Method and device for processing information | |
CN113407678B (en) | Knowledge graph construction method, device and equipment | |
CN108228179A (en) | The international processing method of the page, device, computer and storage medium | |
CN106648618B (en) | Text information generation method and device for virtual application | |
JP2016031572A (en) | Method of dividing term with appropriate granularity, computer for dividing term with appropriate granularity, and computer program therefor | |
CN109948251B (en) | CAD-based data processing method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Open date: 20100310 |