Embodiment
The embodiment of the present application provides a kind of system that realizes to support the method and the device of multi-language resource.
In order to make those skilled in the art person understand technical scheme in the embodiment of the present application better, and the above-mentioned purpose of the embodiment of the present application, feature and advantage can be become apparent more, below in conjunction with accompanying drawing technical scheme in the embodiment of the present application is described in further detail.
Referring to Fig. 1, support the first embodiment flow process of the method for multi-language resource for the application's realization system:
Step 101: in application system, set up Resource TOC, and in Resource TOC, set up the resource sub-directory for each language resource type.
Step 102: the corresponding relation of in each resource sub-directory, preserving resource tag and language resource value.
Wherein, language resource type under the content of language resource value and the resource sub-directory is consistent, for example, for language resource value " button ", when the language resource type is " simplified Chinese character ", then the content of the language resource value of preserving in the simplified Chinese character resource sub-directory is " button ", when the language resource type is " traditional Chinese ", then the content of the language resource value of preserving in the traditional Chinese resource sub-directory is that “ is Aned Button "; when the language resource type was " English ", the content of the language resource value of preserving in the then English resource sub-directory was " button ".
Concrete, can be in described each resource sub-directory, set up some professional sub-directories according to the class of business under the language resource value, with the corresponding relation of resource tag and language resource value be saved in described language resource value under class of business corresponding service sub-directory in.
Step 103: receive the request of obtaining the language resource value, comprise the path of the affiliated resource sub-directory of language resource value in this request, and the sign of corresponding resource tag.
Step 104: from Resource TOC, obtain the language resource value according to this request, finish current flow process.
Concrete, search described Resource TOC, navigate to resource sub-directory under the described language resource value according to the path of described resource sub-directory, in the described resource sub-directory that navigates to, search corresponding resource tag according to the sign of described resource tag, and read the language resource value corresponding with the described resource tag that finds.
Referring to Fig. 2, support the second embodiment flow process of the method for multi-language resource for the application's realization system:
Step 201: the language resource type that pre-defined application system is supported.
In the present embodiment, the language resource type of supposing the pre-defined support of application system is simplified Chinese character, traditional Chinese and English.The application system of being mentioned in the embodiment of the present application can comprise the application EAS of the prior art system etc.
Step 202: in application system, set up Resource TOC, and in Resource TOC, set up the resource sub-directory for each language resource type.
In Resource TOC (Resource), set up simplified Chinese character resource sub-directory (zh_CN) respectively, traditional Chinese resource sub-directory (zh_TW) and English resource sub-directory (en_US).
The path of then above-mentioned three resource sub-directories is respectively:
<Root〉Resource zh_CN,<Root〉Resource zh_TW and<Root Resource en_US.
In above-mentioned the embodiment of the present application, the name of resource sub-directory can be with reference to the Locale standard that defines among the java, comprise iso639 language codes standard and iso3166 country code standard, promptly the name format of resource sub-directory is: language (two English codes of small letter) _ country's (two English codes of capitalization).
Step 203: extract the language resource value in the application system.
The various language resource of application system mainly refers to the shown language resource in application system user oriented interface, for example, and the literal that shows on the button key, system prompt information, customer interaction information or the like extracts above-mentioned all language resources respectively, may obtain some language resource values.
Compared with prior art, in the prior art when preserving the language resource value, the language resource value need be converted to American Standard Code for Information Interchange preserves, and the user that can directly preserve the language resource value in the embodiment of the present application can discern content, so that when subsequent request is obtained language resource, needn't be converted to from American Standard Code for Information Interchange again and can discern content output.
Step 204: for each language resource value of extracting is distributed corresponding resource tag.
Convenient for example, suppose to have extracted in thestep 203 three language resource values, be respectively " button ", " button 1 " and " button 2 "; Then be respectively above-mentioned three language values Resources allocation label Label0, Label1 and Label2 respectively.
Step 205: in each resource sub-directory, set up some professional sub-directories according to the class of business under the language resource value.
Suppose that class of business is divided into general category, economic class and makes class, then further in three resource sub-directories, set up three professional sub-directories more respectively, with simplified Chinese character resource sub-directory is example, then be<Root in the path〉Resource under the resource sub-directory of zh_CN, set up the professional sub-directory of general category more respectively, professional sub-directory of economic class and the professional sub-directory of manufacturing class.
The path of above-mentioned three professional sub-directories is respectively:
<Root〉Resource zh_CN common,<Root〉Resource zh_CN finance and<Root Resource zh_CN manufacture.
Step 206: with the corresponding relation of resource tag and language resource value be saved in this language resource value under class of business corresponding service sub-directory in.
Resource tag and the language resource value set up in thestep 204 all belong to the general service sub-directory, and therefore the corresponding relation of resource tag of preserving under this general service sub-directory and language resource value is as follows:
Label0=" button ";
Label1=" button 1 ";
Label2=" button 2 ".
Step 207: receive the request of obtaining the language resource value, comprise the path of the affiliated resource sub-directory of language resource value in this request, and the sign of corresponding resource tag.
Suppose to obtain language resource value " button ", then in this request, need to comprise the resource sub-directory under this language resource value the path "<Root〉Resource zh_CN common ", the sign " Label0 " that further, in this request, also will comprise the resource tag of this language resource value correspondence.
Step 208: search Resource TOC, navigate to resource sub-directory under the language resource value according to the path of resource sub-directory.
According to the path of resource sub-directory "<Root〉Resource zh_CN common " navigate to the general service sub-directory of simplified Chinese character resource sub-directory.
Step 209: in the resource sub-directory that navigates to, search corresponding resource tag according to the sign of resource tag, and read the language resource value corresponding, finish current flow process with the resource tag that finds.
In the general service sub-directory of simplified Chinese character resource sub-directory, search resource tag according to " Label0 ", read the language resource value corresponding with Label0, can obtain desired language resource value content " button ".
Referring to Fig. 3, support the 3rd embodiment flow process of the method for multi-language resource for the application's realization system:
Step 301: the language resource type that pre-defined application system is supported.
Step 302: in application system, set up Resource TOC, and in Resource TOC, set up the resource sub-directory for each language resource type.
Step 303: in each resource sub-directory, preserve the corresponding relation of resource tag and language resource value, execution instep 304 orstep 306.
Wherein, language resource type under the content of language resource value and the resource sub-directory is consistent, for example, for language resource value " button ", when the language resource type is " simplified Chinese character ", then the content of the language resource value of preserving in the simplified Chinese character resource sub-directory is " button ", when the language resource type is " traditional Chinese ", then the content of the language resource value of preserving in the traditional Chinese resource sub-directory is that “ is Aned Button "; when the language resource type was " English ", the content of the language resource value of preserving in the then English resource sub-directory was " button ".
Concrete, can be in described each resource sub-directory, set up some professional sub-directories according to the class of business under the language resource value, with the corresponding relation of resource tag and language resource value be saved in described language resource value under class of business corresponding service sub-directory in.
Behind the corresponding relation of preserving resource tag and language resource value, can carry out attended operation to the resource sub-directory in the Resource TOC of setting up, for example, carry out the operation of follow-up increase language resource type, perhaps split the operation of language resource type etc.
Step 304: judging whether need be for application system increases the language resource type of supporting, if then execution instep 305; Otherwise, finish current flow process.
Step 305: under Resource TOC, set up the resource sub-directory, finish current flow process for the language resource type of described increase.
Step 306: judging whether needs to split the language resource type that application system is supported, if then execution instep 307; Otherwise, finish current flow process.
Step 307: search needs the resource sub-directory of the language resource type of reservation under Resource TOC, and the surplus resources sub-directory of deletion except that needing the resources reserved sub-directory, finishes current flow process.
Support that with the application's realization system the embodiment of method of multi-language resource is corresponding, the application also provides the realization system to support the embodiment of the device of multi-language resource.
Referring to Fig. 4,, the application's realization system puts into the first embodiment block diagram of device for supporting multi-language resource:
This device comprises: set upunit 410, preserveunit 420, receivingelement 430 and acquiringunit 440.
Wherein, set upunit 410, be used for setting up Resource TOC, and in described Resource TOC, set up the resource sub-directory for each language resource type in application system;
Preserve unit 420, be used for preserving at each described resource sub-directory the corresponding relation of resource tag and language resource value, the affiliated language resource type of the content of described language resource value and described resource sub-directory is consistent;
Receivingelement 430 is used to receive the request of obtaining the language resource value, comprises the path of the affiliated resource sub-directory of described language resource value in the described request, and the sign of corresponding resource tag;
Acquiringunit 440 is used for obtaining described language resource value according to described request from described Resource TOC.
Referring to Fig. 5,, the application's realization system puts into the second embodiment block diagram of device for supporting multi-language resource:
This device comprises:predefine unit 510, set upunit 520,extraction unit 530,allocation units 540, preserveunit 550, receivingelement 560 and acquiringunit 570.
Wherein,predefine unit 510 is used for the language resource type that pre-defined described application system is supported;
Set upunit 520, be used for setting up Resource TOC, and in described Resource TOC, set up the resource sub-directory for each language resource type in application system;
Extraction unit 530 is used for extracting the language resource value of described application system;
Allocation units 540 are used to each language resource value of described extraction to distribute corresponding resource tag;
Preserve unit 550, be used for preserving at each described resource sub-directory the corresponding relation of resource tag and language resource value, the affiliated language resource type of the content of described language resource value and described resource sub-directory is consistent;
Receivingelement 560 is used to receive the request of obtaining the language resource value, comprises the path of the affiliated resource sub-directory of described language resource value in the described request, and the sign of corresponding resource tag;
Acquiringunit 570 is used for obtaining described language resource value according to described request from described Resource TOC.
Referring to Fig. 6,, the application's realization system puts into the 3rd embodiment block diagram of device for supporting multi-language resource:
This device comprises:predefine unit 610, set upunit 620, preserveunit 630, receivingelement 640, acquiringunit 650, increaseunit 660 and splitcells 670.
Wherein,predefine unit 610 is used for the language resource type that pre-defined described application system is supported;
Set upunit 620, be used for setting up Resource TOC, and in described Resource TOC, set up the resource sub-directory for each language resource type in application system;
Preserve unit 630, be used for preserving at each described resource sub-directory the corresponding relation of resource tag and language resource value, the affiliated language resource type of the content of described language resource value and described resource sub-directory is consistent;
Receivingelement 640 is used to receive the request of obtaining the language resource value, comprises the path of the affiliated resource sub-directory of described language resource value in the described request, and the sign of corresponding resource tag;
Acquiringunit 650 is used for obtaining described language resource value according to described request from described Resource TOC;
Increase unit 660, be used for when increasing the language resource type of supporting, under described Resource TOC, setting up the resource sub-directory for the language resource type of described increase for described application system;
Split cells 670, be used for when splitting the language resource type of described application system support, search needs the resource sub-directory of the language resource type of reservation under described Resource TOC, and deletion is except that the described surplus resources sub-directory that needs the resources reserved sub-directory.
As seen through the above description of the embodiments, in application system, set up Resource TOC in the embodiment of the present application, and in Resource TOC, set up the resource sub-directory for each language resource type, in each described resource sub-directory, preserve the corresponding relation of resource tag and language resource value, obtain the request of language resource value when reception after, from Resource TOC, obtain the language resource value according to this request.The embodiment of the present application does not adopt the mode of BOS tool presets to generate multi-language source file, but different language resource file unifications is kept under the Resource TOC, each language resource file is set up a resource sub-directory, therefore be convenient to the expansion of system, and be convenient to language resource file is increased and attended operation such as fractionation institute's supporting language resource; When obtaining a certain language resource value, can navigate to language resource value and the output that to search fast according to the path relation between Resource TOC of being set up and the resource sub-directory.
As seen through the above description of the embodiments, those skilled in the art can be well understood to the application and can realize by the mode that software adds essential general hardware platform.Based on such understanding, the part that the application's technical scheme contributes to prior art in essence in other words can embody 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 application or embodiment.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, and identical similar part is mutually referring to getting final product between each embodiment, and each embodiment stresses all is difference with other embodiment.Especially, for system embodiment, because it is substantially similar in appearance to method embodiment, so description is fairly simple, relevant part gets final product referring to the part explanation of method embodiment.
The application can describe in the general context of the computer executable instructions of being carried out by computing machine, for example program module.Usually, program module comprises the routine carrying out particular task or realize particular abstract, program, object, assembly, data structure or the like.Also can in distributed computing environment, put into practice the application, in these distributed computing environment, by by communication network connected teleprocessing equipment execute the task.In distributed computing environment, program module can be arranged in the local and remote computer-readable storage medium that comprises memory device.
Though described the application by embodiment, those of ordinary skills know, the application has many distortion and variation and the spirit that do not break away from the application, wish that appended claim comprises these distortion and variation and the spirit that do not break away from the application.