WO2020259084A1 - 页面信息处理方法、装置及存储介质 - Google Patents
页面信息处理方法、装置及存储介质 Download PDFInfo
- Publication number
- WO2020259084A1 WO2020259084A1 PCT/CN2020/088477 CN2020088477W WO2020259084A1 WO 2020259084 A1 WO2020259084 A1 WO 2020259084A1 CN 2020088477 W CN2020088477 W CN 2020088477W WO 2020259084 A1 WO2020259084 A1 WO 2020259084A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- file
- source
- target text
- target
- designated
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
- G06F16/334—Query execution
- G06F16/3344—Query execution using natural language analysis
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
Definitions
- This application relates to the field of Fintech, and in particular to a method, device and storage medium for processing page information.
- the existing technical solutions usually include a page development phase and a page operation phase.
- it usually requires the user to manually search for the multilingual display sentence from the source code. For example, looking for Chinese sentences. Then, manually replace the Chinese sentence with the required language distance, such as an English sentence.
- the source code of a large-scale web application often involves hundreds of source code files, involving thousands of sentences that need to be displayed in multiple languages. Manually find the sentences that need to be displayed in multiple languages from the source code files and modify them. It consumes a lot of manpower and has a long cycle.
- the embodiments of the application provide a method, device and storage medium for processing page information, which are used to solve the problem of manually searching for sentences that need to be displayed in multiple languages from source code files and modifying them in the page development stage in the prior art. A lot of manpower, and a long cycle.
- the first aspect of the embodiments of the present application discloses a page information processing method, and the method includes:
- the designated source files include target text, and the target text is text encoded with characters in a first language encoding mode;
- the target text contained in the specified source file is replaced.
- the method further includes:
- a corresponding single-language dictionary is generated for each character encoded in the second designated language encoding method.
- filter out the specified source files from the source code files on the page and generate a file list including:
- the source file identifier is added to the file list.
- filter out the specified source files from the source code files on the page and generate a file list including:
- Traverse source files in the selected source folder obtain the specified source file, and generate a file list.
- the method further includes:
- the characters encoded in at least two encoding modes specified in the merging instruction are merged.
- the method further includes:
- the prompt information includes the unsuccessful translation target text and the corresponding unsuccessful translation of the second designated language.
- the method further includes:
- the method further includes:
- the method further includes:
- the new target text is translated, and the translation result is updated to the target language dictionary.
- the method further includes:
- the translation result in the target language dictionary is updated.
- a page information processing device is disclosed, the device:
- the file list generating unit is used to filter out designated source files from the source code files of the page to generate a file list;
- the designated source files include target text, and the target text is text encoded in the first language encoding method ;
- the dictionary generating unit is used to traverse each designated source file contained in the file list, find the target text contained in each designated source file, and generate a target language dictionary;
- the translation unit is used to translate the target text in the target language dictionary into at least one character encoded by the second designated language encoding
- the replacement unit is configured to use the replacement rule corresponding to the file type of the specified source file to perform replacement processing on the target text contained in the specified source file.
- the device further includes:
- the single-language dictionary generating unit is used to generate a corresponding single-language dictionary for each character coded in the second designated language encoding mode.
- the file list generating unit is used to:
- the source file identifier is added to the file list.
- the file list generating unit is used to:
- Traverse source files in the selected source folder obtain the specified source file, and generate a file list.
- the device further includes:
- the merging unit is configured to respond to the merging instruction to merge the characters encoded in at least two encoding modes specified in the merging instruction.
- the device further includes:
- the prompt unit is used to determine the unsuccessful translation of the target text after translating the target text in the target language dictionary into at least one character encoded in the second designated language encoding method, and output prompt information, the prompt information including the The successfully translated target text and the corresponding unsuccessfully translated second specified language.
- the device further includes:
- the display unit is used to determine and display the number of successfully translated sentences in the target text after translating the target text in the target language dictionary into at least one character encoded in the second designated language encoding method, and/or,
- the device further includes:
- the filling unit is used for translating the target text in the target language dictionary into at least one character coded in the second designated language encoding mode, and then filling the translation result into the target language dictionary.
- the device further includes:
- the update unit is used to determine whether the new target text has been translated according to the target language dictionary after obtaining the new target text again;
- the new target text is translated, and the translation result is updated to the target language dictionary.
- the device further includes:
- the proofreading unit is used to display the proofreading interface of the translation result after filling the translation result into the target language dictionary
- the translation result in the target language dictionary is updated.
- the third aspect of the embodiments of the present application discloses a computer-readable medium that stores computer-executable instructions, and the computer-executable instructions are used to execute the above-mentioned page information processing method.
- the fourth aspect of the embodiments of the present application discloses a computer device.
- the computer device includes: at least one processor; and a memory communicatively connected with the at least one processor; wherein the memory stores the An instruction executed by a processor, the instruction being executed by the at least one processor, so that the at least one processor can execute the above-mentioned page information processing method.
- the fifth aspect of the embodiments of the present application discloses a computer program product, including a computer program or instruction.
- the computer program or instruction When the computer program or instruction is executed, at least one processor can execute the above-mentioned page information processing method.
- this application filters out the specified source files containing the target text from the source code files of the page, and generates a file list; traverses each specified source file contained in the file list, and finds each specified source file contains Generate a target language dictionary; translate the target text in the target language dictionary into at least one character encoded in the second specified language encoding; and, use the replacement rule corresponding to the file type of the specified source file to Specify the target text contained in the source file for replacement processing.
- This method makes it possible to automatically complete the search for sentences that need to be translated in the source code during the development phase of the page, to automatically translate these sentences, and to automatically replace the target text, which reduces the links of manual intervention. Effectively improve the efficiency of page development.
- FIG. 1 is a schematic flowchart of a method for processing page information in an embodiment of the application
- Figure 2 is a schematic diagram of an interface for displaying translation progress provided in an embodiment of the application
- FIG. 3 is a schematic diagram of another flow chart of a method for processing page information in an embodiment of the application.
- FIG. 4 is a schematic diagram of still another flow chart of the method for processing page information in an embodiment of the application.
- Fig. 5 is a structural block diagram of a page information processing apparatus in an embodiment of the application.
- FIG. 6 is a schematic structural diagram of a computer device provided in an embodiment of this application.
- this application can first determine the target text (such as Chinese character text), and after determining the target text, filter out the specified source files containing the target text from the source code files of the page, and generate a file list; Each designated source file contained in the file list is searched for the target text contained in each designated source file to generate a target language dictionary; the target text in the target language dictionary is translated into at least one character encoded in the second designated language encoding; And, using the replacement rule corresponding to the file type of the specified source file to perform replacement processing on the target text contained in the specified source file.
- the target text such as Chinese character text
- This method makes it possible to automatically complete the search for sentences that need to be translated in the source code during the development phase of the page, to automatically translate these sentences, and to automatically replace the target text, which reduces the links of manual intervention. Effectively improve the efficiency of page development.
- the document list, target language dictionary and source documents in this application are all produced step by step. In this way, it is convenient for users to manually intervene between each step, so as to manually modify the generated file list, dictionary and source code files. This makes the development, operation and maintenance of Web applications of banks and other financial institutions more efficient, and ensures the normal use of various business operation and maintenance platforms of banks, thereby realizing the normal development of various businesses (such as loan business, deposit business, etc.).
- Step 101 Filter out designated source files from the source code files of the page, and generate a file list; the designated source files include target text, and the target text is text encoded in a first language encoding mode.
- plug-ins or command-line tools In the development stage of the page, you can use plug-ins or command-line tools to automatically filter out the specified source files from the source code files of the page through certain filtering rules, and generate the file list.
- the specific process of calling the plug-ins and command line tools to generate the file list is in There will be detailed instructions later.
- Step 102 Traverse each designated source file included in the file list, search for the target text contained in each designated source file, and generate a target language dictionary.
- Step 103 Translate the target text in the target language dictionary into at least one character encoded in a second designated language encoding mode.
- Step 104 Use the replacement rule corresponding to the file type of the specified source file to perform replacement processing on the target text contained in the specified source file.
- the language corresponding to the text that needs to be displayed in multiple languages in the source code file is Chinese. If the text that needs to be displayed in multiple languages is'Chinese sentence', then the replaced text containing the translation identifier is _t (for Chinese sentence' Text. How to determine the target text and how to perform the replacement process will be detailed later, so I won’t go into details here.
- the specified source files are selected from the source code files on the page, and the file list can be generated in two ways. During specific implementation, the user can choose the corresponding method according to actual needs:
- Method 1 The specific implementation may include steps A1-step A2:
- Step A1 call the page packaging plugin to traverse the list of source file names used by the current project, and filter out the set of source files whose file suffix is the specified suffix;
- Step A2 For each source file in the source file set, if it is confirmed that the source file contains the target text, the source file identifier is added to the file list.
- the page packaging plugin In the development stage of the page, you can call the page packaging plugin to traverse the name list of the source files used by the current project, obtain the source files with the specified suffix through filtering, and get the source file collection. Then, a regular expression is used to determine whether the filtered source file contains the target text.
- the target text can be Chinese or other languages such as Japanese and other non-Latin character languages. If the filtered source file contains the target text, the identifier of the source file is added to the file list. Calling the page packaging plug-in can automatically obtain the file list and improve development efficiency.
- the second method can include step B1-step B2 in specific implementation:
- Step B1 invoking the command line tool to determine the selected source folder in response to the selected operation instruction for the source folder;
- Step B2 traverse the source files in the selected folder, obtain the specified source files, and generate a file list.
- Nest operation instructions using include and exclude for example, in the source folder AE, use the include operation instruction to filter out the source folder A in the include command, assuming that the source folder A includes 100 sub-folders numbered 1-100 File, and then use the exclude operation command to remove unnecessary files among the 100 sub-files that are filtered out. For example, use the exclude operation command to remove the sub-files numbered 1-50, then the number 51-100 in the source folder A
- the sub file is the selected source file. Iterate through the selected source files and filter out the source files of the specified file type and containing the target text to generate a file list.
- select source files with suffixes of .veu, .js, .htlm, and .jsp and then use regular expressions to determine whether the source file contains the target text. If the filtered source file contains the target text, the identifier of the source file is added to the file list. Calling the command line tool can automatically obtain the file list, and can also reduce the repetitive development work process such as manually creating the file list.
- the method further includes: determining and displaying the number of successfully translated sentences in the target text, And/or, confirm the translation progress and display it.
- FIG. 2 it is a schematic diagram of the interface for displaying content when translating with Chinese as the target text.
- the interface indicates that there are 2073 Chinese sentences that need to be translated, and the current progress is continuously updated and displayed. After the translation is completed, the number of successfully translated sentences and the address where the translation results are saved can also be displayed.
- the translation progress can also be displayed in the form of a progress bar, and the embodiment of the present application does not limit the specific manner of displaying the translation progress.
- This embodiment is adopted to display the number of translated sentences and/or the translation progress, so that the user can understand the progress of the translation process.
- the translation result may be filled into the target language dictionary. That is, the target language dictionary includes the target text to be translated and the translation result of each target text.
- the filled-in target language dictionary can be as shown in Table 1:
- the target text number can be a globally unique identifier for uniquely representing a target text that needs to be translated.
- the last two columns are the translation results of the two languages. It should be noted that Table 1 is only used to exemplify the embodiments of the present application, and is not used to limit the embodiments of the present application.
- Target text number Target text English translation result Japanese translation results 1 Statement 1 **** **** ... ... **** **** n Statement n **** ****
- the corresponding translation result can be found in the dictionary shown in Table 1 according to the source file to display the page.
- a proofreading interface of the translation result can be displayed for proofreading; and then according to the operation instruction on the proofreading interface, the translation result in the target language dictionary is updated.
- the translation results can be displayed and a proofreading interface can be provided. Then update and maintain the translation results according to the operations of the proofreaders in the proofreading interface. That is, the automatic translation results can be handed over to professional translators for proofreading, and the translators can modify the translation results.
- a corresponding single-language dictionary may be generated for each character encoded in the second designated language encoding mode. That is, after translating the target text contained in each designated source file into at least one character encoded by the second designated language encoding method, the corresponding characters encoded by each designated language encoding method can be generated according to the needs of the user.
- Single language dictionary For example, after obtaining the multilingual dictionary described in Table 1, the dictionary can be divided into source files containing each language. Including a single language dictionary containing English coded characters, a single language dictionary containing Japanese coded characters, and a single language dictionary containing Chinese can be further generated.
- the characters encoded by the second designated language encoding method are divided into different source files according to the language category, which is convenient for users to carry out the management of different languages, and it is also convenient for proofreading according to different languages during proofreading.
- the characters encoded by at least two encoding modes specified in the merge instruction may be merged, that is, the translation results of different languages may be merged. Among them, which language translation results are combined can be specified by the user.
- the method further includes: determining the target text for unsuccessful translation, and outputting prompt information, the prompt information Includes the unsuccessful translation target text and the corresponding unsuccessful translation of the second designated language.
- the new target text in order to facilitate the incremental update of the dictionary described in Table 1, in the embodiment of the present application, after obtaining the new target text again, it is possible to determine whether the new target text has been translated according to the target language dictionary; If it has not been translated, the new target text is translated, and the translation result is updated to the target language dictionary.
- the solution provided in the embodiment of this application can be used as needed, the page packaging plug-in or the command line tool described above can be used, and the new target text can be obtained according to regular expressions. If the obtained new target text has been translated, it may not be translated to avoid repeated translation. If it has not been translated, it may be translated, and the obtained translation result may be incrementally updated to the target language dictionary.
- the method of determining the target text from the source code files is also different.
- the following describes different types of source code files.
- the source code file is a JavaScript source code file.
- the specified source file is determined to be a JavaScript source code file; then, the content of the specified source file is matched through a preset regular expression, for example, the preset
- the regular expression can be:
- the regular expression can match single-line comments and multi-line comments in the .js file.
- the code blocks before and after each comment block can be regarded as independent code blocks. In each independent code block, use regular expressions to match in-line pairs.
- the preset regular expression can be used to determine whether the candidate string contains the preset language. For example, when the preset language is simplified Chinese, the regular expression is used to determine the candidate character Whether the string contains simplified Chinese characters. When it is determined that the candidate character string contains the preset language, it is determined that the candidate character string is the target text that needs to be processed.
- the preset regular expression used to determine the candidate string from the specified source file is different from the preset regular expression used to determine whether the candidate string contains the preset language Regular expression.
- the embodiment of the present application can determine one or more target texts to be processed from the designated source file.
- the target text is replaced by the replacement rule corresponding to the JavaScript source code file.
- the replacement rule is to replace the target text with the text containing the translation identifier.
- the candidate string contains the preset language, it is also necessary to determine whether the context of the candidate string contains a translation or reservation mark. After determining that it does not contain a translation mark and a reservation mark, the candidate The character string is replaced with the text containing the translation identification; after the translation identification or reservation identification is determined to be included, the candidate string is retained.
- the replacement rules for .js files are as follows:
- the replacement rule is to add the _t() translation identifier, and the replacement result is _t( ⁇ ’ ⁇ ;
- the context of the character string contains the character string of the translation identifier, such as _t( ⁇ ’ ⁇ , the character string is reserved;
- the context of the character string contains a character string with a reserved identifier, such as _r( ⁇ ' ⁇ , the character string is reserved.
- Step S301 Read in the specified source file
- Step S302 After determining that the file type of the designated source file is a preset type, the content of the source code file is matched through a preset regular expression to determine a candidate string;
- the preset types include JavaScript source code files, Html source code files, jsp source code files, and réelle source code files;
- Step S303 The candidate character string contains the character string of the preset language as the target text to be processed
- Step S304 Determine the replacement rule corresponding to the file type of the specified source file
- Step S305 Perform replacement processing on the target text using the determined replacement rule.
- the target text to be processed is determined from the source code file according to the following methods:
- the specified source file is determined to be the Html source code file; then, the content of the specified source file is parsed through htmlparser, and the attributes and contents of the child nodes are traversed and obtained; Then, find the attribute and content of the child node through the preset regular expression, and determine the attribute and content of the child node that contains the preset language in the attribute and content of the child node. And the content is the target text to be processed.
- the target text is replaced by the replacement rule corresponding to the Html source code file.
- the replacement rules corresponding to different types of child nodes in the embodiments of the present application may be different; the replacement rules corresponding to the Html source code file include child replacement rules corresponding to different child node types.
- the replacement rule corresponding to the Html source code file contains the first sub-replacement rule, the second sub-replacement rule, and the third sub-replacement rule;
- the sub-replacement rule corresponding to the regular node is the first sub-replacement rule, style node and comment node
- the corresponding child replacement rule is the second child replacement rule, and the child replacement rule corresponding to the script node is the third child replacement rule.
- the conventional nodes in the embodiment of the present application are nodes other than the style node, the comment node, and the script node in the Html tree.
- the target text is replaced according to the following methods:
- the first sub-replacement rule corresponding to a regular node includes but is not limited to:
- the replacement result is ⁇ i> ⁇ _t(' ⁇ ') ⁇ /i>.
- the target text is the content of the child node, and the content of the child node contains the preset language and Html reserved words, after the sentence is segmented according to the reserved words, each paragraph is processed according to the rules of the target text as the content of the child node;
- the target text is ⁇ i> ⁇ contains reserved words ⁇ /i>, and the default language is simplified Chinese, the replacement result is ⁇ i> ⁇ _t(' ⁇ ') ⁇ ⁇ _t( 'Reserved words') ⁇ .
- the target text is the content of the child node, and the content of the child node contains a variable expression, replace the original variable with ⁇ n ⁇ , and pass the variable expression as a parameter of _t;
- the replacement result is ⁇ i> ⁇ _t('Zhao Liu ⁇ 0 ⁇ contains variables',msg) ⁇ /i> .
- the target text is the attribute of the child node, and the attribute of the child node contains a variable expression, replace the original variable with ⁇ n ⁇ , and pass the variable expression as a parameter of _t;
- the target text is the attribute of the child node, and the attribute of the child node contains a string with single quotes, use ⁇ variable expression and use _t() identification;
- Both the style node and the comment node correspond to the second sub-replacement rule.
- Regarding the content and attributes obtained by traversing in the style node and the comment node keep the content and attributes in the style node and the comment node unchanged.
- the script node corresponds to the third sub-replacement rule, and the third sub-replacement rule is the same as the replacement rule corresponding to the JavaScript source code file.
- the specified source file is a JSP source code file
- the suffix of the file name of the specified source file is .jsp
- the jsp source code file is regarded as an Html tree for traversal, and the content of the specified source file is performed through htmlparser Analyze, traverse, and get the attributes and contents of the child nodes; then, find the attributes and contents of the child nodes through the preset regular expressions, which include the attributes and contents of the child nodes of the preset language, and determine the attributes and contents of the child nodes
- the preset language is included, determine the attributes and content of the child node as the target text to be processed.
- the target text is replaced by the replacement rule corresponding to the jsp source code file.
- the replacement rules corresponding to different types of child nodes in the embodiments of this application may be different; the replacement rules corresponding to the jsp source code files include child replacement rules corresponding to different types of child nodes .
- the replacement rule corresponding to the jsp source code file includes the first sub-replacement rule, the second sub-replacement rule, and the third sub-replacement rule;
- the sub-replacement rules corresponding to the regular node are the first sub-replacement rule, style node and comment node
- the corresponding child replacement rule is the second child replacement rule, and the child replacement rule corresponding to the script node is the third child replacement rule.
- the conventional nodes in the embodiment of the present application are nodes other than the style node, the comment node, and the script node in the Html tree.
- the target text is replaced according to the following methods:
- the preset correspondence between the sub-node type and the sub-replacement rule is the same as the correspondence between the child-node type and the sub-replacement rule when the source code file is an Html source code file, so I won’t repeat it here. .
- the specified source file is a réelle source code file
- the specified source file is determined to be the réelle source code file; then the réelle source code file is regarded as an Html tree for traversal, and the content of the specified source file is performed through htmlparser Analyze, traverse, and get the attributes and contents of the child nodes; then, find the attributes and contents of the child nodes through the preset regular expressions, which include the attributes and contents of the child nodes of the preset language, and determine the attributes and contents of the child nodes When the preset language is included, determine the attributes and content of the child node as the target text to be processed.
- the target text is replaced by the replacement rule corresponding to the réelle source code file.
- the replacement rules corresponding to different types of child nodes in the embodiments of the present application may be different; the replacement rules corresponding to the réelle source code files include child replacement rules corresponding to different types of child nodes .
- the replacement rule corresponding to the réelle source code file contains the first sub-replacement rule, the second sub-replacement rule and the third sub-replacement rule; the sub-replacement rules corresponding to the regular node are the first sub-replacement rule, style node and comment node
- the corresponding child replacement rule is the second child replacement rule, and the child replacement rule corresponding to the script node is the third child replacement rule.
- the conventional nodes in the embodiment of the present application are nodes other than the style node, the comment node, and the script node in the Html tree.
- the target text is replaced according to the following methods:
- the first sub-replacement rule corresponding to a regular node includes but is not limited to:
- the replacement result is ⁇ i> ⁇ _t(' ⁇ ') ⁇ /i>.
- the target text is the content of the child node, and the content of the child node contains the preset language and Html reserved words, after the sentence is segmented according to the reserved words, each paragraph is processed according to the rules of the target text as the content of the child node;
- the target text is ⁇ i> ⁇ contains reserved words ⁇ /i> and the default language is simplified Chinese, the replacement result is ⁇ i> ⁇ _t(' ⁇ ') ⁇ ⁇ _t( 'Reserved words') ⁇ .
- the target text is the content of a child node, and the content of the child node contains a variable expression, replace the original variable with ⁇ n ⁇ , and pass the variable expression as a parameter of _t;
- the replacement result is ⁇ i> ⁇ _t('Zhang San ⁇ 0 ⁇ contains variables',msg) ⁇ /i> .
- Both the style node and the comment node correspond to the second sub-replacement rule.
- Regarding the content and attributes obtained by traversing in the style node and the comment node keep the content and attributes in the style node and the comment node unchanged.
- the script node corresponds to the third sub-replacement rule, and the third sub-replacement rule is the same as the replacement rule corresponding to the JavaScript source code file.
- the embodiment of the present application is a complete flow chart of text replacement when the specified source file is an Html source code file, a jsp source code file, or a réelle source code file.
- Step S401 Read in the specified source file
- Step S402 After determining that the file type of the designated source file is the preset type, traverse the child nodes in the source code file to obtain the attributes and/or content of the child nodes;
- the preset types include JavaScript source code files, Html source code files, jsp source code files, and réelle source code files;
- Step S403 Determine the attribute and/or content of the child node containing the preset language through a preset regular expression
- Step S404 Use the determined attribute and/or content of the child node containing the preset language as the target text to be processed;
- Step S405 Determine the child replacement rule corresponding to the child node in the designated source file according to the preset correspondence between the child node type and the child replacement rule;
- Step S406 Use the determined sub-replacement rule to perform replacement processing on the target text.
- an embodiment of the present application also provides a page information processing device. As shown in FIG. 5, the device includes:
- the file list generating unit 501 is configured to filter out designated source files from the source code files of the page and generate a file list; the designated source files include target text, and the target text is character-encoded using the first language encoding method text;
- the dictionary generating unit 502 is configured to traverse each designated source file contained in the file list, find the target text contained in each designated source file, and generate a target language dictionary;
- the translation unit 503 is configured to translate the target text in the target language dictionary into at least one character encoded by the second designated language encoding method
- the replacement unit 504 is configured to use the replacement rule corresponding to the file type of the specified source file to perform replacement processing on the target text contained in the specified source file.
- the device further includes:
- the single-language dictionary generating unit is used to generate a corresponding single-language dictionary for each character coded in the second designated language encoding mode.
- the file list generating unit is used to:
- the source file identifier is added to the file list.
- the file list generating unit is used to:
- Traverse source files in the selected source folder obtain the specified source file, and generate a file list.
- the device further includes:
- the merging unit is configured to respond to the merging instruction to merge the characters encoded in at least two encoding modes specified in the merging instruction.
- the device further includes:
- the prompt unit is used to determine the unsuccessful translation of the target text after translating the target text in the target language dictionary into at least one character encoded in the second designated language encoding method, and output prompt information, the prompt information including the The successfully translated target text and the corresponding unsuccessfully translated second specified language.
- the device further includes:
- the display unit is used to determine and display the number of successfully translated sentences in the target text after translating the target text in the target language dictionary into at least one character encoded in the second designated language encoding method, and/or,
- the device further includes:
- the filling unit is used for translating the target text in the target language dictionary into at least one character coded in the second designated language encoding mode, and then filling the translation result into the target language dictionary.
- the device further includes:
- the update unit is used to determine whether the new target text has been translated according to the target language dictionary after obtaining the new target text again;
- the new target text is translated, and the translation result is updated to the target language dictionary.
- the device further includes:
- the proofreading unit is used to display the proofreading interface of the translation result after filling the translation result into the target language dictionary
- the translation result in the target language dictionary is updated.
- the computing device may at least include at least one processor and at least one memory.
- the memory stores program code, and when the program code is executed by the processor, the processor executes the steps in the page information processing method according to various exemplary embodiments of the present application described above in this specification.
- the computing device 60 according to this embodiment of the present application will be described below with reference to FIG. 6.
- the computing device 60 shown in FIG. 6 is only an example, and should not bring any limitation to the function and scope of use of the embodiments of the present application.
- the computing device may be, for example, a mobile phone, a tablet computer, or the like.
- the computing device 60 is represented in the form of a general computing device.
- the components of the computing device 60 may include, but are not limited to: the aforementioned at least one processor 601, the aforementioned at least one memory 602, and a bus 603 connecting different system components (including the memory 602 and the processor 601).
- the bus 603 represents one or more of several types of bus structures, including a memory bus or a memory controller, a peripheral bus, a processor, or a local bus using any bus structure among multiple bus structures.
- the memory 602 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 6021 and/or a cache memory 6022, and may further include a read-only memory (ROM) 3023.
- RAM random access memory
- ROM read-only memory
- the memory 602 may also include a program/utility tool 6025 having a set of (at least one) program module 6024.
- program module 6024 includes but is not limited to: an operating system, one or more application programs, other program modules, and program data. Each of the examples or some combination may include the realization of a network environment.
- the computing device 60 may also communicate with one or more external devices 604 (for example, pointing devices, etc.), and may also communicate with one or more devices that enable the user to interact with the computing device 60, and/or communicate with the computing device 60. Any device that communicates with one or more other computing devices (such as routers, modems, etc.) communicates. This communication can be performed through an input/output (I/O) interface 605.
- the computing device 60 may also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet) through the network adapter 606. As shown in the figure, the network adapter 606 communicates with other modules for the computing device 60 through the bus 603.
- LAN local area network
- WAN wide area network
- public network such as the Internet
- computing device 60 can be used in conjunction with the computing device 60, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives And data backup storage system, etc.
- various aspects of the page information processing method provided in this application can also be implemented in the form of a program product, which includes program code.
- the program product runs on a computer device, the program code is used to make The computer device executes the steps of the page information processing method according to various exemplary embodiments of the application described above in this specification, and executes the steps shown in FIGS. 1-4.
- the program product can adopt any combination of one or more readable media.
- the readable medium may be a readable signal medium or a readable storage medium.
- the readable storage medium may be, for example, but not limited to, an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: electrical connections with one or more wires, portable disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Type programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
- the page information processing method of the embodiment of the present application may use a portable compact disk read-only memory (CD-ROM) and include program codes, and may run on a computing device.
- CD-ROM portable compact disk read-only memory
- the program product of this application is not limited to this.
- the readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or combined with an instruction execution system, device, or device.
- the readable signal medium may include a data signal propagated in baseband or as a part of a carrier wave, and readable program code is carried therein. This propagated data signal can take many forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the foregoing.
- the readable signal medium may also be any readable medium other than a readable storage medium, and the readable medium may send, propagate, or transmit a program for use by or in combination with the instruction execution system, apparatus, or device.
- the program code contained on the readable medium can be transmitted by any suitable medium, including, but not limited to, wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
- the program code used to perform the operations of this application can be written in any combination of one or more programming languages.
- Programming languages include object-oriented programming languages—such as Java, C++, etc., as well as conventional procedural programming. Language-such as "C" language or similar programming language.
- the program code may be executed entirely on the user computing device, partly executed on the user equipment, executed as an independent software package, partly executed on the user computing device and partly executed on the remote computing device, or entirely on the remote computing device or server Executed on.
- the remote computing device can be connected to a user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (for example, using Internet services) Provider to connect via the Internet).
- LAN local area network
- WAN wide area network
- an external computing device for example, using Internet services
- the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
- a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
- These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device. Realize the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
- These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
- the instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Artificial Intelligence (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Machine Translation (AREA)
Abstract
一种页面信息处理方法、装置及存储介质,涉及金融科技领域,该方法通过从页面的源代码文件中筛选出包含目标文本的指定源文件,生成文件清单(101);遍历所述文件清单中包含的各指定源文件,查找各指定源文件中包含的目标文本,生成目标语言字典(102);将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符(103);以及,使用指定源文件的文件类型对应的替换规则,对所述指定源文件中包含的目标文本进行替换处理(104)。该方法使得在页面的开发阶段中,可以自动完成源代码中需要翻译的语句的搜索,并对这些语句自动进行翻译,并且可以自动的对目标文本进行替换处理,提高了页面开发的效率。
Description
相关申请的交叉引用
本申请要求在2019年06月27日提交中国专利局、申请号为201910569892.X、申请名称为“页面信息处理方法、装置及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及金融科技(Fintech)领域,尤其涉及一种页面信息处理方法、装置及存储介质。
随着计算机技术的发展,越来越多的技术(互联网,大数据、分布式、区块链Blockchain、人工智能等)应用在金融领域,传统金融业正在逐步向金融科技(Fintech)转变,在互联网行业,Web(World Wide Web,万维网)前端开发的编程语言以及编程框架越来越丰富,为了满足不同用户的需求,在Web前端页面展示时需要进行多语言展示。
在页面(Web)的开发中,现有的技术方案中通常包括页面开发阶段和页面运行阶段。在页面的开发过程中,通常需要用户人工从源代码中寻找的多语言化展示的语句。例如,寻找中文语句。然后,人工将该中文语句替换为需要语种的距离,例如英文语句。
然而,一个大型Web应用的源代码往往涉及几百个源代码文件,涉及几千项需要多语言化展示的语句,采用人工从源代码文件中寻找需要多语言化展示的语句并进行修改,要耗费大量的人力,并且周期较长。
发明内容
本申请实施例提供一种页面信息处理方法、装置及存储介质,用于解决现有技术中在页面开发阶段,采用人工从源代码文件中寻找需要多语言化展示的语句并进行修改,要耗费大量的人力,并且周期较长的问题。
本申请实施例的第一方面公开了一种页面信息处理方式,所述方法包括:
从页面的源代码文件中筛选出指定源文件,生成文件清单;所述指定源文件中包括目标文本,所述目标文本为采用第一语种编码方式进行字符编码的文本;
遍历所述文件清单中包含的各指定源文件,查找各指定源文件中包含的目标文本,生成目标语言字典;
将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符;以及,
使用指定源文件的文件类型对应的替换规则,对所述指定源文件中包含的目标文本进行替换处理。
可选的,所述方法还包括:
分别为每种采用第二指定语种编码方式编码的字符生成对应的单语言字典。
可选的,从页面的源代码文件中筛选出指定源文件,生成文件清单,包括:
调用页面打包插件遍历当前项目使用的源文件名称列表,筛选出文件后缀为指定后缀的源文件集合;
针对所述源文件集合中的各源文件,若确认该源文件中包含所述目标文本,则将该源文件标识添加到文件清单中。
可选的,从页面的源代码文件中筛选出指定源文件,生成文件清单,包括:
调用命令行工具响应于针对源文件夹的选定操作指令,确定选定的源文件夹;
在所述选定的源文件夹中遍历源文件,获得所述指定源文件,并生成文件清单。
可选的,分别为每种采用第二指定语种编码方式编码的字符生成对应的单语言字典之后,所述方法还包括:
响应于合并指令,将所述合并指令中指定的至少两种编码方式编码的字符进行合并。
可选的,将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,还包括:
确定未成功翻译的目标文本,输出提示信息,所述提示信息中包括未成功翻译的目标文本以及对应的未成功翻译的第二指定语种。
可选的,将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,所述方法还包括:
确定目标文本中,被成功翻译的语句数量并显示,和/或,
确定翻译进度并显示。
可选的,将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,所述方法还包括:
将翻译结果填充到所述目标语言字典中。
可选的,所述方法还包括:
再次得到新目标文本后,根据所述目标语言字典确定该新目标文本是否已被翻译;
若未被翻译,则翻译该新目标文本,并将翻译结果更新到所述目标语言字典中。
可选的,将翻译结果填充到所述目标语言字典中之后,所述方法还包括:
显示翻译结果校对界面;
根据对所述校对界面的操作指令,更新所述目标语言字典中的翻译结果。
在本申请实施例的第二方面公开了一种页面信息处理装置,所述装置:
文件清单生成单元,用于从页面的源代码文件中筛选出指定源文件,生成文件清单;所述指定源文件中包括目标文本,所述目标文本为采用第一语种编码方式进行字符编码的文本;
字典生成单元,用于遍历所述文件清单中包含的各指定源文件,查找各指定源文件中包含的目标文本,生成目标语言字典;
翻译单元,用于将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符;
替换单元,用于使用指定源文件的文件类型对应的替换规则,对所述指定源文件中包含的目标文本进行替换处理。
可选的,所述装置还包括:
单语言字典生成单元,用于分别为每种采用第二指定语种编码方式编码的字符生成对应的单语言字典。
可选的,所述文件清单生成单元,用于:
调用页面打包插件遍历当前项目使用的源文件名称列表,筛选出文件后缀为指定后缀的源文件集合;
针对所述源文件集合中的各源文件,若确认该源文件中包含所述目标文本,则将该源文件标识添加到文件清单中。
可选的,所述文件清单生成单元,用于:
调用命令行工具响应于针对源文件夹的选定操作指令,确定选定的源文件夹;
在所述选定的源文件夹中遍历源文件,获得所述指定源文件,并生成文件清单。
可选的,所述装置还包括:
合并单元,用于响应于合并指令,将所述合并指令中指定的至少两种编码方式编码的字符进行合并。
可选的,所述装置还包括:
提示单元,用于在将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,确定未成功翻译的目标文本,输出提示信息,所述提示信息中包括未成功翻译的目标文本以及对应的未成功翻译的第二指定语种。
可选的,所述装置还包括:
显示单元,用于在将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,确定目标文本中,被成功翻译的语句数量并显示,和/或,
确定翻译进度并显示。
可选的,所述装置还包括:
填充单元,用于将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,将翻译结果填充到所述目标语言字典中。
可选的,所述装置还包括:
更新单元,用于再次得到新目标文本后,根据所述目标语言字典确定该新目标文本是否已被翻译;
若未被翻译,则翻译该新目标文本,并将翻译结果更新到所述目标语言字典中。
可选的,所述装置还包括:
校对单元,用于将翻译结果填充到所述目标语言字典中之后,显示翻译结果校对界面;
根据对所述校对界面的操作指令,更新所述目标语言字典中的翻译结果。
本申请实施例的第三方面公开了一种计算机可读介质,存储有计算机可执行指令,该计算机可执行指令用于执行上述页面信息处理方法。
本申请实施例的第四方面公开了一种计算机装置,该计算机装置包括:至少一个处理器;以及与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行上述页面信息处理方法。
本申请实施例的第五方面公开了一种计算机程序产品,包括计算机程序或指令,当计算机程序或指令被执行时,实现至少一个处理器能够执行上述页面信息处理方法。
本申请为了提高页面开发的效率,从页面的源代码文件中筛选出包含目标文本的指定 源文件,生成文件清单;遍历所述文件清单中包含的各指定源文件,查找各指定源文件中包含的目标文本,生成目标语言字典;将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符;以及,使用指定源文件的文件类型对应的替换规则,对所述指定源文件中包含的目标文本进行替换处理。该方法使得在页面的开发阶段中,可以自动完成源代码中需要翻译的语句的搜索,并对这些语句自动进行翻译,并且可以自动的对目标文本进行替换处理,减少了人工介入的环节,能够有效提高页面开发的效率。
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例中所需要使用的附图作简单地介绍,显而易见地,下面所介绍的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例中页面信息处理的方法流程示意图;
图2为本申请实施例中提供的显示翻译进度的界面示意图;
图3为本申请实施例中页面信息处理的方法的另一流程示意图;
图4为本申请实施例中页面信息处理的方法的再一流程示意图;
图5为本申请实施例中页面信息处理的装置的结构框图;
图6为本申请实施例中提供的计算机装置的结构示意图。
为解决现有技术中在页面开发阶段,采用人工从源代码文件中寻找需要多语言化展示的语句并进行修改,要耗费大量的人力,并且周期较长的问题。本申请实施例提供了一种页面信息处理方法、装置及存储介质。为了更好的理解本申请实施例提供的技术方法,这里对本方案的基本原理作一下简单说明:
本申请为了提高页面开发的效率,可以先确定目标文本(例如中文字符文本),确定目标文本后,从页面的源代码文件中筛选出包含目标文本的指定源文件,生成文件清单;遍历所述文件清单中包含的各指定源文件,查找各指定源文件中包含的目标文本,生成目标语言字典;将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符;以及,使用指定源文件的文件类型对应的替换规则,对所述指定源文件中包含的目标文本进行替换处理。该方法使得在页面的开发阶段中,可以自动完成源代码中需要翻译的语句的搜索,并对这些语句自动进行翻译,并且可以自动的对目标文本进行替换处理,减少了人工介入的环节,能够有效提高页面开发的效率。此外,本申请中文件清单、目标语言字典以及源文件都是分步产出的。这样,便于用户在每个步骤之间进行人工介入,以便于人工修改生成的文件清单,字典和源代码文件。使得银行等金融机构的Web应用的开发运维更加高效,保证了银行各种业务运维平台正常使用,从而实现各种业务(如贷款业务、存款业务等)的正常开展。
下面结合附图对本申请实施例提供的页面信息处理的方法做进一步说明。如图1所示,为该方法的流程示意图,包括以下步骤:
步骤101,从页面的源代码文件中筛选出指定源文件,生成文件清单;所述指定源文 件中包括目标文本,所述目标文本为采用第一语种编码方式进行字符编码的文本。
在页面的开发阶段,可以使用插件或者命令行工具,通过一定的筛选规则从页面的源代码文件中自动筛选出指定源文件,生成文件清单,具体调用插件及命令行工具生成文件清单的过程在后文会有详细说明。
步骤102,遍历所述文件清单中包含的各指定源文件,查找各指定源文件中包含的目标文本,生成目标语言字典。
步骤103,将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符。
步骤104,使用指定源文件的文件类型对应的替换规则,对所述指定源文件中包含的目标文本进行替换处理。
例如,可以将源代码文件中需要进行多语言展示的文本替换为包含翻译标识的文本。例如,源代码文件中需要进行多语言展示的文本对应的语言为中文,假设需要进行多语言展示的文本为‘中文语句’,则替换后的包含翻译标识的文本为_t(换中文语句’文。关于如何确定目标文本,以及如何进行替换处理将在后文中详述,这里暂不赘述。
在一个实施例中,从页面的源代码文件中筛选出指定源文件,生成文件清单可实施为两种方式,具体实施时,用户可根据实际需求选用相应的方式:
方式一、具体实施时可包括步骤A1-步骤A2:
步骤A1,调用页面打包插件遍历当前项目使用的源文件名称列表,筛选出文件后缀为指定后缀的源文件集合;
步骤A2,针对所述源文件集合中的各源文件,若确认该源文件中包含所述目标文本,则将该源文件标识添加到文件清单中。
在页面的开发阶段,可以调用页面打包插件遍历当前项目使用的源文件的名称列表,通过筛选获取指定后缀的源文件,得到源文件集合。然后,通过正则表达式判断筛选出的源文件中是否包含目标文本,目标文本可以是中文,还可以是日语等非拉丁字符语言的其他语种。如果筛选出的源文件中包含目标文本,那么就将该源文件的标识添加到文件清单中。调用页面打包插件可以自动获取文件清单,提高开发效率。
方式二、具体实施时可包括步骤B1-步骤B2:
步骤B1,调用命令行工具响应于针对源文件夹的选定操作指令,确定选定的源文件夹;
步骤B2,在选定的文件夹中遍历源文件,获得指定源文件,并生成文件清单。
在页面的开发阶段,该命令行工具可支持include和exclude两种操作指令。其中,include用于指定需要处理的文件夹,exclude用于指定不需要处理的文件夹或文件。include和exclude可分别支持多项文件路径,也可支持通配符。比如,include=src/*.js,dir/some.jsp,src/*.js,dir/bame.html表示支持两项文件路径,分别为src/*.js,dir/some.jsp和src/*.js,dir/bame.html,两项文件路径可用“,”区分开来。
具体实施时,可以单独使用include和exclude两种操作指令,也可以嵌套使用两种操作指令。嵌套使用include和exclude的操作指令,例如是,在源文件夹A-E中,使用include操作指令筛选出include命令中的源文件夹A,假设该源文件夹A包括编号为1-100的100个子文件,然后再使用exclude操作命令将筛选出的100个子文件中不需要的文件进行剔除,比如使用exclude操作命令剔除掉编号为1-50的子文件,那么源文件夹A中编号51-100的子文件即为确定选定的源文件。在确定选定的源文件中进行遍历,筛选出指定文件类型且包含目 标文本的源文件生成文件清单。比如选出后缀名分别为.veu、.js、.htlm、.jsp的源文件,然后通过正则表达式判断源文件中是否包含目标文本。如果筛选出的源文件中包含目标文本,那么就将该源文件的标识添加到文件清单中。调用命令行工具可以自动获取文件清单,也可以减少人工创建文件清单等重复开发的工作过程。
在一个实施例中,将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,该方法还包括:确定目标文本中,被成功翻译的语句数量并显示,和/或,确定翻译进度并显示。
如图2所示,为以中文为目标文本进行翻译时,显示内容的界面示意图。该界面中表示共有2073项中文语句需要翻译,且持续更新当前进度并显示。在翻译完成后还可显示成功翻译的语句数,以及翻译结果保存的地址。
当然,需要说明的是,翻译进度还可以进度条的形式显示,本申请实施例并不对显示翻译进度的具体方式进行限定。
采用该实施方式显示翻译语句数和/或翻译进度,以便于用户了解翻译过程的进展情况。
在一个实施例中,还可以在将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,将翻译结果填充到所述目标语言字典中。也即该目标语言字典中包括了需要翻译的目标文本以及各目标文本的翻译结果。
实施时,填充后的目标语言字典可如表1所示:表1中,目标文本编号可以是全局的唯一标识,用于唯一表示一条需要翻译的目标文本。后两列的为两种语言的翻译结果。需要说明的是,表1仅用于示例性说明本申请实施例,并不用于限定本申请实施例。
表1
| 目标文本编号 | 目标文本 | 英文翻译结果 | 日语翻译结果 |
| 1 | 语句1 | **** | **** |
| … | … | **** | **** |
| n | 语句n | **** | **** |
在替换处理后,待页面显示阶段,可以根据源文件从表1所示字典中查找到对应的翻译结果进行页面展示。
此外,可选的,在得到翻译结果后,可以显示翻译结果校对界面供校对;然后根据对所述校对界面的操作指令,更新所述目标语言字典中的翻译结果。也即,可以将翻译结果展示出来,并提供校对界面。然后根据校对人员在校对界面中的操作,对翻译结果进行更新和维护。也即,可以将自动翻译结果交由专业的翻译人员进行校对,并由翻译人员对翻译结果进行修改。
在一个实施例中,为了满足用户的不同需求,本申请实施例中还可以分别为每种采用第二指定语种编码方式编码的字符生成对应的单语言字典。也即,在将各指定源文件中包含的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符后,可以根据用户的需要将每种指定语种编码方式编码的字符生成的对应的单语言字典。比如,在得到表1所述的多语言的字典后,可以将该字典分割为分别包含各语言的源文件。包括含有英文编码字符的单语言字典、含有日文编码字符的单语言字典,也可进一步生成含有中文的单语言字典。将第二指定语种编码方式编码的字符按照语种类别分成不同的源文件,便于用户展开对不同语种的管理工作,同时也便于在校对时可以按照不同语种的进行校对。
此外,为进一步满足实际的用户需求,本申请实施例中还可以响应于合并指令,将所述合并指令中指定的至少两种编码方式编码的字符进行合并,也即将不同语种翻译结果进行合并。其中,将哪些语种的翻译结果进行合并可以由用户指定。
在一个实施例中,将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,还包括:确定未成功翻译的目标文本,输出提示信息,所述提示信息中包括未成功翻译的目标文本以及对应的未成功翻译的第二指定语种。
为便于理解,这里继续以表1为例。针对每个目标文本,可遍历其英文翻译结果是否为空,若为空,则说明相应目标文本未成功翻译成英文,若假设语句1未成功翻译成英文,可以发出语句1未得到翻译结果的提示信息。以便于校对时可以根据提示人工翻译语句1,从而保证各需要翻译的目标文本都能有对应的翻译结果。
在一个实施例中,为了便于增量更新如表1所述的字典,本申请实施例中,还可以再次得到新目标文本后,根据所述目标语言字典确定该新目标文本是否已被翻译;若未被翻译,则翻译该新目标文本,并将翻译结果更新到所述目标语言字典中。例如,初次生成含有多语种的目标语言字典之后,还可以按需采用本申请实施例提供的方案,采用前述的页面打包插件或命令行工具,并根据正则表达式获得新目标文本。获得的新目标文本如果已被翻译,则可以不进行翻译,避免重复翻译,如果未被翻译,则可以进行翻译,得到的翻译结果可增量更新到目标语言字典中。
为便于理解,下文将对如何确定目标文本和如何进行替换处理做进一步说明。
本申请实施例在指定源文件的文件类型不同时,从源代码文件中确定目标文本的方式也不相同,下面针对不同类型的源代码文件分别进行说明。
一、源代码文件为JavaScript源代码文件。
在指定源文件为JavaScript源代码文件时,根据下列方式从源代码文件中确定需要处理的目标文本:
通过预设的正则表达式对所述指定源文件的内容进行匹配,确定备选的字符串;将所述备选的字符串中包含所述预设语言的字符串作为所述需要处理的目标文本。
实施中,在指定源文件的文件名的后缀为.js时,确定指定源文件为JavaScript源代码文件;然后,通过预设的正则表达式对指定源文件的内容进行匹配,例如,预设的正则表达式可以是:
new RegExp('\\/\\*[\\s\\S]*?\\*\\/|([^:]|^)\\/\\/.*','gm')
该正则表达式可以匹配.js文件里的单行注释和多行注释,各个注释块前后的代码块可视为独立的代码块,在各个独立的代码块中,用正则表达式匹配行内成对出现的单引号、双引号,得到单引号或双引号为起止的字符串,该字符串即为备选的字符串。
在确定出备选的字符串之后,可以采用预设的正则表达式判断备选的字符串中是否包含预设语言,例如,在预设语言为中文简体时,用正则表达式判断备选字符串内是否包含中文简体的字符串。在确定备选的字符串中包含预设语言时,确定该备选字符串为需要处理的目标文本。
需要说明的是,在从指定源文件中确定备选的字符串使用的预设的正则表达式、与判断备选的字符串中是否包含预设语言使用的预设的正则表达式为不同的正则表达式。
另外,本申请实施例从指定源文件中可以确定出一个或多个需要处理的目标文本。
从指定源文件确定出目标文本后,使用JavaScript源代码文件对应的替换规则对目标文 本进行替换处理。
一种可选的实施方式为,替换规则为将目标文本替换为包含翻译标识的文本。
需要说明的是,在确定备选字符串中包含预设语言之后,还需要判断备选字符串的上下文中是否包含翻译标识或保留标识,在确定不包含翻译标识和保留标识之后,将备选字符串替换为包含翻译标识的文本;在确定包含翻译标识或保留标识之后,则保留该备选字符串。
例如,预先设置翻译标识为_t(),预先设置保留标识为_r();
示例的,.js文件对应的替换规则如下:
以单引号或双引号为起止的字符串如‘张三’,则替换规则为添加_t()翻译标识,替换结果为_t(识张三’三;
若字符串的上下文中包含了翻译标识的字符串,如_t(串李四’四,则该字符串保留;
若字符串的上下文中包含了保留标识的字符串,如_r(串王五’五,则保留该字符串。
如图3所示,本申请实施例在指定源文件为JavaScript源代码文件时文本替换的完整流程图。
步骤S301:读入指定源文件;
步骤S302:确定指定源文件的文件类型为预设类型后,通过预设的正则表达式对源代码文件的内容进行匹配,确定备选的字符串;
其中,预设类型包括JavaScript源代码文件、Html源代码文件、jsp源代码文件、vue源代码文件;
步骤S303:将备选的字符串中包含预设语言的字符串作为需要处理的目标文本;
步骤S304:确定指定源文件的文件类型对应的替换规则;
步骤S305:使用确定的替换规则对目标文本进行替换处理。
二、指定源文件为Html源代码文件。
在指定源文件为Html源代码文件时,根据下列方式从源代码文件中确定需要处理的目标文本:
遍历所述指定源文件中的子节点,得到子节点的属性和/或内容;通过预设的正则表达式确定包含所述预设语言的子节点的属性和/或内容,并将确定出的包含所述预设语言的子节点的属性和/或内容作为所述需要处理的目标文本。
实施中,在指定源文件的文件名的后缀为.html时,确定指定源文件为Html源代码文件;然后,通过htmlparser对指定源文件的内容进行解析,遍历并得到子节点的属性和内容;然后,通过预设的正则表达式找到子节点的属性和内容中包含预设语言的子节点的属性和内容,在确定子节点的属性和内容中包含预设语言时,确定该子节点的属性和内容为需要处理的目标文本。
从指定源文件中确定出目标文本后,使用Html源代码文件对应的替换规则对目标文本进行替换处理。
由于指定源文件中包含不同类型的子节点,本申请实施例中不同类型的子节点对应的替换规则可能不同;Html源代码文件对应的替换规则中包含不同子节点类型对应的子替换规则。
例如,Html源代码文件对应的替换规则中包含第一子替换规则、第二子替换规则和第三子替换规则;其中常规节点对应的子替换规则为第一子替换规则,style节点和注释节点 对应子替换规则为第二子替换规则,脚本节点对应的子替换规则为第三子替换规则。
需要说明的是,本申请实施例的常规节点为Html树中除了style节点、注释节点和脚本节点之外的节点。
在指定源文件为Html源代码文件时,根据下列方式对目标文本进行替换处理:
根据预先设定的子节点类型和子替换规则的对应关系,确定所述源代码文件中的子节点对应的子替换规则;使用所述子节点对应的子替换规则对所述目标文本进行替换处理。
例如,常规节点对应的第一子替换规则包括但不限于:
1、若目标文本为子节点的内容,则使用{{}}变量表达式以及使用翻译标识(其中,翻译标识可以为_t()标识);
假设目标文本为<i>张三</i>,则替换结果为<i>{{_t('张三')}}</i>。
2、若目标文本为子节点的属性,则使用{{}}变量表达式以及使用_t()标识;
假设目标文本为<i attr="李四"></i>,则替换结果为<i attr="{{_t('李四')}}"></i>。
3、若目标文本为子节点的内容,且子节点的内容中含有预设语言和Html保留字,则按保留字断句之后,每一段按目标文本为子节点的内容的规则处理;
假设目标文本为<i>王五 ;包含保留字</i>,预设语言为中文简体,则替换结果为<i>{{_t('王五')}} ;{{_t('保留字')}}。
4、若目标文本为子节点的内容,且子节点的内容中含有变量表达式,则将原变量替换为{n},并将变量表达式作为_t的参数传入;
假设目标文本为<i>赵六{{msg}}包含变量</i>,则替换结果为<i>{{_t('赵六{0}包含变量',msg)}}</i>。
5、若目标文本为子节点的属性,且子节点的属性中含有变量表达式,则将原变量替换为{n},并将变量表达式作为_t的参数传入;
假设目标文本为<i prop="属性{{msg}}包含变量"></i>,则替换结果为<i prop="{{_t('属性{0}包含变量',msg)}}"></i>。
6、若目标文本为子节点的属性,且子节点的属性中含有带单引号的字符串,则使用{{}}变量表达式且使用_t()标识;
假设<i prop="'字符串属性'"></i>,则替换结果为<i prop="{{_t('字符串属性')}}"></i>。
style节点和注释节点均对应第二子替换规则,针对style节点和注释节点中遍历得到的内容和属性,保持style节点和注释节点中的内容和属性不变。
脚本节点对应第三子替换规则,第三子替换规则与JavaScript源代码文件对应的替换规则相同。
三、指定源文件为jsp源代码文件。
在指定源文件为jsp源代码文件时,根据下列方式从指定源文件中确定需要处理的目标文本:
遍历所述源代码文件中的子节点,得到子节点的属性和/或内容;通过预设的正则表达式确定包含所述预设语言的子节点的属性和/或内容,并将确定出的包含所述预设语言的子节点的属性和/或内容作为所述需要处理的目标文本。
实施中,在指定源文件的文件名的后缀为.jsp时,确定指定源文件为jsp源代码文件;然后将jsp源代码文件视为Html树来进行遍历,通过htmlparser对指定源文件的内容进行解析,遍历并得到子节点的属性和内容;然后,通过预设的正则表达式找到子节点的属性和 内容中包含预设语言的子节点的属性和内容,在确定子节点的属性和内容中包含预设语言时,确定该子节点的属性和内容为需要处理的目标文本。
从指定源文件中确定出目标文本后,使用jsp源代码文件对应的替换规则对目标文本进行替换处理。
由于待处理源代码文件中包含不同类型的子节点,本申请实施例中不同类型的子节点对应的替换规则可能不同;jsp源代码文件对应的替换规则中包含不同子节点类型对应的子替换规则。
例如,jsp源代码文件对应的替换规则中包含第一子替换规则、第二子替换规则和第三子替换规则;其中常规节点对应的子替换规则为第一子替换规则,style节点和注释节点对应子替换规则为第二子替换规则,脚本节点对应的子替换规则为第三子替换规则。
需要说明的是,本申请实施例的常规节点为Html树中除了style节点、注释节点和脚本节点之外的节点。
在指定源文件为jsp源代码文件时,根据下列方式对目标文本进行替换处理:
根据预先设定的子节点类型和子替换规则的对应关系,确定所述源代码文件中的子节点对应的子替换规则;使用所述子节点对应的子替换规则对所述目标文本进行替换处理。
指定源文件为jsp源代码文件时,预先设定的子节点类型和子替换规则的对应关系与源代码文件为Html源代码文件时的子节点类型和子替换规则的对应关系相同,在此不再赘述。
四、指定源文件为vue源代码文件。
在指定源文件为vue源代码文件时,根据下列方式从指定源文件中确定需要处理的目标文本:
遍历所述源代码文件中的子节点,得到子节点的属性和/或内容;通过预设的正则表达式确定包含所述预设语言的子节点的属性和/或内容,并将确定出的包含所述预设语言的子节点的属性和/或内容作为所述需要处理的目标文本。
实施中,在指定源文件的文件名的后缀为.vue时,确定指定源文件为vue源代码文件;然后将vue源代码文件视为Html树来进行遍历,通过htmlparser对指定源文件的内容进行解析,遍历并得到子节点的属性和内容;然后,通过预设的正则表达式找到子节点的属性和内容中包含预设语言的子节点的属性和内容,在确定子节点的属性和内容中包含预设语言时,确定该子节点的属性和内容为需要处理的目标文本。
从指定源文件中确定出目标文本后,使用vue源代码文件对应的替换规则对目标文本进行替换处理。
由于待处理源代码文件中包含不同类型的子节点,本申请实施例中不同类型的子节点对应的替换规则可能不同;vue源代码文件对应的替换规则中包含不同子节点类型对应的子替换规则。
例如,vue源代码文件对应的替换规则中包含第一子替换规则、第二子替换规则和第三子替换规则;其中常规节点对应的子替换规则为第一子替换规则,style节点和注释节点对应子替换规则为第二子替换规则,脚本节点对应的子替换规则为第三子替换规则。
需要说明的是,本申请实施例的常规节点为Html树中除了style节点、注释节点和脚本节点之外的节点。
在指定源文件为vue源代码文件时,根据下列方式对目标文本进行替换处理:
根据预先设定的子节点类型和子替换规则的对应关系,确定所述源代码文件中的子节 点对应的子替换规则;使用所述子节点对应的子替换规则对所述目标文本进行替换处理。
例如,常规节点对应的第一子替换规则包括但不限于:
1、若目标文本为子节点的内容,则使用{{}}变量表达式以及使用翻译标识(其中,翻译标识可以为_t()标识);
假设目标文本为<i>张三</i>,则替换结果为<i>{{_t('张三')}}</i>。
2、若目标文本为子节点的属性,则使用{{}}变量表达式以及使用_t()标识;
假设目标文本为<i attr="李四"></i>,则替换结果为<i attr="{{_t('李四')}}"></i>。
3、若目标文本为子节点的属性,且子节点的属性以冒号开始,则使用_t()标识;
假设目标文本为<i:attr="'王五'"></i>,则替换结果为<i:attr="_t('王五')"></i>
4、若目标文本为子节点的属性,且子节点的属性以v-开始,则使用_t()标识;
假设目标文本为<i v-if="'赵六'"></i>,则替换结果为<i v-if="_t('赵六')"></i>
5、若目标文本为子节点的内容,且子节点的内容中含有预设语言和Html保留字,则按保留字断句之后,每一段按目标文本为子节点的内容的规则处理;
假设目标文本为<i>钱七 ;包含保留字</i>,预设语言为中文简体,则替换结果为<i>{{_t('钱七')}} ;{{_t('保留字')}}。
6、若目标文本为子节点的内容,且子节点的内容中含有变量表达式,则将原变量替换为{n},并将变量表达式作为_t的参数传入;
假设目标文本为<i>张三{{msg}}包含变量</i>,则替换结果为<i>{{_t('张三{0}包含变量',msg)}}</i>。
style节点和注释节点均对应第二子替换规则,针对style节点和注释节点中遍历得到的内容和属性,保持style节点和注释节点中的内容和属性不变。
脚本节点对应第三子替换规则,第三子替换规则与JavaScript源代码文件对应的替换规则相同。
如图4所示,本申请实施例在指定源文件为Html源代码文件、jsp源代码文件或vue源代码文件时文本替换的完整流程图。
步骤S401:读入指定源文件;
步骤S402:确定指定源文件的文件类型为预设类型后,遍历源代码文件中的子节点,得到子节点的属性和/或内容;
其中,预设类型包括JavaScript源代码文件、Html源代码文件、jsp源代码文件、vue源代码文件;
步骤S403:通过预设的正则表达式确定包含所述预设语言的子节点的属性和/或内容;
步骤S404:将确定出的包含预设语言的子节点的属性和/或内容作为需要处理的目标文本;
步骤S405:根据预先设定的子节点类型和子替换规则的对应关系,确定指定源文件中的子节点对应的子替换规则;
步骤S406:使用确定的子替换规则对目标文本进行替换处理。
基于与页面信息处理方法相同的发明构思,本申请实施例还提供了一种页面信息处理装置,如图5所示,该装置包括;
文件清单生成单元501,用于从页面的源代码文件中筛选出指定源文件,生成文件清单;所述指定源文件中包括目标文本,所述目标文本为采用第一语种编码方式进行字符编 码的文本;
字典生成单元502,用于遍历所述文件清单中包含的各指定源文件,查找各指定源文件中包含的目标文本,生成目标语言字典;
翻译单元503,用于将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符;
替换单元504,用于使用指定源文件的文件类型对应的替换规则,对所述指定源文件中包含的目标文本进行替换处理。
可选的,所述装置还包括:
单语言字典生成单元,用于分别为每种采用第二指定语种编码方式编码的字符生成对应的单语言字典。
可选的,所述文件清单生成单元,用于:
调用页面打包插件遍历当前项目使用的源文件名称列表,筛选出文件后缀为指定后缀的源文件集合;
针对所述源文件集合中的各源文件,若确认该源文件中包含所述目标文本,则将该源文件标识添加到文件清单中。
可选的,所述文件清单生成单元,用于:
调用命令行工具响应于针对源文件夹的选定操作指令,确定选定的源文件夹;
在所述选定的源文件夹中遍历源文件,获得所述指定源文件,并生成文件清单。
可选的,所述装置还包括:
合并单元,用于响应于合并指令,将所述合并指令中指定的至少两种编码方式编码的字符进行合并。
可选的,所述装置还包括:
提示单元,用于在将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,确定未成功翻译的目标文本,输出提示信息,所述提示信息中包括未成功翻译的目标文本以及对应的未成功翻译的第二指定语种。
可选的,所述装置还包括:
显示单元,用于在将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,确定目标文本中,被成功翻译的语句数量并显示,和/或,
确定翻译进度并显示。
可选的,所述装置还包括:
填充单元,用于将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,将翻译结果填充到所述目标语言字典中。
可选的,所述装置还包括:
更新单元,用于再次得到新目标文本后,根据所述目标语言字典确定该新目标文本是否已被翻译;
若未被翻译,则翻译该新目标文本,并将翻译结果更新到所述目标语言字典中。
可选的,所述装置还包括:
校对单元,用于将翻译结果填充到所述目标语言字典中之后,显示翻译结果校对界面;
根据对所述校对界面的操作指令,更新所述目标语言字典中的翻译结果。
在介绍了本申请示例性实施方式的页面信息处理方法及装置,接下来,介绍根据本申 请的另一示例性实施方式的计算装置。
所属技术领域的技术人员能够理解,本申请的各个方面可以实现为系统、方法或程序产品。因此,本申请的各个方面可以具体实现为以下形式,即:完全的硬件实施方式、完全的软件实施方式(包括固件、微代码等),或硬件和软件方面结合的实施方式,这里可以统称为“电路”、“模块”或“系统”。
在一些可能的实施方式中,根据本申请的实施例,计算装置可以至少包括至少一个处理器、以及至少一个存储器。其中,存储器存储有程序代码,当程序代码被处理器执行时,使得处理器执行本说明书上述描述的根据本申请各种示例性实施方式的页面信息处理方法中的步骤。
下面参照图6来描述根据本申请的这种实施方式的计算装置60。图6显示的计算装置60仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。该计算装置例如可以是手机、平板电脑等。
如图6所示,计算装置60以通用计算装置的形式表现。计算装置60的组件可以包括但不限于:上述至少一个处理器601、上述至少一个存储器602、连接不同系统组件(包括存储器602和处理器601)的总线603。
总线603表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器、外围总线、处理器或者使用多种总线结构中的任意总线结构的局域总线。
存储器602可以包括易失性存储器形式的可读介质,例如随机存取存储器(RAM)6021和/或高速缓存存储器6022,还可以进一步包括只读存储器(ROM)3023。
存储器602还可以包括具有一组(至少一个)程序模块6024的程序/实用工具6025,这样的程序模块6024包括但不限于:操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。
计算装置60也可以与一个或多个外部设备604(例如指向设备等)通信,还可与一个或者多个使得用户能与计算装置60交互的设备通信,和/或与使得该计算装置60能与一个或多个其它计算装置进行通信的任何设备(例如路由器、调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口605进行。并且,计算装置60还可以通过网络适配器606与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器606通过总线603与用于计算装置60的其它模块通信。应当理解,尽管图中未示出,可以结合计算装置60使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理器、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。
在一些可能的实施方式中,本申请提供的页面信息处理方法的各个方面还可以实现为一种程序产品的形式,其包括程序代码,当程序产品在计算机设备上运行时,程序代码用于使计算机设备执行本说明书上述描述的根据本申请各种示例性实施方式的页面信息处理方法的步骤,执行如图1-4中所示的步骤。
程序产品可以采用一个或多个可读介质的任意组合。可读介质可以是可读信号介质或者可读存储介质。可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑 盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。
本申请实施方式的页面信息处理方法可以采用便携式紧凑盘只读存储器(CD-ROM)并包括程序代码,并可以在计算装置上运行。然而,本申请的程序产品不限于此,在本文件中,可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。
可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了可读程序代码。这种传播的数据信号可以采用多种形式,包括——但不限于——电磁信号、光信号或上述的任意合适的组合。可读信号介质还可以是可读存储介质以外的任何可读介质,该可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。
可读介质上包含的程序代码可以用任何适当的介质传输,包括——但不限于——无线、有线、光缆、RF等等,或者上述的任意合适的组合。
可以以一种或多种程序设计语言的任意组合来编写用于执行本申请操作的程序代码,程序设计语言包括面向对象的程序设计语言—诸如Java、C++等,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算装置上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户计算装置上部分在远程计算装置上执行、或者完全在远程计算装置或服务器上执行。在涉及远程计算装置的情形中,远程计算装置可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算装置,或者,可以连接到外部计算装置(例如利用因特网服务提供商来通过因特网连接)。
应当注意,尽管在上文详细描述中提及了装置的若干单元或子单元,但是这种划分仅仅是示例性的并非强制性的。实际上,根据本申请的实施方式,上文描述的两个或更多单元的特征和功能可以在一个单元中具体化。反之,上文描述的一个单元的特征和功能可以进一步划分为由多个单元来具体化。
此外,尽管在附图中以顺序描述了本申请方法的操作,但是,这并非要求或者暗示必须按照该顺序来执行这些操作,或是必须执行全部所示的操作才能实现期望的结果。附加地或备选地,可以省略某些步骤,将多个步骤合并为一个步骤执行,和/或将一个步骤分解为多个步骤执行。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
Claims (16)
- 一种页面信息处理方法,其特征在于,所述方法包括:从页面的源代码文件中筛选出指定源文件,生成文件清单;所述指定源文件中包括目标文本,所述目标文本为采用第一语种编码方式进行字符编码的文本;遍历所述文件清单中包含的各指定源文件,查找各指定源文件中包含的目标文本,生成目标语言字典;将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符;以及,使用指定源文件的文件类型对应的替换规则,对所述指定源文件中包含的目标文本进行替换处理。
- 根据权利要求1所述的方法,其特征在于,所述方法还包括:分别为每种采用第二指定语种编码方式编码的字符生成对应的单语言字典。
- 根据权利要求1所述的方法,其特征在于,从页面的源代码文件中筛选出指定源文件,生成文件清单,包括:调用页面打包插件遍历当前项目使用的源文件名称列表,筛选出文件后缀为指定后缀的源文件集合;针对所述源文件集合中的各源文件,若确认该源文件中包含所述目标文本,则将该源文件标识添加到文件清单中。
- 根据权利要求1所述的方法,其特征在于,从页面的源代码文件中筛选出指定源文件,生成文件清单,包括:调用命令行工具响应于针对源文件夹的选定操作指令,确定选定的源文件夹;在所述选定的源文件夹中遍历源文件,获得所述指定源文件,并生成文件清单。
- 根据权利要求2所述的方法,其特征在于,分别为每种采用第二指定语种编码方式编码的字符生成对应的单语言字典之后,所述方法还包括:响应于合并指令,将所述合并指令中指定的至少两种编码方式编码的字符进行合并。
- 根据权利要求1所述的方法,其特征在于,将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,还包括:确定未成功翻译的目标文本,输出提示信息,所述提示信息中包括未成功翻译的目标文本以及对应的未成功翻译的第二指定语种。
- 根据权利要求1所述的方法,其特征在于,将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,所述方法还包括:确定目标文本中,被成功翻译的语句数量并显示,和/或,确定翻译进度并显示。
- 根据权利要求1-7任一项所述的方法,其特征在于,将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符之后,所述方法还包括:将翻译结果填充到所述目标语言字典中。
- 根据权利要求8所述的方法,其特征在于,所述方法还包括:再次得到新目标文本后,根据所述目标语言字典确定该新目标文本是否已被翻译;若未被翻译,则翻译该新目标文本,并将翻译结果更新到所述目标语言字典中。
- 根据权利要求8所述的方法,其特征在于,将翻译结果填充到所述目标语言字典中之后,所述方法还包括:显示翻译结果校对界面;根据对所述校对界面的操作指令,更新所述目标语言字典中的翻译结果。
- 一种页面信息处理装置,其特征在于,所述方法装置:文件清单生成单元,用于从页面的源代码文件中筛选出指定源文件,生成文件清单;所述指定源文件中包括目标文本,所述目标文本为采用第一语种编码方式进行字符编码的文本;字典生成单元,用于遍历所述文件清单中包含的各指定源文件,查找各指定源文件中包含的目标文本,生成目标语言字典;翻译单元,用于将目标语言字典中的目标文本翻译成至少一种采用第二指定语种编码方式编码的字符;替换单元,用于使用指定源文件的文件类型对应的替换规则,对所述指定源文件中包含的目标文本进行替换处理。
- 根据权利要求11所述的装置,其特征在于,所述装置还包括:单语言字典生成单元,用于分别为每种采用第二指定语种编码方式编码的字符生成对应的单语言字典。
- 根据权利要求11所述的装置,其特征在于,所述文件清单生成单元,用于:调用页面打包插件遍历当前项目使用的源文件名称列表,筛选出文件后缀为指定后缀的源文件集合;针对所述源文件集合中的各源文件,若确认该源文件中包含所述目标文本,则将该源文件标识添加到文件清单中。
- 根据权利要求11-13任一项所述的装置,其特征在于,所述文件清单生成单元,用于:调用命令行工具响应于针对源文件夹的选定操作指令,确定选定的源文件夹;在所述选定的源文件夹中遍历源文件,获得所述指定源文件,并生成文件清单。
- 一种计算机可读介质,存储有计算机可执行指令,其特征在于,所述计算机可执行指令用于执行如权利要求1-10中任一项权利要求所述的方法。
- 一种计算机装置,其特征在于,包括:至少一个处理器;以及与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如权利要求1-10中任一权利要求所述的方法。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910569892.XA CN110263130A (zh) | 2019-06-27 | 2019-06-27 | 页面信息处理方法、装置及存储介质 |
| CN201910569892.X | 2019-06-27 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2020259084A1 true WO2020259084A1 (zh) | 2020-12-30 |
Family
ID=67922549
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2020/088477 Ceased WO2020259084A1 (zh) | 2019-06-27 | 2020-04-30 | 页面信息处理方法、装置及存储介质 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN110263130A (zh) |
| WO (1) | WO2020259084A1 (zh) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115687839A (zh) * | 2022-11-08 | 2023-02-03 | 平安壹钱包电子商务有限公司 | 页面代码转换方法、装置、计算机设备及可读存储介质 |
| CN116243919A (zh) * | 2023-01-09 | 2023-06-09 | 浪潮通用软件有限公司 | 一种解释渲染和代码渲染的界面渲染方法、设备及介质 |
Families Citing this family (21)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110263130A (zh) * | 2019-06-27 | 2019-09-20 | 深圳前海微众银行股份有限公司 | 页面信息处理方法、装置及存储介质 |
| CN110879933A (zh) * | 2019-10-17 | 2020-03-13 | 中国第一汽车股份有限公司 | 一种元件清单文件的处理方法、装置、终端及存储介质 |
| CN112988290B (zh) * | 2019-12-12 | 2024-01-26 | 腾讯科技(深圳)有限公司 | 多语言配置文件的生成方法、页面显示方法、装置及终端 |
| CN111158682A (zh) * | 2019-12-27 | 2020-05-15 | 四川天邑康和通信股份有限公司 | 一种用于路由器的id化多语言页面设计方法及系统 |
| CN111729313A (zh) * | 2020-05-06 | 2020-10-02 | 完美世界(北京)软件科技发展有限公司 | 语言的配置方法及装置、存储介质、电子装置 |
| CN113705252A (zh) * | 2020-05-22 | 2021-11-26 | 北京沃东天骏信息技术有限公司 | 一种web系统的实现方法和装置 |
| CN113760821B (zh) * | 2020-06-22 | 2024-07-16 | 北京京东乾石科技有限公司 | 一种文件转换的方法及装置 |
| CN112347142B (zh) * | 2020-11-17 | 2024-03-01 | 上海幻电信息科技有限公司 | 数据处理方法及装置 |
| CN112487334A (zh) * | 2020-11-30 | 2021-03-12 | 深圳壹账通智能科技有限公司 | 用于前端页面语言翻译的方法、装置、计算机设备和介质 |
| CN112507729B (zh) * | 2020-12-15 | 2025-05-02 | 康键信息技术(深圳)有限公司 | 页面中文本翻译方法、装置、计算机设备和存储介质 |
| CN113761171A (zh) * | 2021-01-26 | 2021-12-07 | 北京沃东天骏信息技术有限公司 | 一种辅助编程方法、装置、电子设备及存储介质 |
| CN113190308A (zh) * | 2021-04-20 | 2021-07-30 | 北京异乡旅行网络科技有限公司 | 海外租房应用翻译文本的确定方法、装置和设备 |
| CN115617340A (zh) * | 2021-07-13 | 2023-01-17 | 奇安信科技集团股份有限公司 | 页面数据处理方法、装置以及计算机设备 |
| CN113792557A (zh) * | 2021-09-14 | 2021-12-14 | 北京沃东天骏信息技术有限公司 | 语言文件的生成方法和装置 |
| CN113988018A (zh) * | 2021-10-27 | 2022-01-28 | 腾讯科技(上海)有限公司 | 数据转换方法、装置及计算机可读存储介质 |
| CN114238227A (zh) * | 2021-11-17 | 2022-03-25 | 珠海许继芝电网自动化有限公司 | 软件项目源代码中文查找方法、系统及介质 |
| CN114237806B (zh) * | 2021-12-29 | 2024-03-12 | 瀚云科技有限公司 | 一种页面信息的显示方法、装置、电子设备及存储介质 |
| CN114385871A (zh) * | 2022-01-14 | 2022-04-22 | 建信金融科技有限责任公司 | 一种字符串的替换方法、装置、设备及存储介质 |
| CN115202695A (zh) * | 2022-07-19 | 2022-10-18 | 平安付科技服务有限公司 | 一种针对Vue系统的文案更新方法及装置 |
| CN115167859A (zh) * | 2022-07-26 | 2022-10-11 | 深圳市元征科技股份有限公司 | 一种odx语言库生成方法、装置、设备及介质 |
| CN121412329A (zh) * | 2024-07-23 | 2026-01-27 | 顺丰科技有限公司 | 文字提取方法、装置、电子设备和存储介质 |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101667118A (zh) * | 2008-09-02 | 2010-03-10 | 华为技术有限公司 | 多语言版本的开发、替换方法及装置 |
| CN104317788A (zh) * | 2014-11-03 | 2015-01-28 | 上海鼎讯电子有限公司 | Android多国语言翻译方法和装置 |
| CN108399064A (zh) * | 2017-02-07 | 2018-08-14 | 南京南瑞继保电气有限公司 | 基于Qt开发的多语言词条生成方法 |
| US20180357055A1 (en) * | 2017-06-07 | 2018-12-13 | Syntel, Inc. | System and method for computer language migration |
| CN110263130A (zh) * | 2019-06-27 | 2019-09-20 | 深圳前海微众银行股份有限公司 | 页面信息处理方法、装置及存储介质 |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20020177992A1 (en) * | 2001-03-29 | 2002-11-28 | International Business Machines Corporation | Method and system for translation management of human language text |
| US20180024848A1 (en) * | 2013-12-02 | 2018-01-25 | Crowdin, Inc. | Translatable Texts Identification in In-Context Localization Utilizing Pseudo-Language and an External Server |
| US10078504B1 (en) * | 2015-09-16 | 2018-09-18 | Amazon Technologies, Inc. | Automated software internationalization and localization |
| CN107402746B (zh) * | 2016-05-20 | 2020-08-04 | 阿里巴巴集团控股有限公司 | 一种自动生成代码文件的方法及装置 |
| CN107357568A (zh) * | 2017-06-12 | 2017-11-17 | 北京天健通泰科技有限公司 | 一种基于多国语标签的原语言替换方法 |
-
2019
- 2019-06-27 CN CN201910569892.XA patent/CN110263130A/zh active Pending
-
2020
- 2020-04-30 WO PCT/CN2020/088477 patent/WO2020259084A1/zh not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101667118A (zh) * | 2008-09-02 | 2010-03-10 | 华为技术有限公司 | 多语言版本的开发、替换方法及装置 |
| CN104317788A (zh) * | 2014-11-03 | 2015-01-28 | 上海鼎讯电子有限公司 | Android多国语言翻译方法和装置 |
| CN108399064A (zh) * | 2017-02-07 | 2018-08-14 | 南京南瑞继保电气有限公司 | 基于Qt开发的多语言词条生成方法 |
| US20180357055A1 (en) * | 2017-06-07 | 2018-12-13 | Syntel, Inc. | System and method for computer language migration |
| CN110263130A (zh) * | 2019-06-27 | 2019-09-20 | 深圳前海微众银行股份有限公司 | 页面信息处理方法、装置及存储介质 |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115687839A (zh) * | 2022-11-08 | 2023-02-03 | 平安壹钱包电子商务有限公司 | 页面代码转换方法、装置、计算机设备及可读存储介质 |
| CN116243919A (zh) * | 2023-01-09 | 2023-06-09 | 浪潮通用软件有限公司 | 一种解释渲染和代码渲染的界面渲染方法、设备及介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN110263130A (zh) | 2019-09-20 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2020259084A1 (zh) | 页面信息处理方法、装置及存储介质 | |
| CN111241454B (zh) | 一种生成网页代码的方法、系统和装置 | |
| CN109933752B (zh) | 一种导出电子文档的方法和装置 | |
| CN113139390B (zh) | 一种应用于代码字符串的语言转换方法和装置 | |
| US11146286B2 (en) | Compression of JavaScript object notation data using structure information | |
| CN111831384B (zh) | 语言切换方法和装置、设备及存储介质 | |
| CN110275712B (zh) | 一种文本替换方法、装置及设备 | |
| CN112069129A (zh) | 基于国产cpu的配置文件格式转换方法、装置及介质 | |
| CN114386373A (zh) | 一种代码语句转换方法、装置、计算机设备及存储介质 | |
| CN112287266B (zh) | 一种网页配置的处理方法及其装置、设备及存储介质 | |
| CN108153522B (zh) | 基于模型转换由midcore生成Spark和Hadoop程序代码的方法 | |
| CN106708475A (zh) | 一种北向数据转换方法和装置 | |
| CN115794858A (zh) | 查询语句处理方法、装置、设备及存储介质 | |
| CN119476217B (zh) | 编辑文本的优化方法、装置、电子设备及存储介质 | |
| CN116521169A (zh) | 代码处理方法、设备、存储介质及程序产品 | |
| CN109947711A (zh) | 一种对ios项目开发过程中的多语言文件自动化管理方法 | |
| CN113792557A (zh) | 语言文件的生成方法和装置 | |
| CN119848045A (zh) | 基于大模型的数据血缘解析方法、装置、设备和介质 | |
| CN118193567A (zh) | 生成查询语句和查询业务数据的方法、装置、设备及介质 | |
| CN117112536A (zh) | 数据库迁移方法、装置、设备及存储介质 | |
| CN116107543A (zh) | 一种基于vue工程代码项目的项目变更方法和变更装置 | |
| CN113760821B (zh) | 一种文件转换的方法及装置 | |
| CN114840479A (zh) | 一种硬编码处理方法和装置 | |
| CN114489639A (zh) | 文件生成方法、装置、设备及存储介质 | |
| CN114168189A (zh) | 一种Vue项目代码的翻译方法、设备及介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20832082 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 22.04.2022) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 20832082 Country of ref document: EP Kind code of ref document: A1 |