System language translation method, device, equipment and storage medium

By performing legality screening, illegal path filtering and text lines to be translated, and combining with preset translation plug-ins for translation, the problem of low translation efficiency of system files is solved, and efficient screening and translation of content that needs to be translated in the system file is achieved.

CN114490528BActive Publication Date: 2025-03-18PINGAN INT SMART CITY TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210138179.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-15
Publication Date
2025-03-18
Estimated Expiration
2042-02-15

AI Technical Summary

Technical Problem

In the prior art, system file translation efficiency is low, mainly due to the translation of a large number of redundant and invalid files.

Method used

By performing legality filtering and illegal path filtering on the system files of the target system, the text lines that need to be translated are extracted, and the preset translation plug-in is used for translation, to realize triple filtering of content that needs to be translated in the system files.

Benefits of technology

It effectively avoids the translation of invalid or duplicate files in system files and improves the efficiency of system file translation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114490528B_ABST
    Figure CN114490528B_ABST
Patent Text Reader

Abstract

The present invention relates to artificial intelligence technology, and discloses a system language translation method, including: screening the legality of a pre-acquired system file to obtain a first legal file; extracting the file path of the first legal file, filtering the illegal path of the first legal file according to the file path, and obtaining a second legal file; extracting the text line to be translated in the second legal file using a pre-built regular expression; obtaining the available languages ​​of the text to be translated, and calling a preset translation plug-in according to the available languages; translating the text to be translated using the translation plug-in corresponding to each available language, and adding the translation obtained to the text line to be translated. In addition, the present invention also relates to blockchain technology, and the system file can be stored in a node of the blockchain. The present invention also proposes a system language translation device, an electronic device, and a storage medium. The present invention can improve the efficiency of translating system files.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a system language translation method, device, electronic device and computer-readable storage medium. Background Art

[0002] As the application user base continues to expand and develop, users of the same application often use multiple languages. Therefore, in order to improve the practical experience of users of different languages, the consistency and friendliness of language translation must be considered. Therefore, multilingual translation has become a very necessary and significant task in the application development process.

[0003] Generally speaking, there are often a large number of redundant and invalid files in applications. Traditional multilingual translation mostly involves searching and replacing files in a single language within the system. However, due to the increasing complexity of applications and the continuous accumulation of data, a large number of redundant and invalid files are translated during the file translation process, resulting in low translation efficiency. Summary of the invention

[0004] The present invention provides a system language translation method, device and computer-readable storage medium, the main purpose of which is to solve the problem of low efficiency in translating system files.

[0005] To achieve the above object, the present invention provides a system language translation method, comprising:

[0006] Obtaining a preset system file in the target system, screening the system file for legitimacy, and obtaining a first legal file;

[0007] Extracting a file path of the first legal file, filtering illegal paths of the first legal file according to the file path, and obtaining a second legal file;

[0008] Extracting the text lines to be translated from the second legal file using a pre-built regular expression;

[0009] Obtaining the available languages ​​of the text to be translated, and calling a preset translation plug-in corresponding to the available languages ​​according to the available languages;

[0010] The text to be translated is translated using the translation plug-in, and the translated text is added to the line of the text to be translated.

[0011] Optionally, the performing a legality screening on the system file to obtain a first legal file includes:

[0012] Using a preset legal suffix name to construct a file name screening statement, and using the file name screening statement to select a file containing the legal suffix name from the system files as a file to be screened;

[0013] Querying the compiled product corresponding to each of the files to be screened from the cache directory of the target system;

[0014] Obtaining a generation timestamp of the compiled product, and calculating a difference between the generation timestamp and a preset timestamp;

[0015] The files corresponding to the timestamps whose difference values ​​are greater than a preset threshold are screened out from the files to be screened to obtain a first legal file.

[0016] Optionally, extracting the file path of the first legal file includes:

[0017] Selecting one of the first legal files as the target file one by one;

[0018] Obtaining a system file directory of the target system;

[0019] The path containing the file name in the system file directory is intercepted to obtain the file path.

[0020] Optionally, filtering the first legal file for illegal paths according to the file path to obtain a second legal file includes:

[0021] Construct path filtering statements based on preset illegal path parameters;

[0022] The path filtering statement is used to filter out the first legal file whose file path contains the illegal path parameter to obtain the second legal file.

