Application program localization method and device, equipment and storage medium
By obtaining the text information to be localized of the application and using the intelligent learning model for automatic conversion processing, the problem of low efficiency of application localization in the existing technology is solved, and a fast and efficient localization process is achieved.
Patent Information
- Application Number
- CN202410738802.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-08-30
AI Technical Summary
Application localization in the existing technology is inefficient, requires a lot of human resources and time, and cannot effectively meet the needs of global users.
By obtaining the text information to be localized of the application, the target conversion language information is determined based on the user's historical conversion information, and the intelligent learning model is used to automatically convert the text information to be localized to generate the target text information of the application.
The target text information of the application can be automatically generated without a large amount of human resources and time, which significantly improves the efficiency of application localization.
Smart Images

Figure CN118569271A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an application localization method, device, equipment and storage medium. Background Art
[0002] With the rapid development of mobile Internet, more and more applications need to be localized for global users. Localized resources in applications are very important components that can improve the user experience and market competitiveness of applications.
[0003] At present, the existing method is for developers to manually process applications and generate localized resources for applications. However, due to the large amount of application data, manual processing requires a lot of human resources and time, resulting in low efficiency of application localization.
[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of the present invention is to provide an application localization method, device, equipment and storage medium, aiming to solve the technical problem that manual processing in the prior art requires a lot of human resources and time, resulting in low efficiency of application localization.
[0006] To achieve the above object, the present invention provides an application localization method, the method comprising:
[0007] Get the text information to be localized of the application;
[0008] Determine the target conversion language information based on the user's historical conversion information;
[0009] The text information to be localized is converted based on the target conversion language information to obtain target text information corresponding to the application program.
[0010] Optionally, before the step of obtaining the text information to be localized of the application, the step further includes:
[0011] Obtain an application that needs localization processing, and query string file information storing string resources in the source code of the application;
[0012] Parsing each string in the string file information, converting each string into a tree structure, and obtaining a parsed file;
[0013] Traversing the labels of each sub-element on the tree structure of the parsed file, and taking the sub-element labeled with a preset label as the target sub-element;
[0014] Determine the attributes of the target sub-element and the text content corresponding to the attributes;
[0015] Determine a key value according to the attribute, and determine associated content corresponding to the key value based on the text content;
[0016] The key value and the associated content are used as text information to be localized.
[0017] Optionally, the step of converting the text information to be localized based on the target conversion language information to obtain target text information corresponding to the application program includes:
[0018] Parsing and extracting the text information to be localized to obtain the text information to be converted including the key value and the associated content;
[0019] The key value and the associated content of the text information to be converted are converted based on the target conversion program and the target conversion language information to obtain the target text information corresponding to the application program.
[0020] Optionally, before the step of converting the key value and the associated content of the text information to be converted based on the target conversion program and the target conversion language information to obtain the target text information corresponding to the application, the step further includes:
[0021] Acquire an original corpus, wherein the original corpus includes an initial text and a translation text corresponding to the initial text;
[0022] Training the initial neural network model based on the original corpus to obtain an intelligent learning model with semantic analysis function;
[0023] The intelligent learning model is integrated into the initial open source engine to obtain a target conversion program.
[0024] Optionally, the step of training the initial neural network model based on the original corpus to obtain an intelligent learning model with semantic analysis function includes:
[0025] Preprocessing the original corpus, converting the format of the original corpus into a format corresponding to model training, and obtaining preprocessed data;
[0026] Convert each text element in the preprocessed data into a corresponding numerical value by performing text encoding on the preprocessed data to obtain encoded data;
[0027] The initial machine learning model is trained according to the encoded data to obtain an intelligent learning model with semantic analysis function.
[0028] Optionally, after the step of converting the key value and the associated content of the text information to be converted based on the target conversion program and the target conversion language information to obtain the target text information corresponding to the application, the step further includes:
[0029] Obtaining translated key values and translated associated content in the localized resource file;
[0030] Determining whether the translated associated content already exists in the resource file of the target conversion language information;
[0031] If yes, determining a target key value in the resource file corresponding to the translated key value, and replacing the associated content corresponding to the target key value with the translated associated content;
[0032] If not, the translated key value and the translated associated content are added to the resource file.
[0033] Optionally, after the step of converting the text information to be localized based on the target conversion language information to obtain the target text information corresponding to the application, the step further includes:
[0034] Obtaining pre-built test data and standard translation text corresponding to the test data;
[0035] Translate the test data using the open source translation engine to obtain a translation result;
[0036] Determining whether the translation result contains preset keywords in the standard translation text, and detecting whether the semantics of the test result is consistent with the semantics of the standard translation text;
[0037] When the test result contains the preset keyword and the test result is consistent with the standard translation text, generating a test report with correct translation;
[0038] When the test result does not include the preset keyword, or the test result is inconsistent with the standard translation text, a test report of translation error is generated.
[0039] In addition, to achieve the above-mentioned purpose, the present invention also proposes an application localization device, the device comprising:
[0040] A text acquisition module is used to obtain the text information to be localized of the application;
[0041] A language determination module, used to determine target conversion language information based on the user's historical conversion information;
[0042] The text translation module is used to convert the text information to be localized based on the target conversion language information to obtain the target text information corresponding to the application.
[0043] In addition, to achieve the above-mentioned purpose, the present invention also proposes an application localization device, which includes: a memory, a processor, and an application localization program stored in the memory and executable on the processor, wherein the application localization program is configured to implement the steps of the application localization method described above.
[0044] In addition, to achieve the above objective, the present invention further proposes a storage medium, on which an application localization program is stored, and when the application localization program is executed by a processor, the steps of the application localization method described above are implemented.
[0045] The present invention provides an application localization method, device, equipment and storage medium. The method obtains text information to be localized of the application; determines target conversion language information based on the user's historical conversion information; and converts the text information to be localized based on the target conversion language information to obtain the target text information corresponding to the application. The present invention converts the text information to be localized with the target conversion language information determined by the user's historical conversion information, thereby automatically generating the target text information corresponding to the application, without requiring a large amount of human resources and time, and effectively improving the efficiency of application localization. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A schematic diagram of the structure of an application localization device for a hardware operating environment involved in an embodiment of the present invention;
[0047] Figure 2 It is a flowchart of a first embodiment of the application localization method of the present invention;
[0048] Figure 3 It is a flowchart of a second embodiment of the application localization method of the present invention;
[0049] Figure 4 It is a flowchart of a third embodiment of the application localization method of the present invention;
[0050] Figure 5 This is an overall flow chart of a third embodiment of the application localization method of the present invention;
[0051] Figure 6 FIG. 1 is a structural block diagram of a first embodiment of an application localization device according to the present invention.
[0052] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0053] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0054] Reference Figure 1 , Figure 1 A schematic diagram of the structure of an application localization device in a hardware operating environment according to an embodiment of the present invention.
[0055] like Figure 1 As shown, the application localization device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0056] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the application localization device, and may include more or less components than those shown in the figure, or combine certain components, or arrange the components differently.
[0057] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and an application localization program.
[0058] exist Figure 1In the application localization device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the application localization device of the present invention can be set in the application localization device, and the application localization device calls the application localization program stored in the memory 1005 through the processor 1001, and executes the application localization method provided by the embodiment of the present invention.
[0059] The embodiment of the present invention provides an application localization method, referring to Figure 2 , Figure 2 FIG. 4 is a flow chart of a first embodiment of the application localization method of the present invention.
[0060] In this embodiment, the application localization method includes the following steps:
[0061] Step S10: Acquire text information to be localized in the application.
[0062] It should be noted that the execution subject of the method of this embodiment can be a computing service device with application localization, network communication and program running functions, such as a mobile phone, a tablet computer, a personal computer, etc., and can also be other electronic devices that achieve the same or similar functions. The following embodiment and the following embodiments are described using the above-mentioned application localization device (hereinafter referred to as the localization device).
[0063] It is understandable that the above text information to be localized may be text content information that needs to be translated to adapt to different language environments. The text information to be localized may be stored in a resource file of the application.
[0064] In a specific implementation, the localization device may parse the application program and extract the text information to be localized from the resource file.
[0065] Furthermore, in this embodiment, before step S10, the following steps are further included:
[0066] Step S11: obtaining an application program to be localized, and searching for string file information storing string resources in the source code of the application program.
[0067] It should be noted that the above string file information can be used to define the strings used in all interfaces of the application, including labels, text on buttons, etc.
[0068] In a specific implementation, the above-mentioned localization device can obtain the application that needs to be localized, traverse the source code of the application, and query the string file information storing string resources in the source code. For example, when the application is an Android application, the String.xml file can be queried in the source code of the Android application. By using the String.xml file, the strings in the application can be easily managed and modified, avoiding hard-coding string literals directly in the code, thereby improving the maintainability and flexibility of the code.
[0069] Step S12: parsing each character string in the character string file information, converting each character string into a tree structure, and obtaining a parsed file.
[0070] In a specific implementation, the localization device may extract the string file, and use built-in modules, such as the xml.etree.ElementTree module, to parse each string in the string file information, and parse the string into an XML tree structure, which may be the parsed file, and each sub-element of the XML tree structure may be the parsed string.
[0071] Step S13: traverse the labels of each sub-element on the tree structure of the parsed file, and take the sub-element tagged with a preset label as the target sub-element.
[0072] It should be noted that the above-mentioned preset label can be a label that identifies the content that needs to be translated in the application.
[0073] In a specific implementation, the localization device may traverse each sub-element of the tree structure, check whether the tag name of each sub-element is a preset tag (such as a string tag), and then use the sub-element tagged with the preset tag as the target sub-element.
[0074] Step S14: Determine the attributes of the target sub-element and the text content corresponding to the attributes.
[0075] It should be noted that the attribute of the target sub-element can be a key-value pair, which is used to provide additional information for the element. The value of the attribute is the identifier of the element or the name of the identifier.
[0076] It is understandable that the above text content may be a plain text content associated with the target sub-element and the attribute, that is, text without any tags or attributes, representing the actual data or information of the target sub-element.
[0077] Step S15: determining a key value according to the attribute, and determining associated content corresponding to the key value based on the text content.
[0078] Step S16: taking the key value and the associated content as text information to be localized.
[0079] In a specific implementation, the localization device can determine the key value corresponding to the attribute, and use the text content corresponding to the attribute as the associated content associated with the key value. The key value can be a unique identifier for retrieving the associated content associated with it. Then, the key value and the associated content associated with the key value can be used as the text information to be localized that needs to be translated, thereby realizing automatic extraction of the text to be localized, avoiding the tedious work of manual extraction, and effectively improving the efficiency of generating localization resource files.
[0080] Step S20: Determine target conversion language information based on the user's historical conversion information.
[0081] It should be noted that the above selection record may be a record of the user selecting a language to use from a plurality of preset language information in the past. The preset language information may be pre-set and supported language information.
[0082] In a specific implementation, the localization device can determine the number of times each preset language is used from the historical conversion information, and then sort the preset language information according to the number of times, and use a graphical user interface (Graphical UserInterface, GUI) library, such as Tkinter, to create a multiple-selection panel to display each preset language based on the sorting result, and the preset language information with the most times of use is ranked first. According to the display result, the preset language information ranked first can be selected as the target conversion language information for localization this time, that is, the preset language information with the most user selections is used as the target conversion language information, thereby providing a better user experience.
[0083] Step S30: converting the text to be localized based on the target conversion language information to obtain target text information corresponding to the application.
[0084] In a specific implementation, the localization device may use the target conversion language information to convert the text information to be localized, translate the text content of the text information to be localized into text content of the target conversion language, and obtain the target text information corresponding to the application.
[0085] Furthermore, in this embodiment, step S30 includes:
[0086] The text information to be localized is parsed and extracted to obtain the text information to be converted including the key value and the associated content.
[0087] The key value and the associated content of the text information to be converted are converted based on the target conversion program and the target conversion language information to obtain the target text information corresponding to the application program.
[0088] It should be noted that the above-mentioned target conversion program can be a query corresponding to a translation engine integrated with an intelligent learning model, and the intelligent learning model is a neural network model with semantic analysis function.
[0089] In a specific implementation, the above-mentioned localization device can pre-train the initial neural network model to obtain an intelligent learning model with semantic analysis function, and then integrate the intelligent learning model into the open source translation engine to obtain a target conversion program. When translating, the localization device can call the target conversion program to translate the key values and associated contents of the text information to be converted in the target conversion language information, translate the key values and associated contents into the key values and associated contents under the target conversion language information, obtain the translated key values and translated associated contents, and use the translated key values and translated associated contents as the target text information, thereby automatically and accurately realizing the localization of the application.
[0090] This embodiment obtains the text information to be localized of the application; determines the target conversion language information based on the user's historical conversion information; and converts the text information to be localized based on the target conversion language information to obtain the target text information corresponding to the application. This embodiment converts the text information to be localized based on the target conversion language information determined by the user's historical conversion information, thereby automatically generating the target text information corresponding to the application, without requiring a large amount of human resources and time, and effectively improving the efficiency of application localization.
[0091] refer to Figure 3 , Figure 3 FIG. 4 is a flow chart of a second embodiment of the application localization method of the present invention.
[0092] Based on the first embodiment, in this embodiment, before the step of converting the key value and the associated content of the text information to be converted based on the target conversion program and the target conversion language information to obtain the target text information corresponding to the application, the step further includes:
[0093] Step S31: obtaining an original corpus, wherein the original corpus includes an initial text and a translation text corresponding to the initial text.
[0094] It should be noted that the initial text may be a file input by a user or in a previous translation process. Accordingly, the translation file may be an accurate translation text corresponding to the initial text, and the translation file may be obtained by the user manually translating the initial text.
[0095] In a specific implementation, the localization device can obtain a large-scale original corpus of different contexts. The large-scale original corpus contains a large amount of text data, covering various contexts and fields, so that the trained intelligent learning model can learn the diversity and complexity of the language from a wider range of language usage scenarios, thereby improving the translation accuracy of the intelligent learning model.
[0096] In addition, the above-mentioned original corpus can be set with initial text that has continuity, that is, there is a contextual relationship between sentences, so that the trained intelligent learning model can better understand the contextual information, and can learn the association and semantic relationship between words, as well as the usage and meaning of words in different contexts, so that the intelligent learning model has semantic analysis capabilities.
[0097] Step S32: training the initial neural network model based on the original corpus to obtain an intelligent learning model with semantic analysis function.
[0098] Step S33: Integrate the intelligent learning model into the initial open source engine to obtain a target conversion program.
[0099] It should be noted that the above-mentioned initial neural network model can be a neural network model applied to natural language processing and having grammatical analysis and lexical analysis, such as a sequence-to-sequence (Seq2Seq) model, a Transformer model, etc.
[0100] In a specific implementation, the localization device can use the original corpus to construct training samples to train the initial neural network model, thereby obtaining an intelligent learning model with semantic analysis capabilities. The intelligent information model can be integrated into the initial open source engine to obtain the target conversion program.
[0101] Furthermore, in this embodiment, step S32 includes:
[0102] Step S321: preprocessing the original corpus, converting the format of the original corpus into a format corresponding to model training, and obtaining preprocessed data.
[0103] In a specific implementation, the above-mentioned localization device can preprocess the original corpus, including cleaning data (removing irrelevant characters, punctuation marks, etc.), word segmentation, and building a vocabulary, etc., so as to convert the format of the original corpus into a format corresponding to model training, so that the obtained preprocessed data can be suitable for model training.
[0104] Step S322: Convert each text element in the preprocessed data into a corresponding numerical value by performing text encoding on the preprocessed data to obtain encoded data.
[0105] In a specific implementation, the localization device may perform text encoding on the preprocessed data, and map each text element, ie, each word or phrase, in the preprocessed data into a numerical form of an integer or a vector to obtain encoded data.
[0106] Step S323: training the initial neural network model according to the encoded data to obtain an intelligent learning model with semantic analysis function.
[0107] In a specific implementation, the localization device can train the initial neural network model based on the encoded data in numerical form. During the training process, the model will learn how to generate the corresponding translation based on the input text. After the training is completed, an intelligent learning model with semantic analysis function can be obtained, so that the intelligent learning model can better understand the semantics and context of the source language, thereby providing more accurate and natural translation results. This helps to eliminate semantic errors, improve the accuracy of language expression, and provide translations that are more in line with the cultural habits of the target language.
[0108] It should be noted that before the model training begins, the model parameters are initialized. The parameters can be randomly generated or obtained from a pre-trained model, which is not limited in this embodiment. In each training iteration, the predicted output of the model is calculated by forward propagation, and then the loss between the predicted output of the model and the true translation is calculated, wherein the loss function for calculating the loss can be a cross entropy loss function, which is used to measure the difference between the translation predicted by the model and the true translation. After obtaining the loss, the gradient of the loss to the model parameters can be calculated by reverse insertion. Finally, an optimization algorithm, such as a stochastic gradient descent algorithm, is used to calculate the gradient updated model parameters, and the gradient updated model parameters are updated to the initial machine learning model to obtain an intelligent learning model.
[0109] Furthermore, in this embodiment, after step S323, the following steps are further included:
[0110] Step S3231: receiving user feedback information based on previous translation results, and collecting error information in previous translation processes.
[0111] In a specific implementation, users can analyze the output results of the intelligent learning model in previous translation processes. If the user believes that the result is not optimal or there is an object, the user can provide feedback on the best result. In addition, the user can also mark the results with translation errors, and the localization device can automatically collect the marked content as error information.
[0112] Step S3232: iteratively train the intelligent learning model based on the feedback information and the error information to optimize the intelligent learning model.
[0113] In a specific implementation, the above-mentioned localization device can iteratively train the intelligent information model based on feedback information and error information to optimize the intelligent information model, make the translation result of the intelligent information model more accurate, improve the accuracy of application localization, and then improve the translation quality to meet user needs and expectations.
[0114] It should be understood that the initial text and the translated text of the initial text in each preset language may be configured so that the trained intelligent information model supports translation in each preset language.
[0115] Furthermore, in this embodiment, after the step of converting the key value and the associated content of the text information to be converted based on the target conversion program and the target conversion language information to obtain the target text information corresponding to the application, the step further includes:
[0116] Step S301: Obtain the translated key values and translated associated contents in the localized resource file.
[0117] In a specific implementation, after translating the key values and associated contents in the text to be localized into the target conversion language information, the localization device may extract the translated key values and the translated associated contents corresponding to the translated key values.
[0118] Step S302: determining whether the translated associated content already exists in the resource file of the target conversion language information.
[0119] It should be noted that the resource file may be a file storing text content of the target language for conversion into language information. Each preset language may be provided with a corresponding resource file to store text content in the respective language.
[0120] In a specific implementation, the localization device may determine whether the translated associated content already exists in the resource file of the target conversion language information, so as to avoid different associated content for the same key value.
[0121] Step S303: If yes, determine the target key value in the resource file corresponding to the translated key value, and replace the associated content corresponding to the target key value with the translated associated content.
[0122] In a specific implementation, when the localization device determines that the translated associated content already exists in the resource file of the target conversion language information, it can determine the target key value in the resource file that belongs to the same translated key value as the translated associated content, and then replace the associated content under the target key value with the translated associated content, thereby avoiding different associated contents for the same key value and improving the text storage accuracy.
[0123] Step S303 ′: If not, then adding the translated key value and the translated associated content to the resource file.
[0124] In a specific implementation, when the localization device determines that the translated associated content does not exist in the resource file of the target conversion language information, it can add the translated key value and the translated associated content to the resource file, so that the translation result can be queried by the user, thereby improving the user experience.
[0125] In addition, the localized resource files in the preset language can also be versioned. Specifically, version control tools (such as Git) can be used in the localized device to perform version management, and the differences between the local version and the remote version of the localized resource files can be compared. If the latest remote version exists, it is determined that the localized resource files need to be updated. In addition, the modification time of the localized resource files can also be detected. If the file modification time is detected to be later than the last submission time, it is determined that the localized resource files need to be updated. When the localized resource files need to be updated, the version can be updated in time to ensure that the localized resource files are always kept up to date and provide a better user experience.
[0126] refer to Figure 4 , Figure 4 FIG. 4 is a flow chart of a third embodiment of the application localization method of the present invention.
[0127] Based on the above embodiments, in this embodiment, after step S30, the following steps are further included:
[0128] Step S40: obtaining pre-constructed test data and standard translation text corresponding to the test data.
[0129] It should be noted that the test data may be pre-selected text data for testing translation quality. Correspondingly, the standard translation text may be a correct translation of the test data.
[0130] In a specific implementation, the localization device may obtain test data pre-constructed by a user and a standard translation text corresponding to the test data input by the user, for detecting translation quality.
[0131] Step S50: translating the test data through the open source translation engine to obtain a translation result.
[0132] In a specific implementation, the localization device may call the open source translation engine, and use the intelligent learning model in the open source translation engine to translate the test data to obtain the translation result of the test data.
[0133] Step S60: determining whether the translation result contains preset keywords in the standard translation text, and detecting whether the semantics of the test result is consistent with the semantics of the standard translation text.
[0134] In a specific implementation, the localization device can determine whether the translation result contains preset keywords in the standard translation text, perform language analysis on the translation result, and detect whether the semantics of the translation result is consistent with the semantics of the standard translation text, so as to detect whether the translation result retains the semantics of the original text, thereby realizing the detection of translation quality.
[0135] Step S70: When the test result includes the preset keyword and the test result is consistent with the standard translation text, a test report with correct translation is generated.
[0136] Step S70': when the test result does not include the preset keyword, or the test result is inconsistent with the standard translation text, a translation error test report is generated.
[0137] In a specific implementation, when the localization device determines that the test result contains preset keywords and the test result is consistent with the standard translation text, the translation can be determined to be correct and a test report of correct translation can be generated. When it is determined that the translation result omits some preset keywords in the standard translation text, the omitted preset keywords can be generated in the test report. When it is detected that there is a large deviation between the semantics of the translation result and the semantics of the standard translation text, when the degree of deviation is greater than the set deviation threshold, the translation error can be determined, a test report of the incorrect translation can be generated, and the translation error information can be marked in the test report, and the final test report can be fed back to the user.
[0138] In addition, each preset language may be used to perform translation in sequence to implement translation quality detection for each preset language.
[0139] It should be understood that this embodiment can automatically discover translation errors and omissions, provide higher translation quality control, and promptly notify developers to repair translation errors and omissions when they exist, thereby ensuring continuous improvement in translation quality.
[0140] For ease of understanding, refer to Figure 5 This is for illustration only, but does not limit this solution. Figure 5 This is an overall flow chart of the third embodiment of the application localization method of the present invention. Figure 5In, taking Android application as an example, at the beginning of the process, first determine the Android application that needs to be localized, then install the Python parser and related dependent libraries, the localization device can use the Python program to read and parse the String.xml file, extract the key (key value) and value (associated content) that need to be translated, and then select the target language that needs to be translated from each preset language, wherein a GUI library (such as Tkinter) can be used to create a multiple-selection panel to display each preset language, and each preset language is personalized and sorted according to the user's selection record. After selecting the target language that needs to be translated, an open source translation engine can be called to obtain a translation result, wherein an intelligent learning model is established using a corpus, and the corpus may include proper nouns or mistranslated vocabulary, and then the intelligent learning model is integrated into the initial translation engine to obtain an open source translation engine. After obtaining the translation result using the open source translation engine, the translation result is written into the corresponding file in the corresponding key, value format, and the generated localized resource file can be added to the version control using the git management project, and the automated testing tool can be integrated to detect the translation quality.
[0141] In addition, an embodiment of the present invention further provides a storage medium, on which an application localization program is stored. When the application localization program is executed by a processor, the steps of the application localization method described above are implemented.
[0142] Reference Figure 6 , Figure 6 FIG. 1 is a structural block diagram of a first embodiment of an application localization device according to the present invention.
[0143] like Figure 6 As shown, the application localization device proposed in the embodiment of the present invention includes:
[0144] The text acquisition module 501 is used to acquire the text information to be localized of the application.
[0145] The language determination module 502 is used to determine target conversion language information based on the user's historical conversion information.
[0146] The text translation module 503 is used to perform a conversion process on the text information to be localized based on the target conversion language information to obtain the target text information corresponding to the application program.
[0147] This embodiment obtains the text information to be localized of the application; determines the target conversion language information based on the user's historical conversion information; and converts the text information to be localized based on the target conversion language information to obtain the target text information corresponding to the application. This embodiment converts the text information to be localized based on the target conversion language information determined by the user's historical conversion information, thereby automatically generating the target text information corresponding to the application, without requiring a large amount of human resources and time, and effectively improving the efficiency of application localization.
[0148] As an implementation mode, the text acquisition module 501 is also used to acquire an application program that needs to be localized, and query the string file information storing string resources in the source code of the application program; parse each string in the string file information, convert each string into a tree structure, and obtain a parsed file; traverse the labels of each sub-element on the tree structure of the parsed file, and use the sub-element labeled with a preset label as the target sub-element; determine the attributes of the target sub-element and the text content corresponding to the attributes; determine a key value according to the attribute, and determine the associated content corresponding to the key value based on the text content; and use the key value and the associated content as the text information to be localized.
[0149] As an implementation mode, the text translation module 503 is further used to parse and extract the text information to be localized to obtain the text information to be converted including the key value and the associated content; based on the target conversion program and the target conversion language information, the key value and the associated content of the text information to be converted are converted to obtain the target text information corresponding to the application.
[0150] Based on the first embodiment of the application localization device of the present invention, a second embodiment of the application localization device of the present invention is proposed.
[0151] In this embodiment, the text translation module 503 is also used to obtain an original corpus, which includes an initial text and a translation text corresponding to the initial text; train an initial neural network model based on the original corpus to obtain an intelligent learning model with semantic analysis function; integrate the intelligent learning model into the initial open source engine to obtain a target conversion program.
[0152] As an implementation mode, the text translation module 503 is also used to preprocess the original corpus, convert the format of the original corpus into a format corresponding to model training, and obtain preprocessed data; convert each text element in the preprocessed data into a corresponding numerical value by text encoding the preprocessed data to obtain encoded data; train the initial neural network model according to the encoded data to obtain an intelligent learning model with semantic analysis function.
[0153] As an implementation mode, the text translation module 503 is further used to obtain the translated key value and the translated associated content in the target text information; determine whether the translated associated content already exists in the resource file of the target conversion language information; if so, determine the target key value corresponding to the translated key value in the resource file, and replace the associated content corresponding to the target key value with the translated associated content; if not, add the translated key value and the translated associated content to the resource file.
[0154] Based on the second embodiment of the application localization device of the present invention, a third embodiment of the application localization device of the present invention is proposed.
[0155] In this embodiment, the text translation module 503 is also used to obtain pre-constructed test data and a standard translation text corresponding to the test data; convert the test data through the open source translation engine to obtain a test result; determine whether the test result contains preset keywords in the standard translation text, and detect whether the semantics of the test result is consistent with the semantics of the standard translation text; when the test result contains the preset keywords and the test result is consistent with the standard translation text, generate a test report with correct translation; when the test result does not contain the preset keywords, or the test result is inconsistent with the standard translation text, generate a test report with incorrect translation.
[0156] The specific implementation of the application localization device of the present invention can refer to the above-mentioned method embodiments, which will not be repeated here.
[0157] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0158] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0159] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0160] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for localizing an application, characterized in that: The method comprises: Get the text information to be localized of the application; Determine the target conversion language information based on the user's historical conversion information; The text information to be localized is converted based on the target conversion language information to obtain target text information corresponding to the application program.
2. The application localization method according to claim 1, characterized in that: Before the step of obtaining the text information to be localized of the application, the method further includes: Obtain an application that needs localization processing, and query string file information storing string resources in the source code of the application; Parsing each string in the string file information, converting each string into a tree structure, and obtaining a parsed file; Traversing the labels of each sub-element on the tree structure of the parsed file, and taking the sub-element labeled with a preset label as the target sub-element; Determine the attributes of the target sub-element and the text content corresponding to the attributes; Determine a key value according to the attribute, and determine associated content corresponding to the key value based on the text content; The key value and the associated content are used as text information to be localized.
3. The application localization method according to claim 2, characterized in that: The step of converting the text information to be localized based on the target conversion language information to obtain the target text information corresponding to the application program includes: Parsing and extracting the text information to be localized to obtain the text information to be converted including the key value and the associated content; The key value and the associated content of the text information to be converted are converted based on the target conversion program and the target conversion language information to obtain the target text information corresponding to the application program.
4. The application localization method according to claim 3, characterized in that: Before the step of converting the key value and the associated content of the text information to be converted based on the target conversion program and the target conversion language information to obtain the target text information corresponding to the application, the step further includes: Acquire an original corpus, wherein the original corpus includes an initial text and a translation text corresponding to the initial text; Training the initial neural network model based on the original corpus to obtain an intelligent learning model with semantic analysis function; The intelligent learning model is integrated into the initial open source engine to obtain a target conversion program.
5. The application localization method according to claim 4, characterized in that: The step of training the initial neural network model based on the original corpus to obtain an intelligent learning model with semantic analysis function includes: Preprocessing the original corpus, converting the format of the original corpus into a format corresponding to model training, and obtaining preprocessed data; Convert each text element in the preprocessed data into a corresponding numerical value by performing text encoding on the preprocessed data to obtain encoded data; The initial neural network model is trained according to the encoded data to obtain an intelligent learning model with semantic analysis function.
6. The application localization method according to any one of claims 3 to 5, characterized in that: After the step of converting the key value and the associated content of the text information to be converted based on the target conversion program and the target conversion language information to obtain the target text information corresponding to the application, the method further includes: Obtaining translated key values and translated associated content in the target text information; Determining whether the translated associated content already exists in the resource file of the target conversion language information; If yes, determining a target key value in the resource file corresponding to the translated key value, and replacing the associated content corresponding to the target key value with the translated associated content; If not, the translated key value and the translated associated content are added to the resource file.
7. The application localization method according to claim 1, characterized in that: After the step of converting the text information to be localized based on the target conversion language information to obtain the target text information corresponding to the application, the method further includes: Obtaining pre-constructed test data and standard translation text corresponding to the test data; The test data is converted and processed by the open source translation engine to obtain a test result; Determining whether the test result contains preset keywords in the standard translation text, and detecting whether the semantics of the test result is consistent with the semantics of the standard translation text; When the test result contains the preset keyword and the test result is consistent with the standard translation text, generating a test report with correct translation; When the test result does not include the preset keyword, or the test result is inconsistent with the standard translation text, a test report of translation error is generated.
8. An application localization device, characterized in that: The device comprises: A text acquisition module is used to obtain the text information to be localized of the application; A language determination module, used to determine target conversion language information based on the user's historical conversion information; The text translation module is used to convert the text information to be localized based on the target conversion language information to obtain the target text information corresponding to the application.
9. An application localization device, characterized in that: The device comprises: a memory, a processor, and an application localization program stored in the memory and executable on the processor, wherein the application localization program is configured to implement the steps of the application localization method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores an application localization program, and when the application localization program is executed by the processor, the steps of the application localization method according to any one of claims 1 to 7 are implemented.
