Text processing method, device and equipment for program code file
By identifying and replacing Chinese text in program code files and generating language packages, the cumbersome problems of multi-language support in software development are solved, automation and internationalization are achieved, and development efficiency and code maintainability are improved.
Patent Information
- Application Number
- CN202411167277.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-12-31
AI Technical Summary
In software development, traditional hard-coded methods are cumbersome and prone to errors when facing multilingual support, which increases the workload of development and maintenance and affects development efficiency and project progress.
By identifying the Chinese text in the program code file, generating corresponding entry codes, replacing and translating according to the project type, and generating language packages, the text is automated and internationalized, and the manual workload of developers is reduced.
It realizes rapid and efficient internationalization of multilingual support, reduces development costs, improves development efficiency and maintainability of code, and ensures the comprehensiveness and accuracy of the internationalization process.
Smart Images

Figure CN119225802A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of text processing technology, and in particular to a text processing method, device and equipment for program code files. Background Art
[0002] In current software development practices, with the continuous expansion of business scale and the growing demand for internationalization, the amount of coding within the system has increased dramatically. In traditional software development methods, language content such as display text, prompt information, and user interface elements are often hard-coded directly in the source code, which is particularly inconvenient when facing multi-language support. Especially when the system needs to support multiple languages, such as expanding from simplified Chinese to other languages such as English and Japanese, developers have to review the code line by line and manually replace the text with the text of the corresponding language or convert it to the key in the language pack. This process is not only cumbersome and error-prone, but also greatly increases the workload of development and maintenance. In addition, with the continuous iteration of the project and the continuous addition of new features, each update may introduce new hard-coded text, requiring developers to invest additional time and energy in internationalization again, which undoubtedly has a significant impact on development efficiency and increases the risk of project delays and cost overruns.
[0003] Therefore, the industry urgently needs an efficient solution to achieve the separation of code business functions and internationalization. This solution should allow developers to focus on the implementation of core business logic without worrying about the internationalization of text content. In this way, whether it is the internationalization of existing functions or the development of new functions, multi-language support can be easily achieved without interfering with the implementation of business logic. Summary of the invention
[0004] In view of this, the purpose of the present invention is to propose a text processing method, device and equipment for program code files, aiming to solve the problem of how to reduce the manual workload of developers.
[0005] To achieve the above object, the present invention provides a text processing method for a program code file, the method comprising:
[0006] Obtaining a program code file in a specified directory, identifying a target text including Chinese text in the program code file, and obtaining the text entry and location information of the text entry;
[0007] Generating a corresponding entry code for each identified text entry according to a preset format;
[0008] Generate a term replacement text that replaces the term code according to the project type to which the program code file belongs, and replace the text term corresponding to the position information with the term replacement text to obtain a replaced update file;
[0009] After the text terms are translated into the target language, the translated text terms and the corresponding term codes are encoded to generate a language package according to the project type corresponding to the program code file, and the language package is classified according to the first letters of the text terms to obtain multiple language package files.
[0010] Preferably, the identifying the target text including Chinese text in the program code file comprises:
[0011] The target text including Chinese text in the program code file is identified by a preconfigured regular expression, wherein the regular expression is configured according to the project type to which the program code file belongs and / or different writing methods in the program code file.
[0012] Preferably, the preset format is LNG_first letter of the term or LNG_first letter of the term_serial number.
[0013] Preferably, after generating a corresponding entry code for each of the identified text entries according to a preset format, the method further includes:
[0014] The text terms, the location information and the term codes are stored and recorded in the constructed database; the database includes a term table, a term reference information table and a language pack information table; the term table is used to record the text terms, the term codes and the translation text in the target language; the term reference information table is used to record the line information of the text terms in the program code file, and the line information is determined according to the location information; the language pack information table is used to record the text terms used in the language pack called in the update file.
[0015] Preferably, the project type includes a front-end file and a back-end file; the step of generating a term replacement text to replace the term code according to the project type to which the program code file belongs includes:
[0016] When the project type of the program code file is the front-end file, the entry code is processed by using the $lz_t function to generate the entry replacement text including the first entry replacement text;
[0017] When the project type of the program code file is the backend file, the entry code is processed using the I18nResourceHelper.convertI18nCodes conversion method to generate the entry replacement text including the second entry replacement text.
[0018] Preferably, after obtaining the replaced update file, the method further includes:
[0019] By adjusting the regular expression, the update file is identified according to the adjusted regular expression to see whether there is Chinese text, and if so, the corresponding Chinese text is extracted as the text entry to generate the corresponding language pack.
[0020] Preferably, before generating the language package, the method further includes:
[0021] The translated text entries are subjected to quality checks, including grammar checks, terminology consistency checks, and contextual adaptability checks.
[0022] To achieve the above object, the present invention further provides a text processing device for a program code file, the device comprising:
[0023] A term recognition unit is used to obtain a program code file in a specified directory, recognize a target text including Chinese text in the program code file, and obtain the text term and location information of the text term;
[0024] A term code generating unit, used for generating a corresponding term code for each identified text term according to a preset format;
[0025] An entry replacement unit, configured to generate an entry replacement text to replace the entry code according to the project type to which the program code file belongs, and replace the text entry corresponding to the position information with the entry replacement text to obtain a replaced update file;
[0026] A language package generating unit is used to translate the text terms into a target language, generate a language package from the translated text terms and the corresponding term encodings according to the project type corresponding to the program code file, and classify the language package according to the first letters of the text terms to obtain multiple language package files.
[0027] In order to achieve the above objectives, the present invention also proposes a text processing device for a program code file, comprising a processor, a memory, and a computer program stored in the memory, wherein the computer program is executed by the processor to implement the steps of a text processing method for a program code file as described in the above embodiment.
[0028] In order to achieve the above objectives, the present invention also proposes a computer-readable storage medium, on which a computer program is stored. The computer program is executed by a processor to implement the steps of a text processing method of a program code file as described in the above embodiment.
[0029] In order to achieve the above object, the present invention also proposes a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of a text processing method for a program code file as described in the above embodiment.
[0030] Beneficial effects:
[0031] The above solution greatly reduces the manual workload of developers by identifying text entries in program code files and generating replacement text to replace text entries in program code files, making the internationalization process faster and more efficient. Developers can focus on the implementation of business logic without worrying about the internationalization of text, thereby improving overall development efficiency.
[0032] The above solution can flexibly adapt to the internationalization requirements of different project types such as front-end files and back-end files, and process different types of program code files through different functions or methods, ensuring the comprehensiveness and accuracy of the internationalization process; moreover, this method has good scalability and can easily cope with the continuous iteration and new functions of software projects, ensuring that the internationalization work can be continuously improved and optimized as the project develops.
[0033] The above solution separates the text entries from the business logic in the program code file and manages them by generating language packages, making subsequent modification or addition of text content simple and direct without modifying the source code, thereby enhancing the maintainability and scalability of the code.
[0034] The above solution generates entry codes through a preset format and performs quality checks on the translated text entries (including grammar checks, terminology consistency checks, and context adaptability checks), ensuring the accuracy and professionalism of the translated text and improving the internationalization quality of the software.
[0035] The above solution stores text entries, location information and entry codes in the database, and constructs an entry table, an entry reference information table and a language pack information table, thereby achieving efficient management and rapid retrieval of text entries and facilitating subsequent international maintenance and updates.
[0036] The above solution re-identifies the update file by adjusting the regular expression to ensure that all Chinese texts are correctly identified and replaced, effectively reducing internationalization issues caused by omissions or errors and improving the stability of the software and user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 A flowchart of a text processing method for a program code file provided by an embodiment of the present invention.
[0039] Figure 2 A schematic screenshot of a classified language package file provided by an embodiment of the present invention.
[0040] Figure 3 A schematic diagram of the structure of a text processing device for a program code file provided by an embodiment of the present invention.
[0041] The realization of the purpose, functional features and advantages of the invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0043] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.
[0044] The content of the present invention is described in detail below with reference to embodiments.
[0045] Reference Figure 1 FIG. 1 is a flow chart of a text processing method for a program code file provided by an embodiment of the present invention.
[0046] In this embodiment, the method includes:
[0047] S11, obtaining a program code file in a designated directory, identifying a target text including Chinese text in the program code file, and obtaining the text entry and location information of the text entry.
[0048] Further, in step S11, the identifying the target text including Chinese text in the program code file includes:
[0049] The target text including Chinese text in the program code file is identified by a preconfigured regular expression, wherein the regular expression is configured according to the project type to which the program code file belongs and / or different writing methods in the program code file.
[0050] In the present embodiment, the development system of the method application includes multiple projects, and the projects are divided into two types of projects, the front end and the back end. By scanning the program code files under the specified directory, a regular expression is used to identify the target text in the program code files, such as Chinese text or special format text (the special format text includes Chinese characters and other characters, such as: vehicle GPS position, task {0} has been executed {1}%), and it is defined as a text entry. For example, for matching the situation that Chinese is contained in double quotes, a regular expression is used: ".*[\u4e00-\u9fa5]+.*?", which can match and identify the Chinese fragments in the following codes: "completed", "task {0} has been executed {1}%", "CAN data: ", etc., and the recognition result will remove the quotation marks at the beginning and the end, and only the content between the quotation marks is saved as a text entry. For the situation that there is a formatted placeholder in the text entry, such as {0} in the above example, it will be used as a part of the text entry and still retained in the translated text. However, the recognition methods of program code files of front-end and back-end projects are different. Regular expressions can be adjusted by configuring parameters. Multiple regular expressions can be configured at the same time to adapt to a variety of texts. In the same program code file, due to different ways of expressing Chinese fragments, multiple different regular expressions need to be configured to recognize and extract the text in it. For example, in a .vue file, some places may be written as: ˋVehicleˋ, while others may be written as: "Vehicle". In this case, two regular expressions need to be configured to extract all the text, including: ˋ.*[\u4e00-\u9fa5]+.*? ˋ and ".*[\u4e00-\u9fa5]+.*?". Therefore, regular expressions can be configured according to specific circumstances and modified in the configuration file of the application.
[0051] Furthermore, in the specific implementation, you can specify the file types from which you need to extract text entries (front-end vue files, front-end js files, front-end xml files, back-end java files, back-end cs files, back-end xml files, etc.), you can specify folders to ignore the extraction of text entries, and you can also ignore this file in the program code file by entering " / / FILE_NO_TRANSLATE" in the first line, or ignore the extraction operation of this line by entering " / / NO_TRANSLATE" at the end of the line.
[0052] S12, generating a corresponding entry code for each identified text entry according to a preset format.
[0053] Among them, the preset format is LNG_first letter of the term or LNG_first letter of the term_serial number.
[0054] Furthermore, after generating a corresponding entry code for each of the identified text entries according to a preset format, the method further includes:
[0055] The text terms, the location information and the term codes are stored and recorded in the constructed database; the database includes a term table, a term reference information table and a language pack information table; the term table is used to record the text terms, the term codes and the translation text in the target language; the term reference information table is used to record the line information of the text terms in the program code file, and the line information is determined according to the location information; the language pack information table is used to record the text terms used in the language pack called in the update file.
[0056] In this embodiment, the corresponding entry code is generated for the identified text entry in the format of LNG_entry first letter or LNG_entry first letter_serial number, that is, starting with LNG_, plus the first letters of the first 20 characters of the identified text entry. If the text entry is "print QR code", the corresponding generated entry code is LNG_DYEWM. If there is a duplication, the serial number is added later to distinguish, for example: "time setting", the generated entry code is: LNG_SJSZ, and "upgrade setting", the generated entry code is: LNG_SJSZ_1, so that the entry code can be ensured to be unique.
[0057] The recognized text terms and corresponding term codes are recorded in the database, including:
[0058] Term table: records text terms (a text term may be used by multiple files), term codes, and scalable multi-language translation texts; if it can support multiple languages such as Chinese (zh), English (en), Thai (th), Mongolian (mn), Bulgarian (bg), etc., then the corresponding field in the term table that can support the target language is named word_+language code, such as word_zh, word_en, and the language pack corresponding to the target language can be generated later. If other languages need to be added later, such as French (fr), you only need to add a field (word_fr) in the term table, fill in the French translation text of the corresponding text term in this field, and add the French language pack when generating the language pack later.
[0059] Term reference information table: records the line information of the program code file where the text term exists.
[0060] Language pack information table: records the use of text entries in the language packs used in the program code files.
[0061] S13, generating a term replacement text to replace the term code according to the project type to which the program code file belongs, and replacing the text term corresponding to the position information with the term replacement text to obtain a replaced update file.
[0062] Further, the project type includes a front-end file and a back-end file; the step of generating a term replacement text to replace the term code according to the project type to which the program code file belongs includes:
[0063] S13-1, when the project type of the program code file is the front-end file, the entry code is processed by using the $lz_t function to generate the entry replacement text including the first entry replacement text;
[0064] S13-2, when the project type of the program code file is the backend file, the entry code is processed using the I18nResourceHelper.convertI18nCodes conversion method to generate the entry replacement text including the second entry replacement text.
[0065] Furthermore, after obtaining the replaced update file, the method further includes:
[0066] By adjusting the regular expression, the update file is identified according to the adjusted regular expression to see whether there is Chinese text, and if so, the corresponding Chinese text is extracted as the text entry to generate the corresponding language pack.
[0067] In this embodiment, by determining the project type of the program code file, different functions or methods are used to process the wrapped entry encoding to generate an entry replacement text. For example, there is a Chinese entry 'Time Setting' in the program code file. After identification and extraction, a corresponding entry code 'LNG_SJSZ' is created. The front-end and back-end respectively use different methods to process it to generate the corresponding entry replacement text: The entry replacement text generated by the front-end file is: $lz_t('LNG_SJSZ','!@@!Time Setting'); The entry replacement text generated by the back-end file is: I18nResourceHelper.convertI18nCodes(“LNG_SJSZ”). Furthermore, the position information (line information) of the corresponding text entry in the program code file can be determined according to the relevant information of the text entry recorded in the database, so as to locate the position of the text entry and replace the text entry with the corresponding entry replacement text. One of the updated lines is as follows:
[0068] updateReq.setCurrentStep(I18nResourceHelper.convertI18nCodes(“LNG_SJSZ”)); / / Original line number 157: updateReq.setCurrentStep(“Time Setting”);
[0069] Among them, I18nResourceHelper.convertI18nCodes is the conversion method of the language pack, and the original line text is retained by means of annotation at the end of the line.
[0070] S14. After translating the text entry into the target language, generate a language pack according to the project type corresponding to the program code file for the translated text entry and the corresponding entry code, and classify the language pack according to the first letter of the text entry to obtain multiple language pack files.
[0071] Further, before generating the language pack, it includes:
[0072] Perform a quality check on the translated text entry. The quality check includes grammar check, term consistency check, and context adaptability check.
[0073] In this embodiment, a text entry has translation texts in multiple languages (such as Chinese, English, Thai, Mongolian, Bulgarian, etc.). For example, the entry "Completed" has the first letter Y, so a Y_Messages.properties file will be generated. This file is the default language file, which is usually consistent with Chinese. Then, other files such as Y_Messages_zh.properties and Y_Messages_en.properties are generated corresponding to each language. The contents in the file have a key of LNG_YWC (entry code). For example, the Chinese language package: LNG_YWC = Completed, and the English language package: LNG_YWC = Finished. By performing quality checks on the translated text entries, including grammar checks, term consistency checks, and context adaptability checks, it is ensured that the translation quality meets the project requirements. Translate the text terms into the corresponding target language, and filter them according to the project type and the usage of the corresponding text terms in the current project recorded in the database, and then generate a language pack. The language type of the language pack can be determined by the number of languages in the term table. Save the language pack to the specified directory of the project, and classify the language pack according to the first letter of the text terms to obtain multiple language pack files. See Figure 2 The formats of the language packs generated by the front-end and back-end are different: the front-end language pack file extension is .js, for example: G_zh-CN.js, the content of the file is as follows:
[0074] export default{
[0075] LNG_GB: 'Close',
[0076] LNG_GWLX: 'Job Type',
[0077] LNG_GXRQ:'Update date',
[0078] LNG_GZRQ:'Purchase date'
[0079] }
[0080] The file extension of the backend language pack is .properties, for example: M_Messages_zh.properties. The contents of this file are as follows:
[0081] LNG_MYBT=No header
[0082] LNG_MYMBDBBXX=No template version information
[0083] LNG_MYQXZXGCZ=No permission to perform this operation
[0084] Furthermore, when the text terms in the program code file change, the relevant processes of re-identification, term encoding generation, replacement, and language pack update are automatically triggered to ensure the synchronization of the language pack and the program code file. Furthermore, the text terms in the program code file can be extracted repeatedly, and the newly added text terms will be added to the language pack. In this way, in addition to handling the internationalization of the old code, for the newly developed functions, the original development method can be used, and Chinese text can be written directly in the code. Before publishing, the text terms can be extracted again and the language pack can be generated.
[0085] Reference Figure 3 FIG. 1 is a schematic diagram of the structure of a text processing device for a program code file provided by an embodiment of the present invention.
[0086] In this embodiment, the device 20 includes:
[0087] The term recognition unit 21 is used to obtain a program code file in a specified directory, recognize a target text including Chinese text in the program code file, and obtain the text term and the location information of the text term;
[0088] The entry code generating unit 22 is used to generate a corresponding entry code for each of the identified text entries according to a preset format;
[0089] The term replacement unit 23 is used to generate a term replacement text to replace the term code according to the project type to which the program code file belongs, and replace the text term corresponding to the position information with the term replacement text to obtain a replaced update file;
[0090] The language package generation unit 24 is used to translate the text terms into the target language, generate a language package from the translated text terms and the corresponding term encodings according to the project type corresponding to the program code file, and classify the language package according to the first letters of the text terms to obtain multiple language package files.
[0091] Each unit module of the device 20 can respectively execute the corresponding steps in the above method embodiment, so each unit module will not be described in detail here. Please refer to the description of the above corresponding steps for details.
[0092] The embodiment of the present invention further provides a text processing device for a program code file, the device comprising the text processing device for a program code file as described above, wherein the text processing device for a program code file can adopt Figure 3 The structure of the embodiment can be executed accordingly. Figure 1 The technical solution of the method embodiment shown has similar implementation principles and technical effects. For details, please refer to the relevant records in the above embodiments, which will not be repeated here.
[0093] The device includes: a mobile phone, a digital camera, a tablet computer, or other devices with a camera function, or a device with an image processing function, or a device with an image display function. The device may include components such as a memory, a processor, an input unit, a display unit, and a power supply.
[0094] Among them, the memory can be used to store software programs and modules, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as an image playback function, etc.), etc.; the data storage area may store data created according to the use of the device, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory may also include a memory controller to provide the processor and the input unit with access to the memory.
[0095] The input unit can be used to receive input digital or character or image information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, the input unit of this embodiment includes not only a camera, but also a touch-sensitive surface (such as a touch display) and other input devices.
[0096] The display unit can be used to display information input by the user or information provided to the user and various graphical user interfaces of the device, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit may include a display panel, and optionally, the display panel may be configured in the form of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc. Further, the touch-sensitive surface may cover the display panel, and when the touch-sensitive surface detects a touch operation on or near it, it is transmitted to the processor to determine the type of touch event, and then the processor provides a corresponding visual output on the display panel according to the type of touch event.
[0097] The embodiment of the present invention further provides a computer-readable storage medium, which may be a computer-readable storage medium included in the memory in the above embodiment; or a computer-readable storage medium that exists independently and is not installed in a device. The computer-readable storage medium stores at least one instruction, which is loaded and executed by a processor to implement Figure 1The computer readable storage medium may be a read-only memory, a disk or an optical disk, etc.
[0098] The embodiment of the present invention also provides a computer program product, including a computer program / instruction, which is loaded and executed by a processor to implement Figure 1 A text processing method for a program code file is shown.
[0099] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, equipment embodiment and storage medium embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0100] Furthermore, in this document, the terms "comprises," "comprising," or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device that includes the element.
[0101] The above description shows and describes the preferred embodiments of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the invention, through the above teachings or the technology or knowledge of the relevant field. The changes and modifications made by those skilled in the art shall not depart from the spirit and scope of the present invention, and shall be within the scope of protection of the claims attached to the present invention.
Claims
1. A text processing method for a program code file, characterized in that: The method comprises: Obtaining a program code file in a specified directory, identifying a target text including Chinese text in the program code file, and obtaining the text entry and location information of the text entry; Generating a corresponding entry code for each identified text entry according to a preset format; Generate a term replacement text that replaces the term code according to the project type to which the program code file belongs, and replace the text term corresponding to the position information with the term replacement text to obtain a replaced update file; After the text terms are translated into the target language, a language package is generated by encoding the translated text terms and the corresponding terms according to the project type corresponding to the program code file, and the language package is classified according to the first letters of the text terms to obtain multiple language package files.
2. A text processing method for a program code file according to claim 1, characterized in that: The step of identifying the target text including Chinese text in the program code file comprises: The target text including Chinese text in the program code file is identified by a preconfigured regular expression, wherein the regular expression is configured according to the project type to which the program code file belongs and / or different writing methods in the program code file.
3. A text processing method for a program code file according to claim 1, characterized in that: The preset format is LNG_first letter of the term or LNG_first letter of the term_serial number.
4. A text processing method for a program code file according to claim 1, characterized in that: After generating a corresponding entry code for each identified text entry according to a preset format, the method further includes: The text terms, the location information and the term codes are stored and recorded in the constructed database; the database includes a term table, a term reference information table and a language pack information table; the term table is used to record the text terms, the term codes and the translation text in the target language; the term reference information table is used to record the line information of the text terms in the program code file, and the line information is determined according to the location information; the language pack information table is used to record the text terms used in the language pack called in the update file.
5. A text processing method for a program code file according to claim 1, characterized in that: The project type includes a front-end file and a back-end file; the step of generating a term replacement text to replace the term encoding according to the project type to which the program code file belongs includes: When the project type of the program code file is the front-end file, the entry code is processed by using the $lz_t function to generate the entry replacement text including the first entry replacement text; When the project type of the program code file is the backend file, the entry code is processed using the I18nResourceHelper.convertI18nCodes conversion method to generate the entry replacement text including the second entry replacement text.
6. A text processing method for a program code file according to claim 1, characterized in that: After obtaining the replaced update file, the method further includes: By adjusting the regular expression, the update file is identified according to the adjusted regular expression to see whether there is Chinese text, and if so, the corresponding Chinese text is extracted as the text entry to generate the corresponding language pack.
7. A text processing method for a program code file according to claim 1, characterized in that: Before generating the language package, the method further includes: The translated text entries are subjected to quality checks, including grammar checks, terminology consistency checks, and contextual adaptability checks.
8. A text processing device for a program code file, characterized in that: The device comprises: A term recognition unit is used to obtain a program code file in a specified directory, recognize a target text including Chinese text in the program code file, and obtain the text term and location information of the text term; A term code generating unit, used for generating a corresponding term code for each identified text term according to a preset format; An entry replacement unit, configured to generate an entry replacement text to replace the entry code according to the project type to which the program code file belongs, and replace the text entry corresponding to the position information with the entry replacement text to obtain a replaced update file; A language package generating unit is used to translate the text terms into a target language, generate a language package from the translated text terms and the corresponding term encodings according to the project type corresponding to the program code file, and classify the language package according to the first letters of the text terms to obtain multiple language package files.
9. A text processing device for a program code file, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory, wherein the computer program is executed by the processor to implement the steps of a text processing method of a program code file as claimed in any one of claims 1 to 7.
10. A computer program product, comprising a computer program / instruction, wherein the computer program / instruction is executed by the processor to implement the steps of the text processing method of a program code file as claimed in any one of claims 1 to 7.