AI-based Lua code multi-language support automation method and system

By parsing Lua code into an AST and generating unique keys using an AI model, combined with AI translation services, the accuracy and efficiency issues of multilingual support in existing technologies are solved, achieving automated multilingual support for Lua code and reducing maintenance costs.

CN122044569APending Publication Date: 2026-05-15FUJIAN TQ DIGITAL
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FUJIAN TQ DIGITAL
Filing Date
2024-11-15
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing multilingual support methods suffer from insufficient accuracy, inadequate complexity handling, high maintenance costs, lack of dynamism, and low initial translation efficiency when dealing with complex code structures and multiple file dependencies.

Method used

An AI-based automated approach to Lua code multilingual support is adopted. By parsing Lua code into an AST (Abstract Syntax Tree), identifying hard-coded strings and generating unique keys, global deduplication and translation are performed. Combined with AI translation services, multilingual configuration files are generated, and accuracy is ensured through manual review.

Benefits of technology

It enables automatic extraction, deduplication, and dynamic replacement of hard-coded text in Lua code, improving the accuracy and efficiency of multilingual support, reducing maintenance costs, and supporting automated and efficient processing of multiple languages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122044569A_ABST
    Figure CN122044569A_ABST
Patent Text Reader

Abstract

The invention relates to an AI-based Lua code multi-language support automation method and system, and the method comprises the steps: parsing a Lua code, and converting the structure of the Lua code into an AST abstract syntax tree structure; calling an AI model to analyze the Lua code, identifying a character string of a hard code, and generating a unique key; splicing complex character strings; global deduplication is carried out; replacing the hard coded character string with a corresponding unique key according to the unique key generated by the character string after global deduplication; the generated unique key and the content of the hard-coded character string are stored in a configuration file; performing AI translation on the character string content of the original hard code to generate a multi-language version configuration file; performing manual inspection on the configuration file; generating Lua files before extraction and after extraction, and comparing and displaying the Lua files; the auditor can edit the extracted Lua file, a complex code structure and multi-file dependence can be effectively processed, the text extraction and replacement accuracy is high, and automation and high efficiency of multi-language support are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer software engineering, and in particular to a method and system for automating multilingual support of Lua code based on AI. Background Technology

[0002] Existing multilingual support methods typically rely on manually extracting and replacing text content, or using regular expressions for simple text replacement. These methods have significant limitations when dealing with complex code structures and multi-file dependencies, and are prone to incomplete text extraction or inaccurate replacement.

[0003] 3.2 Shortcomings of existing technologies

[0004] 1) Insufficient accuracy: The accuracy of text extraction and replacement using regular expressions is low, and it is easy to miss or mistakenly replace text content.

[0005] 2) Inadequate handling of complexity: It cannot effectively handle complex code structures and multi-file dependencies, especially in cases involving variable concatenation and dynamic text generation.

[0006] 3) High maintenance costs: Manually extracting and replacing text content requires a lot of manpower and is difficult to maintain and expand.

[0007] 4) Insufficient dynamism: Existing methods lack mechanisms for dynamic loading and real-time replacement, and cannot dynamically load text content according to the runtime environment.

[0008] 5) Low efficiency in initial translation: Manually translating text is time-consuming and laborious, resulting in low efficiency in initial translation. Summary of the Invention

[0009] To overcome the significant limitations of existing multilingual support methods when dealing with complex code structures and multiple file dependencies, which can easily lead to incomplete text extraction or inaccurate replacement, the purpose of this invention is to provide an AI-based method and system for automating multilingual support of Lua code. This method and system can effectively handle complex code structures and multiple file dependencies, with high accuracy in text extraction and replacement, thereby achieving automation and efficiency in multilingual support.

[0010] This invention is implemented using the following scheme:

[0011] An AI-based method for automating multi-language support for Lua code, comprising the following steps:

[0012] Step 1: Parse the Lua code and convert its structure into an Abstract Syntax Tree (AST) structure;