[0023] Optionally, the extracting the text lines to be translated in the second legal file by using a pre-built regular expression includes:

[0024] Identifying the language category of each text line in the second legal file;

[0025] Using a preset symbol to mark the text line whose language category is a preset category;

[0026] Generate a regular expression according to the preset symbols;

[0027] The regular expression is used to filter out text lines marked with the preset symbol, and the text lines in the second legal file that are not filtered out are collected as text lines to be translated.

[0028] Optionally, calling a preset translation plug-in corresponding to the available language according to the available language includes:

[0029] Get the preset plug-in storage table;

[0030] Querying the calling path of the translation plug-in corresponding to the callable language from the plug-in storage table;

[0031] Compile the calling path into a plug-in calling statement;

[0032] The plug-in calling statement is used to call and obtain a translation plug-in corresponding to the available language.

[0033] Optionally, the step of adding the translated text to the line of text to be translated includes:

[0034] Selecting one of the text lines from the text lines to be translated as a target text line one by one;

[0035] constructing a blank comment field within the target text line;

[0036] Fill the blank annotation field with the translation corresponding to the target text line.

[0037] In order to solve the above problems, the present invention also provides a system language translation device, the device comprising:

[0038] A first screening module is used to obtain a preset system file in the target system, perform a legality screening on the system file, and obtain a first legal file;

[0039] A second screening module is used to extract the file path of the first legal file, and filter the first legal file for illegal paths according to the file path to obtain a second legal file;

[0040] A text line extraction module, used to extract the text lines to be translated in the second legal file using a pre-built regular expression;

[0041] A plug-in calling module, used to obtain the available languages ​​of the text to be translated, and call a preset translation plug-in corresponding to the available languages ​​according to the available languages;

[0042] The text translation module is used to translate the text to be translated using the translation plug-in, and add the translated text to the line of the text to be translated.

[0043] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:

[0044] at least one processor; and,

[0045] a memory communicatively connected to the at least one processor; wherein,

[0046] The memory stores a computer program executable by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can perform the system language translation method described above.

[0047] In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned system language translation method.

[0048] The embodiment of the present invention can perform a legality screening and illegal path filtering on the system file before translating the system file, and extract the text lines to be translated from the filtered file, and then use a preset translation plug-in to translate the text lines to be translated, thereby achieving a triple screening of the content to be translated in the system file through legality screening, illegal path filtering and text line operations to be translated, avoiding the translation of invalid or duplicate files in the system file, and helping to improve the efficiency of translating the system file. Therefore, the system language translation method, device, electronic device and computer-readable storage medium proposed by the present invention can solve the problem of low efficiency in translating system files. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 A schematic diagram of a flow chart of a system language translation method provided by an embodiment of the present invention;

[0050] Figure 2 A schematic diagram of a process for screening the legality of system files provided by an embodiment of the present invention;

[0051] Figure 3 A schematic diagram of a process for extracting a text line to be translated from a second legal file provided in an embodiment of the present invention;

[0052] Figure 4 A functional module diagram of a system language translation device provided by an embodiment of the present invention;

[0053] Figure 5 A schematic diagram of the structure of an electronic device for implementing the system language translation method provided by an embodiment of the present invention.

[0054] 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

[0055] 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.

[0056] The embodiment of the present application provides a system language translation method. The execution subject of the system language translation method includes but is not limited to at least one of the electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided by the embodiment of the present application. In other words, the system language translation method can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.

[0057] Reference Figure 1 FIG. 1 is a flow chart of a system language translation method provided by an embodiment of the present invention. In this embodiment, the system language translation method includes:

[0058] S1. Obtain a preset system file in the target system, perform a validity screening on the system file, and obtain a first valid file.

[0059] In the embodiment of the present invention, the system files include source code files, engineering code files, cache files and other files contained in the target system, and the target system can be any executable computer system.

[0060] In detail, computer statements with data capture functions (such as java statements, python statements, etc.) can be used to capture system files of the target system from the storage area where the target system is located, wherein the storage area includes but is not limited to the database, blockchain node, and cloud storage corresponding to the target system.

