Text localization method and device, computer equipment and storage medium
By obtaining the configuration table and language text, the localization data table is generated, which solves the problem of string storage occupying a large amount of memory in game text localization, reduces game maintenance costs, and improves the efficiency and accuracy of text localization.
Patent Information
- Application Number
- CN202410581209.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-11
- Publication Date
- 2024-09-03
AI Technical Summary
In the existing technology, when localizing game text, the storage of strings occupies a large amount of memory, resulting in high game maintenance costs and a lack of effective solutions.
By obtaining the configuration table, determining the fields to be localized and their integer keys, obtaining the language text, generating the localized table, and using the table import tool to convert it into a localized data table, it reduces memory usage and game maintenance costs.
It effectively reduces the memory usage of data tables required for text localization, reduces the cost of game maintenance, and improves the efficiency and accuracy of text localization.
Smart Images

Figure CN118586406A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of text processing, and in particular to a text localization method, apparatus, computer equipment and storage medium. Background Art
[0002] With the rapid development of mobile Internet technology, game text localization is a very important part of the game development process. It can improve the game's global acceptance and sales, and enable the game to better adapt to the market demands and cultural backgrounds of different regions.
[0003] In the prior art, when localizing game text, it is necessary to first assign corresponding character strings, such as Chinese characters, pinyin, English abbreviations, etc., to the original text; then, the character strings and the texts in various languages corresponding to the original text are stored; when localizing the text, it is necessary to use the character strings to find the target language text corresponding to the original text; however, in actual applications, once the amount of text is too large, the storage of the character strings will occupy more memory, resulting in more time and manpower required for game maintenance, which in turn leads to higher game maintenance costs.
[0004] With respect to the problem of high game maintenance cost existing in the prior art, no effective solution has been proposed yet. Summary of the invention
[0005] Based on this, it is necessary to provide a text localization method, apparatus, computer device and storage medium to address the above technical issues.
[0006] In a first aspect, the present application provides a text localization method, the method comprising:
[0007] Get the configuration table;
[0008] Determine, according to the configuration table, a field to be localized and an integer key corresponding to each text in the field to be localized;
[0009] Obtain the language text corresponding to each of the texts in the field to be localized;
[0010] Determine a localization table according to each text in the field to be localized, the corresponding integer key and the language text;
[0011] A first localization data table and a second localization data table are generated according to the configuration table and the localization table.
[0012] In one embodiment, determining a plurality of fields to be localized and an integer key corresponding to each text in the fields to be localized according to the configuration table includes:
[0013] Determine the configuration information to be localized corresponding to the configuration table according to the user input information;
[0014] According to the configuration information to be localized, a field to be localized and an integer key corresponding to each text in the field to be localized are determined.
[0015] In one embodiment, determining the field to be localized and the integer key corresponding to each text in the field to be localized according to the configuration information to be localized includes:
[0016] Writing the configuration information to be localized into a configuration file;
[0017] Load the configuration file, and obtain all texts in the field to be localized from the configuration table;
[0018] According to all the texts in the field to be localized, obtaining from the configuration table a first primary key corresponding to each text in the field to be localized;
[0019] Determine, according to each of the first primary keys, a string key value corresponding to each text in the field to be localized;
[0020] According to each of the string key values, an integer key corresponding to each text in the field to be localized is determined.
[0021] In one embodiment, the localization table includes: a primary key column, a string key value column, an original language column, and a target language column; determining the localization table according to each text in the field to be localized, the corresponding integer key, and the language text, includes:
[0022] Add each text in the to-be-localized field to the original language column;
[0023] Add the string key value corresponding to each text in the field to be localized to the string key value column;
[0024] Adding the integer key corresponding to each text in the field to be localized to the primary key column;
[0025] The language text corresponding to each text in the field to be localized is added to the target language column to generate a localization table.
[0026] In one embodiment, adding the integer key corresponding to each text in all the fields to be localized to the primary key column includes:
[0027] Using the integer key corresponding to each text in the field to be localized as the target integer key in turn;
[0028] Get the original key in the primary key column, and if the target integer key is different from the original key, add the target integer key to the primary key column;
[0029] If the target integer key is the same as the original key, and the text corresponding to the target integer key is different from the text corresponding to the original key, the target integer key is adjusted by a preset threshold until the target integer key is different from the original key, and the adjusted target integer key is added to the primary key column.
[0030] In one embodiment, generating a first localization data table and a second localization data table according to the configuration table and the localization table respectively includes:
[0031] Using a table import tool, converting the configuration table into an original data table;
[0032] Replace each text in the to-be-localized field in the original data table with a corresponding integer key to obtain a first localized data table;
[0033] Use the table import tool to convert the localized table into a second localized data table.
[0034] In one embodiment, the method further comprises:
[0035] Loading the first localized data table and the second localized data table;
[0036] Acquire a key to be displayed input by a user based on an interactive interface; the key to be displayed is an integer key corresponding to a field to be localized in a first localization data table;
[0037] According to the key to be displayed, the language text corresponding to the key to be displayed is searched from the second localization data table and displayed.
[0038] In a second aspect, the present application further provides a text localization device, the device comprising:
[0039] A first acquisition module, used to acquire a configuration table;
[0040] A first determination module, configured to determine, according to the configuration table, a field to be localized and an integer key corresponding to each text in the field to be localized;
[0041] A second acquisition module, used for acquiring a language text corresponding to each of the texts in the field to be localized;
[0042] A second determination module, configured to determine a localization table according to each text in the field to be localized, a corresponding integer key and a language text;
[0043] The generating module is used to generate a first localized data table and a second localized data table respectively according to the configuration table and the localized table.
[0044] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any one of the embodiments of the first aspect is implemented.
[0045] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in any one of the embodiments of the first aspect above is implemented.
[0046] The above-mentioned text localization method, device, computer equipment and storage medium first obtain a configuration table; secondly, according to the configuration table, determine the field to be localized and the integer key corresponding to each text in the field to be localized; further, obtain the language text corresponding to each text in the field to be localized; according to each text in the field to be localized, the corresponding integer key and the language text, determine the localization table; further, according to the configuration table and the localization table, respectively generate a first localization data table and a second localization data table; based on the integer key, the memory usage can be effectively reduced, so that the first localization data table and the second localization data table required for text localization are more streamlined, thereby effectively reducing the cost of game maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The drawings described herein are used to provide a further understanding of the present application. They constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0048] Figure 1 A diagram of an application environment of a text localization method in an embodiment;
[0049] Figure 2 is a flowchart of a text localization method in an embodiment;
[0050] Figure 3 A schematic diagram of an item configuration table in an embodiment;
[0051] Figure 4 A schematic diagram of a localization table in one embodiment;
[0052] Figure 5 A schematic diagram of a first localized data table corresponding to an item configuration table in an embodiment;
[0053] Figure 6 is a structural block diagram of a text localization device in an embodiment;
[0054] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0056] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the", "these" and the like in this application do not represent quantitative restrictions, and they can be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether directly or indirectly. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. Usually, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0057] The text localization method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The terminal 102 obtains the configuration table from the server 104 through the network; according to the configuration table, the field to be localized and the integer key corresponding to each text in the field to be localized are determined; the language text corresponding to each text in the field to be localized is obtained; according to each text in the field to be localized, the corresponding integer key and the language text, the localization table is determined; according to the configuration table and the localization table, a first localization data table and a second localization data table are generated respectively. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones and tablet computers. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0058] In one embodiment, Figure 2 As shown, Figure 2 is a flowchart of a text localization method in an embodiment; this embodiment applies the method to Figure 1 The terminal in the example is used for explanation. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0059] Step S201, obtaining a configuration table.
[0060] Among them, the configuration table refers to an Excel table used to store game planning data, which is composed of a grid of rows and columns; the planning data can be but not limited to text, numbers, formulas, and charts. It should be noted that the number of configuration tables can be one or more, and the number needs to be determined according to the actual game development needs, and is not specifically limited here; for example, the configuration table can be but not limited to an item configuration table and a task configuration table; the item configuration table is used to store item names, descriptions and other data; the task configuration table is used to store task names, descriptions, dialogues and other data.
[0061] Step S202: Determine the field to be localized and the integer key corresponding to each text in the field to be localized according to the configuration table.
[0062] The field to be localized refers to a field that needs to be localized, ie, translated; the integer key refers to a key value whose data type is an integer; and the number of bits of the integer key can be, but is not limited to, 32 bits.
[0063] For example, when the configuration table is an item configuration table, if the field to be localized is the item name field, each text in the field to be localized refers to each item name in the item name field; the integer key corresponding to each text in the field to be localized refers to the integer key corresponding to each item name in the item name field.
[0064] Step S203, obtaining the language text corresponding to each text in the field to be localized.
[0065] The language text refers to different language texts corresponding to the original text. For example, if the original text is in Chinese, the language text corresponding to each text in the field to be localized may be different language texts such as English and Korean translated based on the original text.
[0066] Step S204: determining a localization table according to each text in the field to be localized, the corresponding integer key and the language text.
[0067] The localization table refers to an Excel table used to store text localization information; the text localization information at least includes an integer key, an original text, and a language text; the original text includes each text in the field to be localized.
[0068] Step S205 , generating a first localized data table and a second localized data table respectively according to the configuration table and the localized table.
[0069] Among them, the first localized data table and the second localized data table refer to data tables that can be used for game development; the formats of the first localized data table and the second localized data table can be but are not limited to text format and binary format, and need to be set according to the game loading method, and are not specifically limited here; it is understandable that since the configuration table and the localization table are both Excel tables, they cannot be directly used for game development or text localization processing, so it is necessary to convert the configuration table and the localization table into data tables that can be used for game development or text localization processing, that is, the first localized data table and the second localized data table; it should be noted that when there are multiple configuration tables, each configuration table has a corresponding first localized data table.
[0070] Specifically, a first localized data table is generated based on the configuration table, and a second localized data table is generated based on the localized table, which provides data support for localization processing of the fields to be localized.
[0071] In this embodiment, based on the configuration table, the field to be localized and the integer key corresponding to each text in the field to be localized can be accurately determined; each text in the field to be localized, the corresponding integer key and the language text are stored in the localization table in sequence, and by converting the configuration table and the localization table, a first localization data table and a second localization data table that can be used for game development or text localization processing are obtained, laying a data foundation for realizing text localization; based on the integer key, the memory usage can be effectively reduced, making the first localization data table and the second localization data table required for text localization more streamlined, without investing a lot of time and manpower in game maintenance, effectively reducing the cost of game maintenance.
[0072] In one embodiment, determining a plurality of fields to be localized and an integer key corresponding to each text in the fields to be localized according to a configuration table includes the following steps:
[0073] Step 1: Determine the configuration information to be localized based on the user input information.
[0074] Step 2: Determine the field to be localized and the integer key corresponding to each text in the field to be localized according to the configuration information to be localized.
[0075] The user input information at least includes the table name of the configuration table and the field name of the field to be localized; the configuration information to be localized corresponds to the user input information, that is, the configuration information to be localized at least includes the table name of the configuration table and the field name of the field to be localized. It can be understood that based on the configuration information to be localized, the configuration table that needs to be localized and the field in the configuration table that needs to be localized can be clearly identified.
[0076] For example, assuming that the user input information is an item configuration table and an item name field, the configuration information to be localized includes the item configuration table and the item name field.
[0077] Preferably, step 2, determining the field to be localized and the integer key corresponding to each text in the field to be localized according to the configuration information to be localized, comprises the following steps:
[0078] Step 2.1, write the configuration information to be localized into the configuration file.
[0079] The configuration file may be, but is not limited to, a JSON (JavaScript Object Notation) configuration file; JSON is a lightweight data exchange format that is easy for humans to read and write, and is also easy for machines to parse and generate.
[0080] Step 2.2, load the configuration file and obtain all texts in the fields to be localized from the configuration table.
[0081] Step 2.3, according to all the texts in the field to be localized, obtain the first primary key corresponding to each text in the field to be localized from the configuration table.
[0082] The first primary key refers to the unique identifier corresponding to each text in the field to be localized. It should be noted that each text has a unique first primary key, which can be automatically generated by a relevant software algorithm or manually given, and is not specifically limited here.
[0083] For example, Figure 3 For example, assuming that the table name of the configuration table is the item configuration table, and the field to be localized is the item name field, the item configuration table and the item name field are written into the configuration file respectively; by loading the configuration file, all item names in the item name field can be automatically obtained from the item configuration table, such as "Chaos Amber", "Fallen Paradise", "Star Dancing Galaxy", etc.; further, the first primary key corresponding to each item name in the item name field can also be obtained from the item configuration table, for example, the first primary key corresponding to "Chaos Amber" is "100101", and the first primary key corresponding to "Fallen Paradise" is "100102".
[0084] Step 2.4: Determine the string key value corresponding to each text in the field to be localized according to each first primary key.
[0085] Among them, the string key value refers to a character array in a custom format. It should be noted that when customizing the format of the string key value, it is necessary to ensure that each text in the field to be localized has a unique corresponding string key value. For example, assume that the format of the string key value is "table name [first primary key]. field to be localized", and assume that the configuration table is the item configuration table and the field to be localized is the item name field; if the first primary key corresponding to "Chaos Amber" in the item name field is "100101", then the string key value corresponding to "Chaos Amber" is "Item[100101].Name", where "Item" refers to the table name, that is, the item configuration table; "100101" refers to the first primary key corresponding to "Chaos Amber"; and "Name" refers to the field to be localized, that is, the item name field.
[0086] Step 2.5: Determine the integer key corresponding to each text in the field to be localized according to each string key value.
[0087] The integer key refers to a key value whose data type is an integer; the number of bits of the integer key can be but is not limited to 32 bits.
[0088] Specifically, according to each string key value, a CRC (Cyclic Redundancy Check) algorithm is used to generate an integer key corresponding to each text in the field to be localized; wherein the CRC algorithm is a cyclic redundancy check algorithm, which generates a corresponding check value by bit-wise processing of input data.
[0089] For example, assuming that the string key value corresponding to "Chaotic Amber" is "Item[100101].Name", the CRC algorithm can be used to generate the integer value corresponding to "Chaotic Amber" as "916946416".
[0090] In this embodiment, through the configuration information to be localized and the configuration file, the corresponding fields to be localized and the first primary key corresponding to each text in the fields to be localized can be automatically obtained from the corresponding configuration table; based on the first primary key corresponding to each text, the corresponding string key value can be determined first; further, the integer key corresponding to each string key value can be calculated through the CRC algorithm, which lays the foundation for reducing the maintenance cost of the game.
[0091] In one embodiment, the localization table includes: a primary key column, a string key value column, an original language column, and a target language column; determining the localization table according to each text in the field to be localized, the corresponding integer key, and the language text includes the following steps:
[0092] Add each text in the field to be localized to the original language column;
[0093] Add the string key value corresponding to each text in the field to be localized to the string key value column;
[0094] Add the integer key corresponding to each text in the field to be localized to the primary key column;
[0095] Add the language text corresponding to each text in the field to be localized to the target language column to generate a localization table.
[0096] Among them, the localization table includes a primary key column, a string key value column, an original language column and a target language column; the primary key column is used to store the integer key corresponding to each text in the field to be localized; the string key value column is used to store the string key value corresponding to each text in the field to be localized; the original language column is used to store each text in the field to be localized; the target language column is used to store the language text corresponding to each text in the field to be localized.
[0097] For example, see Figure 4, assuming that the configuration table is the item configuration table, and the fields to be localized are the item name field and the description field, then add each text in the item name field and the text in the description field to the original language column, for example, add "Chaos Amber", "Fallen Paradise", "Item Description", etc. to the original language column of the localization table; add the string key value corresponding to each text in the item name field and the string key value corresponding to the text in the description field to the string key value column, for example, add the string key value "Item[100101].Name" corresponding to "Chaos Amber", the string key value "Item[100102].Name" corresponding to "Fallen Paradise", and the string key value "Item[100103].Name" corresponding to "Item Description". The string key value "Item[100101].Desc" is added to the string key value column of the localization table; the integer key corresponding to each text in the item name field and the integer key corresponding to the text in the description field are added to the primary key column. For example, the integer value "916946416" corresponding to "Chaos Amber", the integer key "122644339" corresponding to "Fallen Paradise", and the integer key "1664200638" corresponding to "Item Description" are added to the primary key column of the localization table; the language text corresponding to each text in the item name field and the language text corresponding to the text in the description field are added to the target language column; based on this, a localization table can be generated; it should be noted that Figure 4 The language text corresponding to each text in the item name field and the language text corresponding to the text in the description field are not displayed. The language text needs to be set and added according to the actual language environment requirements, and no specific restrictions are made here.
[0098] In this embodiment, each text in the field to be localized, the string key value corresponding to each text, the integer key corresponding to each text, and the language text corresponding to each text are added to the original language column, the string key value column, the primary key column, and the target language column, respectively, to generate a localization table, laying a data foundation for realizing text localization.
[0099] In one embodiment, adding an integer key corresponding to each text in all fields to be localized to the primary key column includes the following steps:
[0100] Step 1: Use the integer key corresponding to each text in the field to be localized as the target integer key in turn;
[0101] Step 2: Get the original key in the primary key column. If the target integer key is different from the original key, add the target integer key to the primary key column.
[0102] Step 3: If the target integer key is the same as the original key, and the text corresponding to the target integer key is different from the text corresponding to the original key, adjust the target integer key by a preset threshold until the target integer key is different from the original key, and add the adjusted target integer key to the primary key column.
[0103] It should be noted that the CRC algorithm may convert different string key values into the same integer key. Therefore, conflicting integer keys need to be optimized to ensure that each text in the field to be localized has a unique corresponding integer key.
[0104] Among them, original key refers to all integer keys added to the primary key column of the localized table; target integer key refers to the integer key to be added to the primary key column of the localized table; the preset threshold needs to be set according to the actual optimization requirements and is not specifically limited here; for example, assuming that the preset threshold is 1, adjusting the target integer key by the preset threshold means that the target integer key is incremented by 1.
[0105] Specifically, first, use the integer key corresponding to each text in the field to be localized as the target integer key, that is, the integer key to be added to the primary key column of the localization table; secondly, obtain the original key in the primary key column, that is, all the integer keys that have been added to the primary key column of the localization table; compare the target integer key with the original key to determine whether the target integer key conflicts with the original key; if the target integer key is different from the original key, directly add the target integer key to the primary key column; if the target integer key is the same as the original key, it is necessary to determine whether the text corresponding to the target integer key is the same as the text corresponding to the original key; if the target integer key is the same as the original key, it is necessary to determine whether the text corresponding to the target integer key is the same as the text corresponding to the original key; If the text corresponding to the target integer key is different from the text corresponding to the original key, the target integer key is adjusted according to the preset threshold. For example, when the preset threshold is 1, the target integer key is incremented by 1 until the target integer key is different from the original key, and the adjusted target integer key is added to the primary key column; if the text corresponding to the target integer key is the same as the text corresponding to the original key, it means that the text corresponding to the current target integer key and the current target integer key already exist in the localization table and do not need to be added repeatedly; further continue to determine the next target integer key, and execute the above steps in sequence until all target integer keys are added to the localization table.
[0106] In this embodiment, the target integer key is adjusted based on a preset threshold so that the target integer key is different from the original key, thereby avoiding the problem of different texts corresponding to the same integer key and ensuring that each text has a unique corresponding integer key. Based on this, the accuracy of text localization can be ensured.
[0107] In one embodiment, generating a first localization data table and a second localization data table respectively according to a configuration table and a localization table includes the following steps:
[0108] Use the table import tool to convert the configuration table into the original data table;
[0109] Replace each text in the to-be-localized field in the original data table with a corresponding integer key to obtain a first localized data table;
[0110] Use the table import tool to convert the localized table into a second localized data table.
[0111] The table export tool is used to convert Excel tables into other table formats that can be used for game development or text localization processing; the table export tool can be, but is not limited to, related software used for table format conversion in the prior art, which is not specifically limited here. It should be noted that each configuration table has a corresponding first localized data table.
[0112] For example, see Figure 5 , assuming the configuration table is Figure 1 , use the table import tool to convert the item configuration table into an original data table; further, replace each text in the to-be-localized field in the original data table, i.e., the item name field and the description field, with the corresponding integer key, to obtain the following: Figure 5 The first localized data table is shown.
[0113] In this embodiment, the first localized data table and the second localized data table can be obtained respectively by using the table import tool for use in game development and text localization; each text in the to-be-localized field in the original data table is replaced with a corresponding integer key to obtain a more streamlined first localized data table, which can effectively reduce memory usage, avoid a lot of time and manpower investment during game maintenance, and reduce game maintenance costs.
[0114] In one embodiment, the text localization method further includes the following steps:
[0115] Step 1, loading the first localized data table and the second localized data table;
[0116] Step 2, obtaining a key to be displayed input by the user based on the interactive interface; the key to be displayed is an integer key corresponding to the field to be localized in the first localization data table;
[0117] Step 3: according to the key to be displayed, search the language text corresponding to the key to be displayed from the second localization data table and display it.
[0118] For example, assuming that the user has pre-set the localized language type, when the game is running, the first localized data table and the second localized data table need to be loaded first; after the loading is completed, the key to be displayed input by the user based on the interactive interface is obtained. For example, when the user needs to display the name of an item corresponding to an item in the interactive interface, it can be but not limited to selecting the item by moving the mouse, and obtaining the key to be displayed corresponding to the item, that is, the integer key; further, according to the localized language type, the language text corresponding to the integer key that is the same as the key to be displayed is searched from the second localized table through the key to be displayed, and the language text is displayed on the interactive interface; it should be noted that the above language text corresponds to the localized language type; the localized language type needs to be set according to the actual localization requirements, and is not specifically limited here; for example, if the localized language type is English, the English corresponding to the integer key that is the same as the key to be displayed is searched from the second localized table through the key to be displayed, and the found English is displayed on the interactive interface.
[0119] In this embodiment, based on the key to be displayed, that is, the integer key, the language text corresponding to the key to be displayed is searched in the second localized data table, which improves the search efficiency of the language text and further improves the efficiency of text localization.
[0120] In the first aspect, the above-mentioned text localization method can accurately determine the field to be localized and the integer key corresponding to each text in the field to be localized based on the configuration table; each text in the field to be localized, the corresponding integer key and the language text are stored in the localization table in sequence, and by converting the configuration table and the localization table, a first localization data table and a second localization data table that can be used for game development or text localization processing are obtained, laying a data foundation for realizing text localization; based on the integer key, the memory usage can be effectively reduced, making the first localization data table and the second localization data table required for text localization more streamlined, without investing a lot of time and manpower in game maintenance, effectively reducing The cost of game maintenance is reduced; secondly, the target integer key is adjusted based on a preset threshold so that the target integer key is different from the original key, thereby avoiding the problem of different texts corresponding to the same integer key, and ensuring that each text has a unique corresponding integer key. Based on this, the accuracy of text localization can be ensured; thirdly, each text in the to-be-localized field in the original data table is replaced with the corresponding integer key to obtain a more streamlined first localized data table, which can effectively reduce memory usage and further reduce game maintenance costs; fourthly, based on the to-be-displayed key, the language text corresponding to the to-be-displayed key is searched in the second localized data table, thereby improving the efficiency of language text search and thereby improving the efficiency of text localization.
[0121] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0122] Based on the same inventive concept, the embodiment of the present application also provides a text localization device for implementing the text localization method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more text localization device embodiments provided below can refer to the limitations of the text localization method above, and will not be repeated here.
[0123] In one embodiment, Figure 6 As shown, Figure 6 6 is a structural block diagram of a text localization device in an embodiment; the text localization device includes: a first acquisition module 601, a first determination module 602, a second acquisition module 603, a second determination module 604, and a generation module 605;
[0124] The first acquisition module 601 is used to acquire a configuration table;
[0125] A first determination module 602, configured to determine the field to be localized and the integer key corresponding to each text in the field to be localized according to the configuration table;
[0126] The second acquisition module 603 is used to acquire the language text corresponding to each text in the field to be localized;
[0127] A second determination module 604, configured to determine a localization table according to each text in the field to be localized, the corresponding integer key and the language text;
[0128] The generating module 605 is used to generate a first localized data table and a second localized data table according to the configuration table and the localized table.
[0129] In one embodiment, the first determining module 602 is further configured to:
[0130] According to the user input information, determine the configuration information to be localized corresponding to the configuration table;
[0131] According to the configuration information to be localized, determine the field to be localized and the integer key corresponding to each text in the field to be localized.
[0132] In one embodiment, the first determining module 602 is further configured to:
[0133] Write the configuration information to be localized into the configuration file;
[0134] Load the configuration file and get all the text in the fields to be localized from the configuration table;
[0135] According to all the texts in the field to be localized, obtain the first primary key corresponding to each text in the field to be localized from the configuration table;
[0136] According to each first primary key, determine the string key value corresponding to each text in the field to be localized;
[0137] Based on each string key value, determine the integer key corresponding to each text in the field to be localized.
[0138] In one embodiment, the localization table includes: a primary key column, a string key value column, an original language column, and a target language column; the second determination module 604 is also used to
[0139] Add each text in the field to be localized to the original language column;
[0140] Add the string key value corresponding to each text in the field to be localized to the string key value column;
[0141] Add the integer key corresponding to each text in the field to be localized to the primary key column;
[0142] Add the language text corresponding to each text in the field to be localized to the target language column to generate a localization table.
[0143] In one embodiment, the second determining module 604 is further configured to:
[0144] Use the integer key corresponding to each text in the field to be localized as the target integer key in turn;
[0145] Get the original key in the primary key column. If the target integer key is different from the original key, add the target integer key to the primary key column.
[0146] If the target integer key is the same as the original key, and the text corresponding to the target integer key is different from the text corresponding to the original key, the target integer key is adjusted by a preset threshold until the target integer key is different from the original key, and the adjusted target integer key is added to the primary key column.
[0147] In one embodiment, the generating module 605 is further used to
[0148] Use the table import tool to convert the configuration table into the original data table;
[0149] Replace each text in the to-be-localized field in the original data table with a corresponding integer key to obtain a first localized data table;
[0150] Use the table import tool to convert the localized table into a second localized data table.
[0151] The text localization device also includes: a display module;
[0152] A display module, used for loading the first localized data table and the second localized data table;
[0153] Obtaining a key to be displayed input by the user based on the interactive interface; the key to be displayed is an integer key corresponding to the field to be localized in the first localized data table;
[0154] According to the key to be displayed, the language text corresponding to the key to be displayed is searched from the second localization data table and displayed.
[0155] Each module in the above text localization device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0156] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a text localization method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0157] Those skilled in the art will understand that Figure 7The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0158] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0159] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0160] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0161] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0162] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0163] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A text localization method, characterized in that: The method comprises: Get the configuration table; Determine, according to the configuration table, a field to be localized and an integer key corresponding to each text in the field to be localized; Obtain the language text corresponding to each of the texts in the field to be localized; Determine a localization table according to each text in the field to be localized, the corresponding integer key and the language text; A first localization data table and a second localization data table are generated according to the configuration table and the localization table.
2. The text localization method according to claim 1, characterized in that: The step of determining a plurality of fields to be localized and an integer key corresponding to each text in the fields to be localized according to the configuration table includes: Determine the configuration information to be localized corresponding to the configuration table according to the user input information; According to the configuration information to be localized, a field to be localized and an integer key corresponding to each text in the field to be localized are determined.
3. The text localization method according to claim 2, characterized in that: The step of determining the field to be localized and the integer key corresponding to each text in the field to be localized according to the configuration information to be localized includes: Writing the configuration information to be localized into a configuration file; Load the configuration file, and obtain all texts in the field to be localized from the configuration table; According to all the texts in the field to be localized, obtaining from the configuration table a first primary key corresponding to each text in the field to be localized; Determine, according to each of the first primary keys, a string key value corresponding to each text in the field to be localized; According to each of the string key values, an integer key corresponding to each text in the field to be localized is determined.
4. The text localization method according to claim 3, characterized in that: The localization table includes: a primary key column, a string key value column, an original language column, and a target language column; the determining the localization table according to each text in the field to be localized, the corresponding integer key, and the language text includes: Add each text in the to-be-localized field to the original language column; Add the string key value corresponding to each text in the field to be localized to the string key value column; Adding the integer key corresponding to each text in the field to be localized to the primary key column; The language text corresponding to each text in the field to be localized is added to the target language column to generate a localization table.
5. The text localization method according to claim 4, characterized in that: The step of adding the integer key corresponding to each text in all the fields to be localized to the primary key column includes: Using the integer key corresponding to each text in the field to be localized as the target integer key in turn; Get the original key in the primary key column, and if the target integer key is different from the original key, add the target integer key to the primary key column; If the target integer key is the same as the original key, and the text corresponding to the target integer key is different from the text corresponding to the original key, the target integer key is adjusted by a preset threshold until the target integer key is different from the original key, and the adjusted target integer key is added to the primary key column.
6. The text localization method according to claim 1, characterized in that: The generating a first localization data table and a second localization data table respectively according to the configuration table and the localization table comprises: Using a table import tool, converting the configuration table into an original data table; Replace each text in the to-be-localized field in the original data table with a corresponding integer key to obtain a first localized data table; Use the table import tool to convert the localized table into a second localized data table.
7. The text localization method according to claim 1, characterized in that: The method further comprises: Loading the first localized data table and the second localized data table; Acquire a key to be displayed input by a user based on an interactive interface; the key to be displayed is an integer key corresponding to a field to be localized in a first localization data table; According to the key to be displayed, the language text corresponding to the key to be displayed is searched from the second localization data table and displayed.
8. A text localization device, characterized in that: The device comprises: A first acquisition module, used to acquire a configuration table; A first determination module, configured to determine, according to the configuration table, a field to be localized and an integer key corresponding to each text in the field to be localized; A second acquisition module, used for acquiring a language text corresponding to each of the texts in the field to be localized; A second determination module, configured to determine a localization table according to each text in the field to be localized, a corresponding integer key and a language text; The generating module is used to generate a first localized data table and a second localized data table respectively according to the configuration table and the localized table.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