[0013] Step 2: Use an AI model to parse the Lua code, identify hard-coded strings, and generate unique keys;

[0014] Step 3: Re-identify the hard-coded string and concatenate the complex strings within the hard-coded string;

[0015] Step 4: After extracting the hard-coded strings, perform global deduplication to ensure that each string generates only one unique key and avoids generating duplicate keys;

[0016] Step 5: Replace the hard-coded string with the corresponding unique key based on the unique key generated after global deduplication;

[0017] Step 6: The generated unique key and hard-coded string content are stored in a configuration file;

[0018] Step 7: Perform AI translation on the original hard-coded string content to generate a multilingual configuration file;

[0019] Step 8: Manually verify the generated multilingual configuration files;

[0020] Step 9: Generate Lua files before and after extraction, and compare and display them;

[0021] Step 10: After generating the comparison file, the reviewers can view the comparison results and manually edit the extracted Lua file.

[0022] Further, step 1 specifically involves: installing the luaparse library, using the luaparse library to parse the Lua code into an AST (Abstract Syntax Tree) structure, outputting the AST structure in JSON format, traversing the nodes of the AST, and identifying and processing nodes of type StringLiteral.

[0023] Furthermore, step 2 specifically involves: selecting an AI model, ensuring that the AI ​​model can handle code parsing tasks and has sufficient contextual understanding; writing a JavaScript function that uses the Axios library to call the OpenAI API, parses Lua code, and identifies hard-coded strings; parsing the AI ​​model's response, extracting the hard-coded strings and the generated unique keys, wherein the AI ​​model's response contains the identified hard-coded strings and their corresponding unique keys.

[0024] Furthermore, step 3 specifically involves: when traversing AST nodes, pre-setting the nodes to be identified in order to identify specific string concatenation expressions, specifically identifying expressions of type StringLiteral with concatenation operators, merging all concatenated parts into a complete string representation, forming a unified expression; generating a unique key for the merged string, and using the unique key to replace the original concatenation content.

[0025] Furthermore, step 7 specifically involves: selecting an AI translation service, writing a JavaScript function, using the Axios library to call the AI ​​translation service, translating the hard-coded string content, calling the AI ​​translation service to translate each extracted text content, and storing the translation results in a configuration file.

[0026] An AI-based system for automating multilingual support of Lua code, comprising: a structure conversion module, a unique key generation module, a string concatenation module, a deduplication module, a unique key replacement module, a storage module, a translation module, a manual verification module, a comparison and display module, and a modification module;

[0027] The structure conversion module is used to parse Lua code and convert the structure of Lua code into an AST (Abstract Syntax Tree) structure.

[0028] The unique key generation module is used to call the AI ​​model to parse the Lua code, identify hard-coded strings, and generate unique keys;

[0029] The string concatenation module is used to re-identify hard-coded strings and concatenate complex strings within the hard-coded strings;

[0030] The deduplication module is used to extract hard-coded strings and then perform global deduplication to ensure that each string generates only one unique key, thus avoiding duplicate key generation.

[0031] The unique key replacement module is used to replace the hard-coded string with the corresponding unique key based on the unique key generated after global deduplication.

[0032] The storage module stores the generated unique key and the original hard-coded string content in a configuration file;

[0033] The translation module is used to perform AI translation on the original hard-coded string content and generate multilingual configuration files;

[0034] The manual inspection module is used to manually inspect the generated multilingual versions of the configuration file;

[0035] The comparison and display module is used to generate Lua files before and after extraction, and to compare and display them.

[0036] The modification module is used to generate a comparison file, allowing reviewers to view the comparison results and manually edit the Lua file.

[0037] Furthermore, the structure conversion module specifically involves: installing the luaparse library, using the luaparse library to parse Lua code into an AST (Abstract Syntax Tree) structure, outputting the AST structure in JSON format, traversing the nodes of the AST, and identifying and processing nodes of type StringLiteral.