[0061] In one of the practical application scenarios of the present invention, since the system file contains many files in the target system, not all files need to be translated into multiple languages. For example, the system file contains a large number of invalid files that are temporarily stored in the target system but have no practical use; or, the system file contains a large number of repeated and redundant files; therefore, if all system files are directly translated into multiple languages, a large amount of computing resources will be occupied and the translation efficiency will be low.

[0062] In the embodiment of the present invention, the system files may be screened for legitimacy to screen out invalid, redundant, and illegal files in the system files, so as to improve the efficiency of translating the system files.

[0063] In the embodiment of the present invention, Figure 2As shown, the legitimacy screening of the system file to obtain the first legal file includes:

[0064] S21, constructing a file name screening statement using a preset legal suffix name, and selecting a file containing the legal suffix name from the system file as a file to be screened using the file name screening statement;

[0065] S22, querying the compiled product corresponding to each of the files to be screened from the cache directory of the target system;

[0066] S23, obtaining a generation timestamp of the compiled product, and calculating a difference between the generation timestamp and a preset timestamp;

[0067] S24: Filter out files corresponding to timestamps whose difference is greater than a preset threshold from the files to be filtered, and obtain a first legal file.

[0068] In detail, since there are many files in the system files that cannot be read, rewritten or compiled by the target system, a file name filter statement can be generated using preset legal suffixes to select files that can be processed in the system files.

[0069] Exemplarily, the use of preset legal suffixes to construct a file name screening statement includes:

[0070] Generate the following file name filtering statement:

[0071] WHITEFILETYPE_DEFAULT=['.h','.m','.mm','.swift']

[0072] Among them, '.h', '.m', '.mm', and '.swift' are the suffixes of legal files that can be read, rewritten, or compiled by the system.

[0073] By executing the above file name screening statement, files containing the legal suffix name can be selected from the system files, and the screened files can be collected as files to be screened.

[0074] Furthermore, due to the iterative update of the system, there may be some expired files in the files to be screened with legal suffix names, and there is no need to translate these expired files into multiple languages. Therefore, the files to be screened can be further screened to delete the expired files in the files to be screened.

[0075] In the embodiment of the present invention, since the system files need to be compiled before the corresponding functions of each system file can be executed, and the system files are analyzed in the meantime, it is impossible to intuitively determine whether each system file is expired. Therefore, the CREATE INDEX statement in the SQL library can be used to query the compilation product corresponding to each file to be screened from the cache directory of the target system, and the generation timestamp of each compilation product can be obtained by using a preset query statement, and then the files to be screened are screened according to the difference between the generation timestamp and the preset timestamp.

[0076] The compilation product is the result of compiling each system file, the generation timestamp is the time point when the compilation product is generated, and the preset timestamp can be the time point when the target system is last updated or compiled.

[0077] S2. Extract the file path of the first legal file, and filter illegal paths of the first legal file according to the file path to obtain a second legal file.

[0078] In one of the practical application scenarios of the present invention, there may be parts in the first legal file that can be read, rewritten or compiled by the target system, but are not files that need to be processed in the target system. Therefore, in order to further reduce the number of files that need to be translated into multiple languages, the file path of each file in the first legal file can be extracted, and then the files with illegal paths in the first legal file can be filtered out according to the file path.

[0079] In the embodiment of the present invention, extracting the file path of the first legal file includes:

[0080] Selecting one of the first legal files as the target file one by one;

[0081] Obtaining a system file directory of the target system;

[0082] The path containing the file name in the system file directory is intercepted to obtain the file path.

[0083] In detail, the system file directory is a directory containing all system files of the target system. The step of obtaining the system file directory of the target system is consistent with the step of obtaining the preset system files in the target system in S1, and is not repeated here.

[0084] Specifically, the path of the file name of the target file in the system file directory may be intercepted to obtain the file path.

[0085] Furthermore, after obtaining the file path corresponding to each file in the first legal file, the first legal files may be filtered according to the file path to filter out the first legal files whose file paths are illegal paths.

[0086] In the embodiment of the present invention, filtering the first legal file for illegal paths according to the file path to obtain the second legal file includes:

[0087] Construct path filtering statements based on preset illegal path parameters;

[0088] The path filtering statement is used to filter out the first legal file whose file path contains the illegal path parameter to obtain the second legal file.

[0089] Exemplarily, the following illegal path filtering statement may be constructed:

[0090] BLACKDIRLSIT_DEFAULT=[' / Example',' / Pods']