[0038] Furthermore, the unique key generation module specifically involves: selecting an AI model, ensuring that the AI ​​model can handle code parsing tasks and has sufficient contextual understanding capabilities; writing a JavaScript function that uses the Axios library to call the OpenAI API, parses Lua code, and identifies hard-coded strings; parsing the AI ​​model's response, extracting the hard-coded strings and the generated unique key, wherein the AI ​​model's response contains the identified hard-coded strings and their corresponding unique keys.

[0039] Furthermore, the string concatenation module works as follows: when traversing AST nodes, pre-defined nodes to be identified are used to identify specific string concatenation expressions, specifically expressions of type StringLiteral with concatenation operators. All concatenated parts are merged into a complete string representation, forming a unified expression. For the merged string, a unique key is generated, and the unique key is used to replace the original concatenated content.

[0040] Furthermore, the translation module specifically involves: selecting an AI translation service, writing a JavaScript function, using the Axios library to call the AI ​​translation service, translating the hard-coded string content, calling the AI ​​translation service for each extracted text content, and storing the translation results in a configuration file.

[0041] The beneficial effects of this invention are as follows:

[0042] This invention provides an AI-based method and system for automating multilingual support for Lua code. Combining a Lua parser and AI technology, it achieves automatic extraction, deduplication, translation, and dynamic replacement of hard-coded text in Lua code. By using a Lua parser library to parse the code into an Abstract Syntax Tree (AST), and utilizing an AI model for code parsing and preliminary translation, unique keys (placeholders) are generated to replace hard-coded text content. Finally, the client automatically parses and loads configuration files, achieving automated and efficient multilingual support. Attached Figure Description

[0043] Figure 1 This is a flowchart of the method of the present invention;

[0044] Figure 2 This is a structural block diagram of the system of the present invention. Detailed Implementation

[0045] The invention will now be further described with reference to the accompanying drawings.

[0046] See Figure 1 An AI-based method for automating multi-language support of Lua code, the steps of which are as follows:

[0047] Step 1: Parse the Lua code and convert its structure into an Abstract Syntax Tree (AST) structure;

[0048] Step 2: Use an AI model to parse the Lua code, identify hard-coded strings, and generate unique keys;

[0049] Step 3: Re-identify the hard-coded string and concatenate the complex strings within the hard-coded string;

[0050] Step 4: After extracting the hard-coded strings, perform global deduplication to ensure that each string generates only one unique key and avoids generating duplicate keys;

[0051] Step 5: Replace the hard-coded string with the corresponding unique key based on the unique key generated after global deduplication;

[0052] Step 6: The generated unique key and the original hard-coded string content are stored in the configuration file;

[0053] Step 7: Perform AI translation on the original hard-coded string content to generate a multilingual configuration file;

[0054] Step 8: Manually verify the generated multilingual configuration files;

[0055] Step 9: Generate Lua files before and after extraction, and compare and display them;

[0056] Step 10: After generating the comparison file, the reviewers can view the comparison results and manually edit the Lua file;

[0057] The present invention will be further described below with reference to a specific embodiment:

[0058] An AI-based method for automating multi-language support of Lua code, comprising the following steps:

[0059] Step 1: Install the luaparse library. The luaparse library parses Lua code into an Abstract Syntax Tree (AST) structure and outputs the AST structure in JSON format. It then traverses the nodes of the AST and identifies and processes nodes of type StringLiteral.

[0060] Parsing Lua code into an Abstract Syntax Tree (AST) structure is a fundamental step in the entire solution. An AST is a tree-like data structure that represents the syntactic structure of code. By parsing Lua code into an AST, we can perform detailed analysis and modification of the code. The goal of this step is to convert Lua code into an AST so that subsequent operations can traverse and modify the code structure.

[0061] Step 1.1: Install the Lua parser library;

[0062] First, you need to install a Lua parser library. luaparse is a powerful JavaScript library that can parse Lua code into an Abstract Syntax Tree (AST).

[0063] Step 1.2: Write the parsing code;

[0064] Write a JavaScript script that uses the luaparse library to parse Lua code into an AST.

[0065]

[0066]

[0067] Step 1.3: Analysis results;

[0068] After running the above code, the luaparse library will parse the Lua code into an AST and output the JSON representation of the AST.

[0069] 4.1.4: Parsing AST Nodes

[0070] To extract the hard-coded string, we need to traverse the AST nodes, identify, and process nodes of type `StringLiteral`. Below is a sample function for recursively traversing the AST nodes:

[0071]

[0072]

[0073]

[0074] Step 2: Select an AI model, ensuring that the AI ​​model can handle code parsing tasks and has sufficient contextual understanding; write a JavaScript function that uses the Axios library to call the OpenAI API, parse Lua code, and identify hard-coded strings; parse the AI ​​model's response, extract the hard-coded strings and the generated unique keys, wherein the AI ​​model's response contains the identified hard-coded strings and their corresponding unique keys.

[0075] After parsing Lua code into an Abstract Syntax Tree (AST), the next step is to use an AI model to assist in code parsing, identify hard-coded strings, and generate unique keys. The AI ​​model can understand the code context through natural language processing techniques, accurately identify the content of the hard-coded strings that need to be extracted, and generate unique keys. The introduction of AI models can significantly improve the accuracy and efficiency of code parsing.

[0076] Step 2.1: Select and configure the AI ​​model;