[0091] Among them, ' / Example' and ' / Pods' are preset illegal path parameters.

[0092] For example, the first legal file includes file A, file B, file C and file D, wherein the file path of file A is windows / appcompat / programs / install, the file path of file B is windows / Example / programs / install, the file path of file C is windows / appcompat / Pods / install, and the file path of file D is windows / appcompat / user / install. It can be seen that the file paths of file B and file C contain illegal path parameters ' / Example' and ' / Pods'. Therefore, the path filtering statement can be used to filter out file B and file C in the first legal file, and use file A and file D as the second legal file.

[0093] S3. Using a pre-built regular expression, extract the text lines to be translated in the second legal file.

[0094] In one of the practical application scenarios of the present invention, the second legal files are all files that need to be translated into multiple languages, but not every line of data in each second legal file needs to be translated. Therefore, in order to further improve the final translation efficiency, the text lines in the second legal file can be screened to extract the text lines to be translated in the second legal file.

[0095] In the embodiment of the present invention, Figure 3 As shown, the method of extracting the text lines to be translated in the second legal file by using a pre-built regular expression includes:

[0096] S31, identifying the language category of each text line in the second legal file;

[0097] S32, using a preset symbol to mark the text line whose language category is a preset category;

[0098] S33, generating a regular expression according to the preset symbols;

[0099] S34: Using the regular expression to filter out text lines marked with the preset symbol, and collecting text lines in the second legal file that are not filtered out as text lines to be translated.

[0100] In detail, a preset Java statement with language category recognition function can be used to identify the language category of each text line in the second legal file, and preset symbols can be used to mark the text lines whose language category is the preset category to facilitate subsequent screening of text lines, wherein the preset symbols include but are not limited to \s, \S, ^\, *\.

[0101] For example, when the Chinese part of a document needs to be translated into multiple languages, the Chinese category can be determined as the preset category, and then the text lines whose text categories are categories other than the Chinese category can be marked with preset symbols.

[0102] Specifically, the preset symbol can be used to generate a regular expression, and the regular expression can realize the function of filtering data with a specific format. For example, after some text lines in the second legal file are marked with the preset symbol, the regular expression can be used to extract the text lines marked with the preset symbol, and the extracted text lines can be deleted, and then the text lines in the second legal file that have not been filtered out can be collected as text lines to be translated.

[0103] S4. Obtain available languages ​​of the text to be translated, and call a preset translation plug-in corresponding to the available languages ​​according to the available languages.

[0104] In an embodiment of the present invention, not all text lines to be translated need to be translated into multiple available languages. For example, there are text A and text B in the text line to be translated, wherein text A needs to be translated into language a and language b, but text B only needs to be translated into language a. Therefore, in order to improve the efficiency of translating the text to be translated, the available languages ​​of the text line to be translated can be obtained, and then the preset translation plug-in corresponding to the available language can be called according to the available language.

[0105] The available languages ​​are languages ​​into which the text line to be translated can be translated. For example, when the text to be translated can be translated into English, Japanese, and French, the available languages ​​of the text line to be translated are English, Japanese, and French.

[0106] In detail, the text lines to be translated may be output to a management user of the target system, and information fed back by the management user based on the text lines to be translated may be obtained, the information including the available language of each text line in the text lines to be translated.

[0107] Furthermore, in order to achieve rapid translation of the text line to be translated, a preset translation plug-in corresponding to the available language may be called according to the available language.

[0108] In the embodiment of the present invention, calling a preset translation plug-in corresponding to the available language according to the available language includes:

[0109] Get the preset plug-in storage table;

[0110] Querying the calling path of the translation plug-in corresponding to the callable language from the plug-in storage table;

[0111] Compile the calling path into a plug-in calling statement;

[0112] The plug-in calling statement is used to call and obtain a translation plug-in corresponding to the available language.

[0113] In detail, the plug-in storage table may be uploaded in advance by an administrator of the target system, and the plug-in storage table stores translation plug-ins corresponding to multiple languages ​​and a calling path corresponding to each plug-in.

[0114] Specifically, the CREATE INDEX statement in the SQL library may be used to query the calling path of the translation plug-in corresponding to the callable language from the plug-in storage table.

[0115] In the embodiment of the present invention, the calling path may be compiled into a plug-in calling statement using a preset compiler, wherein the compiler includes but is not limited to: a Visual Studio compiler, a Clion compiler, and a Visual C++ compiler.

[0116] Furthermore, the embodiment of the present invention can execute the plug-in calling statement to implement the calling of the translation plug-in corresponding to each available language.

[0117] S5. Translate the text to be translated using the translation plug-in, and add the translated text to the line of the text to be translated.

[0118] In the embodiment of the present invention, the text line to be translated may be input into a translation plug-in corresponding to an available language, and then the translation plug-in may be used to translate the text line to be translated.

[0119] Furthermore, after translating the text line to be translated, the translated text needs to be added to the text line to be translated, so as to finally display it to users who use different languages.

[0120] In the embodiment of the present invention, the step of adding the translated text to the line of the text to be translated includes:

[0121] Selecting one of the text lines from the to-be-translated text lines as a target text line one by one;

[0122] constructing a blank comment field within the target text line;

[0123] Fill the blank annotation field with the translation corresponding to the target text line.

[0124] In detail, since different users of the target system use different languages, in order to realize the translation display for all users of different languages, an empty table annotation field can be constructed in the text line to be translated, and then the translation corresponding to each text line to be translated is filled into the blank annotation field corresponding to the text line to be translated.

[0125] The embodiment of the present invention can perform a legality screening and illegal path filtering on the system file before translating the system file, and extract the text lines to be translated from the filtered files, and then use a preset translation plug-in to translate the text lines to be translated, thereby achieving a triple screening of the content to be translated in the system file through legality screening, illegal path filtering and text line operations to be translated, avoiding the translation of invalid or duplicate files in the system file, and helping to improve the efficiency of translating the system file. Therefore, the system language translation method proposed by the present invention can solve the problem of low efficiency in translating system files.

[0126] like Figure 4 FIG. 1 is a functional module diagram of a system language translation device provided in one embodiment of the present invention.

[0127] The system language translation device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the system language translation device 100 can include a first screening module 101, a second screening module 102, a text line extraction module 103, a plug-in calling module 104 and a text translation module 105. The module of the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.

[0128] In this embodiment, the functions of each module / unit are as follows:

[0129] The first screening module 101 is used to obtain a preset system file in the target system, screen the system file for legitimacy, and obtain a first legal file;

[0130] The second screening module 102 is used to extract the file path of the first legal file, and filter the first legal file for illegal paths according to the file path to obtain a second legal file;

[0131] The text line extraction module 103 is used to extract the text lines to be translated in the second legal file using a pre-built regular expression;

[0132] The plug-in calling module 104 is used to obtain the available languages ​​of the text to be translated, and call a preset translation plug-in corresponding to the available languages ​​according to the available languages;

[0133] The text translation module 105 is used to translate the text to be translated using the translation plug-in, and add the translated text to the line of the text to be translated.

[0134] In detail, each module described in the system language translation device 100 in the embodiment of the present invention is used in the same manner as described above. Figures 1 to 3 The system language translation method described in the present invention has the same technical means and can produce the same technical effects, so it will not be repeated here.

[0135] like Figure 5 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing a system language translation method provided by an embodiment of the present invention.

[0136] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a system language translation program.

[0137] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (for example, executing a system language translation program, etc.), and calls data stored in the memory 11 to execute various functions of the electronic device and process data.

[0138] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 may not only be used to store application software and various types of data installed in the electronic device, such as the code of the system language translation program, etc., but also be used to temporarily store data that has been output or is to be output.

[0139] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.

[0140] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.

[0141] The figure only shows an electronic device with components. Those skilled in the art will understand that the structure shown in the figure does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0142] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0143] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0144] The system language translation program stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:

[0145] Obtaining a preset system file in the target system, screening the system file for legitimacy, and obtaining a first legal file;

[0146] Extracting a file path of the first legal file, filtering illegal paths of the first legal file according to the file path, and obtaining a second legal file;

[0147] Extracting the text lines to be translated from the second legal file using a pre-built regular expression;

[0148] Obtaining the available languages ​​of the text to be translated, and calling a preset translation plug-in corresponding to the available languages ​​according to the available languages;

[0149] The text to be translated is translated using the translation plug-in, and the translated text is added to the line of the text to be translated.

[0150] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, which will not be repeated here.