[0077] Choose a suitable AI model (such as OpenAI's GPT-3 or GPT-4) and configure it accordingly. Ensure the AI ​​model can handle code parsing tasks and has sufficient contextual understanding.

[0078] Step 2.2: Write the code to call the AI ​​model;

[0079] Write a JavaScript function that uses the Axios library to call the OpenAI API, parse Lua code, and identify hard-coded strings.

[0080]

[0081]

[0082]

[0083] Step 2.3: Analyze the AI ​​model's response;

[0084] Parse the AI ​​model's response to extract the hard-coded string and the generated unique key. The AI ​​model's response will contain the recognized text content and its corresponding placeholders.

[0085]

[0086] Step 3: Re-identify the hard-coded string and concatenate complex strings within it. When processing complex string concatenation, it is necessary to ensure consistency before and after concatenation. That is, during the extraction and replacement process, identify and process string concatenation to ensure that the translated sentence correctly conveys the original meaning.

[0087] Step 3.1: Identify string concatenation;

[0088] When traversing AST nodes, identify string concatenation expressions and treat them as a whole.

[0089]

[0090]

[0091] Step 3.2: Merge and concatenate strings;

[0092] The concatenated strings are merged into a single unit and then processed.

[0093]

[0094]

[0095]

[0096] Step 3.3: Process the merged string;

[0097] The merged string is processed to ensure consistency during translation and replacement.

[0098]

[0099] Step 3.4: Replace the merged string

[0100] Replace the merged string with a globally unique key.

[0101]

[0102]

[0103] Step 4: After extracting the hard-coded strings, perform global deduplication to ensure that each string generates only one unique key and avoids generating duplicate keys;

[0104]

[0105] Step 5: Replace the hard-coded string with the corresponding unique key based on the unique key generated after global deduplication; the generated unique key is regularized, so use the unique key to replace the text.

[0106]

[0107] Step 6: The generated unique key and the original hard-coded string content are stored in a configuration file; the configuration file can be in the format of a Lua table, with each key corresponding to a text content.

[0108]

[0109]

[0110] Step 7: Select an AI translation service, write a JavaScript function using the Axios library to call the AI ​​translation service to translate the hard-coded string content. For each extracted text piece, call the AI ​​translation service to translate it, and store the translation results in a configuration file. AI translation can significantly improve the efficiency of the initial translation, and human review and adjustments ensure translation quality. Finally, generate a multilingual configuration file.

[0111] Step 7.1: Select and configure the AI ​​translation service;

[0112] Choose a suitable AI translation service (such as Google Translate API, Microsoft Translator API, or DeepL API) and configure it accordingly. Ensure the AI ​​translation service can handle multilingual translation tasks and has sufficient accuracy.

[0113] Step 7.2: Write the code to call the AI ​​translation service;

[0114] Write a JavaScript function that uses the Axios library to call the Google Translate API to translate the extracted text.

[0115]

[0116]

[0117] Step 7.3: Perform AI translation on the extracted text content;

[0118] For each extracted text content, an AI translation service is invoked to translate it, and the translation results are stored in a configuration file.

[0119]

[0120]

[0121] Step 8: The translation results are checked and verified by professionals, and adjustments are made to any errors found. The platform provides an interface displaying the original text and the translation results, allowing for manual adjustments.

[0122] Step 8.1: Display the translation results;

[0123] Use front-end technologies (such as React or Vue.js) to display the original text and translation results, allowing users to review and make adjustments.

[0124] Step 8.2: Manual editing;

[0125] An editing interface is provided, allowing users to manually edit the translation results.

[0126] Step 8.3: Save the adjustment results;

[0127] After the user finishes editing, they submit the changes, and the system saves the adjusted translation.

[0128] Step 9: Generate Lua files before and after extraction, and compare and display them on the platform. Use front-end technology to display the comparison results and allow users to edit them manually.

[0129]

[0130]

[0131] Step 10: After generating the comparison file, the reviewers can view the comparison results and manually edit the Lua file;

[0132] Step 10.1: Display the comparison files;

[0133] Use front-end technologies (such as React or Vue.js) to display the Lua files before and after extraction, allowing users to compare them.

[0134] Step 10.2: Manual editing;

[0135] Provide an editing interface that allows users to manually edit modified Lua files.

[0136] Step 10.3: Re-extract;

[0137] After the user finishes editing and submits the changes, the system re-parses and extracts the new Lua file content.

[0138] See Figure 2 An AI-based system for automating multilingual support of Lua code, comprising: a structure conversion module, a unique key generation module, a string concatenation module, a deduplication module, a unique key replacement module, a storage module, a translation module, a manual inspection module, a comparison and display module, and a modification module;

[0139] The structure conversion module is used to parse Lua code and convert the structure of Lua code into an AST (Abstract Syntax Tree) structure.

[0140] The unique key generation module is used to call an AI model to parse Lua code and identify hard-coded strings.

[0141] And generate a unique key;

[0142] The string concatenation module is used to re-identify hard-coded strings and concatenate complex strings within the hard-coded strings;

[0143] The deduplication module is used to extract hard-coded strings and then perform global deduplication to ensure that each string generates only one unique key, thus avoiding duplicate key generation.

[0144] The unique key replacement module is used to replace the hard-coded string with the corresponding unique key based on the unique key generated after global deduplication.

[0145] The storage module stores the generated unique key and the original hard-coded string content in a configuration file;

[0146] The translation module is used to perform AI translation on the original hard-coded string content and generate multilingual configuration files;

[0147] The manual inspection module is used to manually inspect the generated multilingual versions of the configuration file;

[0148] The comparison and display module is used to generate Lua files before and after extraction, and to compare and display them.

[0149] The modification module is used to generate a comparison file, allowing reviewers to view the comparison results and manually edit the Lua file.

[0150] In one embodiment of the present invention, the structure conversion module specifically includes: installing the luaparse library, parsing Lua code into an AST (Abstract Syntax Tree) structure using the luaparse library, outputting the AST structure in JSON format, traversing the nodes of the AST, and identifying and processing nodes of type StringLiteral.

[0151] In one embodiment of the present invention, the unique key generation module specifically comprises: selecting an AI model, wherein the AI ​​model is capable of handling code parsing tasks and has sufficient contextual understanding capabilities; writing a JavaScript function that uses the Axios library to call the OpenAI API, parses Lua code and identifies hard-coded strings; parsing the response of the AI ​​model, extracting the hard-coded strings and the generated unique key, wherein the response of the AI ​​model includes the identified hard-coded strings and their corresponding unique keys.

[0152] In one embodiment of the present invention, the string concatenation module specifically involves: when traversing AST nodes, pre-setting the nodes to be identified in order to identify specific string concatenation expressions (i.e., the traversal process needs to pay attention to the node type in order to identify specific string concatenation expressions), specifically identifying expressions of type StringLiteral with concatenation operators;

[0153] In an AST, string concatenation is typically represented using the `..` operator. We need to examine each node to find those containing the type `StringLiteral` and expressions with concatenation operators. For example:

[0154] local message="Hello,"..name.."!"

[0155] In this example, `"Hello,"` and `"!"` are two nodes of type `StringLiteral`, while `name` is a variable.

[0156] All the concatenated parts are merged into a single complete string representation, forming a unified expression;

[0157] Once the concatenated expression is identified, we treat these string parts as a whole. We merge all the concatenated parts into a single, complete string representation, forming a unified expression. For the example above, it can be merged into:

[0158] "Hello,"..name.."!"-->'["@@2550670158",'..name..']'

[0159] Here, `@@2550670158` is a unique key generated for the merged string.

[0160] For the merged string, generate a unique key and use the unique key to replace the original concatenated content.

[0161] This unique key can be used for subsequent configuration file storage and text replacement. The identified concatenated expressions are replaced with the new format, using the generated unique key to replace the original hard-coded string, while retaining the variable portion. For example:

[0162] local message='["@@2550670158",'..name..']'

[0163] In the configuration file, add the mapping relationship between the corresponding unique key and the original text:

[0164] @@2550670158 = "Hello,{0}"

[0165] The `{0}` here is a placeholder, reserved for future dynamic replacement of the `name` parameter.

[0166] This holistic approach allows us to effectively manage string concatenation in Lua code, ensuring flexibility and accuracy in subsequent dynamic loading and multi-language support.

[0167] In one embodiment of the present invention, the translation module specifically comprises: selecting an AI translation service, writing a JavaScript function, using the Axios library to call the AI ​​translation service, translating the hard-coded string content, calling the AI ​​translation service to translate each extracted text content, and storing the translation result in a configuration file.

[0168] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should be included in the scope of the present invention.

Claims

1. A method for automating multi-language support of Lua code based on AI, characterized in that, The method steps are as follows: Step 1: Parse the Lua code and convert its structure into an Abstract Syntax Tree (AST) structure; Step 2: Use an AI model to parse the Lua code, identify hard-coded strings, and generate unique keys; Step 3: Re-identify the hard-coded string and concatenate the complex strings within the hard-coded string; Step 4: After extracting the hard-coded strings, perform global deduplication to ensure that each string generates only one unique key and avoids generating duplicate keys; Step 5: Replace the hard-coded string with the corresponding unique key based on the unique key generated after global deduplication; Step 6: The generated unique key and hard-coded string content are stored in a configuration file; Step 7: Perform AI translation on the original hard-coded string content to generate a multilingual configuration file; Step 8: Manually verify the generated multilingual configuration files; Step 9: Generate Lua files before and after extraction, and compare and display them; Step 10: After generating the comparison file, the reviewers can view the comparison results and manually edit the extracted Lua file.

2. The method for automating multi-language support of Lua code based on AI according to claim 1, characterized in that, Step 1 specifically involves: installing the luaparse library, using the luaparse library to parse Lua code into an AST (Abstract Syntax Tree) structure, outputting the AST structure in JSON format, traversing the nodes of the AST, and identifying and processing nodes of type StringLiteral.

3. The method for automating multi-language support of Lua code based on AI according to claim 1, characterized in that, Step 2 specifically involves: selecting an AI model, ensuring that the AI ​​model can handle code parsing tasks and has sufficient contextual understanding; writing a JavaScript function that uses the Axios library to call the OpenAI API, parses Lua code, and identifies hard-coded strings; parsing the AI ​​model's response, extracting the hard-coded strings and the generated unique keys, wherein the AI ​​model's response contains the identified hard-coded strings and their corresponding unique keys.

4. The method for automating multi-language support of Lua code based on AI according to claim 1, characterized in that, Step 3 specifically involves: when traversing AST nodes, pre-setting the nodes to be identified in order to identify specific string concatenation expressions, specifically identifying expressions of type StringLiteral with concatenation operators, merging all concatenated parts into a complete string representation, forming a unified expression; generating a unique key for the merged string, and using the unique key to replace the original concatenation content.

5. The method for automating multi-language support of Lua code based on AI according to claim 1, characterized in that, Step 7 specifically involves: selecting an AI translation service, writing a JavaScript function, using the Axios library to call the AI ​​translation service, translating the hard-coded string content, calling the AI ​​translation service to translate each extracted text content, and storing the translation results in a configuration file.

6. An AI-based system for automating multi-language support of Lua code, characterized in that: The system includes: a structure conversion module, a unique key generation module, a string concatenation module, a deduplication module, a unique key replacement module, a storage module, a translation module, a manual inspection module, a comparison and display module, and a modification module; The structure conversion module is used to parse Lua code and convert the structure of Lua code into an AST (Abstract Syntax Tree) structure. The unique key generation module is used to call an AI model to parse Lua code and identify hard-coded strings. And generate a unique key; The string concatenation module is used to re-identify hard-coded strings and concatenate complex strings within the hard-coded strings; The deduplication module is used to extract hard-coded strings and then perform global deduplication to ensure that each string generates only one unique key, thus avoiding duplicate key generation. The unique key replacement module is used to replace the hard-coded string with the corresponding unique key based on the unique key generated after global deduplication. The storage module stores the generated unique key and the original hard-coded string content in a configuration file; The translation module is used to perform AI translation on the original hard-coded string content and generate multilingual configuration files; The manual inspection module is used to manually inspect the generated multilingual versions of the configuration file; The comparison and display module is used to generate Lua files before and after extraction, and to compare and display them. The modification module is used to generate a comparison file, allowing reviewers to view the comparison results and manually edit the Lua file.

7. The AI-based system for automating multi-language support of Lua code according to claim 6, characterized in that, The structure conversion module specifically involves: installing the luaparse library, using the luaparse library to parse Lua code into an AST (Abstract Syntax Tree) structure, outputting the AST structure in JSON format, traversing the nodes of the AST, and identifying and processing nodes of type StringLiteral.

8. The AI-based system for automating multi-language support of Lua code according to claim 6, characterized in that, The unique key generation module specifically involves: selecting an AI model, ensuring that the AI ​​model can handle code parsing tasks and has sufficient contextual understanding; writing a JavaScript function that uses the Axios library to call the OpenAI API, parses Lua code, and identifies hard-coded strings; parsing the AI ​​model's response, extracting the hard-coded strings and the generated unique key, wherein the AI ​​model's response contains the identified hard-coded strings and their corresponding unique keys.

9. The AI-based system for automating multi-language support of Lua code according to claim 6, characterized in that, The string concatenation module works as follows: When traversing AST nodes, it pre-defines the nodes to be identified in order to identify specific string concatenation expressions, specifically expressions of type StringLiteral with concatenation operators. It then merges all the concatenated parts into a complete string representation, forming a unified expression. For the merged string, it generates a unique key and uses the unique key to replace the original concatenated content.

10. The AI-based system for automating multilingual support of Lua code according to claim 6, characterized in that, The translation module specifically involves: selecting an AI translation service, writing a JavaScript function, using the Axios library to call the AI ​​translation service, translating the hard-coded string content, calling the AI ​​translation service for each extracted text content, and storing the translation results in a configuration file.