[0151] Furthermore, if the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).

[0152] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:

[0153] Obtaining a preset system file in the target system, screening the system file for legitimacy, and obtaining a first legal file;

[0154] Extracting a file path of the first legal file, filtering illegal paths of the first legal file according to the file path, and obtaining a second legal file;

[0155] Extracting the text lines to be translated from the second legal file using a pre-built regular expression;

[0156] Obtaining the available languages ​​of the text to be translated, and calling a preset translation plug-in corresponding to the available languages ​​according to the available languages;

[0157] The text to be translated is translated using the translation plug-in, and the translated text is added to the line of the text to be translated.

[0158] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0159] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0160] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0161] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0162] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.

[0163] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0164] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0165] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

[0166] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A system language translation method, characterized in that: The method comprises: Obtain a preset system file in the target system, query a compilation product corresponding to each to-be-screened file from a cache directory of the target system, obtain a generation timestamp of the compilation product, calculate a difference between the generation timestamp and a preset timestamp, and screen out files corresponding to timestamps whose difference is greater than a preset threshold from the to-be-screened files to obtain a first legal file; Extracting the file path of the first legal file, constructing a path filtering statement according to a preset illegal path parameter, and using the path filtering statement to filter out the first legal file whose file path contains the illegal path parameter, to obtain a second legal file; Extracting the text lines to be translated from the second legal file using a pre-built regular expression; Obtaining the available languages ​​of the text to be translated, and calling a preset translation plug-in corresponding to the available languages ​​according to the available languages; The text to be translated is translated using the translation plug-in, and the translated text is added to the line of the text to be translated.

2. The system language translation method according to claim 1, characterized in that: The method further comprises: A file name screening statement is constructed using a preset legal suffix name, and the file name screening statement is used to select a file containing the legal suffix name from the system files as a file to be screened.

3. The system language translation method according to claim 1, characterized in that: The step of extracting the file path of the first legal file includes: Selecting one of the first legal files as the target file one by one; Obtaining a system file directory of the target system; The path containing the file name in the system file directory is intercepted to obtain the file path.

4. The system language translation method according to claim 1, characterized in that: The extracting the text lines to be translated from the second legal file by using a pre-built regular expression includes: Identifying the language category of each text line in the second legal file; Using a preset symbol to mark the text line whose language category is a preset category; Generate a regular expression according to the preset symbols; The regular expression is used to filter out text lines marked with the preset symbol, and the text lines in the second legal file that are not filtered out are collected as text lines to be translated.

5. The system language translation method according to claim 1, characterized in that: The calling of a preset translation plug-in corresponding to the available language according to the available language includes: Get the preset plug-in storage table; Querying the calling path of the translation plug-in corresponding to the available language from the plug-in storage table; Compile the calling path into a plug-in calling statement; The plug-in calling statement is used to call and obtain a translation plug-in corresponding to the available language.

6. The system language translation method according to any one of claims 1 to 5, characterized in that: The step of adding the translated text to the line of text to be translated includes: Selecting one of the text lines from the to-be-translated text lines one by one as a target text line; constructing a blank comment field within the target text line; Fill the blank annotation field with the translation corresponding to the target text line.

7. A system language translation device, characterized in that: The device comprises: A first screening module is used to obtain a preset system file in a target system, query a compilation product corresponding to each to-be-screened file from a cache directory of the target system, obtain a generation timestamp of the compilation product, calculate a difference between the generation timestamp and a preset timestamp, and screen out files corresponding to timestamps whose difference is greater than a preset threshold from the to-be-screened files to obtain a first legal file; A second screening module is used to extract the file path of the first legal file, construct a path filtering statement according to a preset illegal path parameter, and use the path filtering statement to filter out the first legal file whose file path contains the illegal path parameter to obtain a second legal file; A text line extraction module, used to extract the text lines to be translated in the second legal file using a pre-built regular expression; A plug-in calling module, used to obtain the available languages ​​of the text to be translated, and call a preset translation plug-in corresponding to the available languages ​​according to the available languages; The text translation module is used to translate the text to be translated using the translation plug-in, and add the translated text to the line of the text to be translated.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the system language translation method according to any one of claims 1 to 6.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the system language translation method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Method for replacing code Chinese character string and computer readable storage medium

    CN107329957A