Data processing method and apparatus, and electronic device
By establishing a reference pointer to the index path in the proxy class, the data content of the target single data file is loaded, which solves the problem of low data loading efficiency in a multi-language environment and improves system performance and user experience.
Patent Information
- Application Number
- CN202411471589.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2044-10-21
AI Technical Summary
In multilingual environments, existing technologies struggle to instantly hot-load and unload large amounts of data when users switch their local system language, impacting program performance and user experience, and resulting in low data loading efficiency.
By calling the proxy class for attribute information, the local language parameters are obtained, and a reference pointer to the index path is established in the proxy class. The data content of the corresponding language version is loaded from the pre-generated target single data file, avoiding a full unloading and loading of the data module.
This technology enables the correct loading of local language data in a multilingual environment while improving data loading efficiency, reducing code modifications, and enhancing system performance and user experience.
Smart Images

Figure CN119621145B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a data processing method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] With the development of information globalization, software products need to be adaptable to different countries and regions. This involves software internationalization and localization. Internationalization refers to the process of designing and developing software products that are universally applicable to various cultures around the world, while localization is the process of adjusting these software products to suit the language and cultural habits of specific regions. To attract users in different regional markets, the localized data displayed to users in software products needs to be adapted according to the local language, while non-localized data (such as game values and parameter constants in game applications) needs to remain consistent.
[0003] In related technologies, a common practice is to create data files as independent data modules. In this way, all data for each language is exported as an independent data module, and the corresponding language data module is loaded according to the local language parameters when the program starts.
[0004] However, when a user switches the language parameters in their local system, it is necessary to completely unload the old language's data modules from memory and fully load the new language's data modules. The number of data modules is usually large, making it difficult to perform real-time hot loading and unloading of large amounts of data, which impacts program performance and user experience. Therefore, improving data loading efficiency while correctly loading data corresponding to the local language environment in a multi-language environment has become an urgent technical problem to be solved. Summary of the Invention
[0005] This application provides a data processing method, apparatus, electronic device, and computer-readable storage medium that can correctly load data corresponding to the local language environment in a multilingual environment while improving data loading efficiency. The specific solution is as follows:
[0006] In a first aspect, embodiments of this application provide a data processing method, the method comprising:
[0007] In response to a first data loading request for first attribute information in the first application, the first proxy class corresponding to the first attribute information is invoked;
[0008] Retrieve the corresponding first language parameters locally;
[0009] In the first proxy class, a first reference pointer is established pointing to the first index path, wherein the first index path is the index path of the first attribute information in the first language version, and the first language is the language represented by the first language parameter;
[0010] Based on the first reference pointer, the data content of the first attribute information in the first language version is loaded from the pre-generated target single data file corresponding to the first attribute information.
[0011] Secondly, embodiments of this application provide a data processing method, the method comprising:
[0012] Determine the first structure data corresponding to each language version configured for the first attribute information in the first application;
[0013] Based on each of the first structural data, generate a target single data file and a target data information description file corresponding to the first attribute information;
[0014] The target single data file stores the data content of the first attribute information for each language version, and the target data information description file includes the index paths of the first attribute information for each language version in the target single data file.
[0015] Thirdly, embodiments of this application provide a data processing apparatus, the apparatus comprising:
[0016] The calling unit is used to call the first proxy class corresponding to the first attribute information in response to the first data loading request of the first attribute information in the first application;
[0017] The acquisition unit is used to retrieve the corresponding first language parameters locally.
[0018] The establishment unit is used to establish a first reference pointer pointing to a first index path in the first proxy class, wherein the first index path is the index path of the first attribute information in the first language version, and the first language is the language represented by the first language parameter;
[0019] The loading unit is used to load the data content of the first attribute information in the first language version from a pre-generated target single data file corresponding to the first attribute information, based on the first reference pointer.
[0020] Fourthly, embodiments of this application provide a data processing apparatus, the apparatus comprising:
[0021] The determining unit is used to determine the first structure data corresponding to each language version configured for the first attribute information in the first application.
[0022] The generation unit is configured to generate a target single data file and a target data information description file corresponding to the first attribute information based on each of the first structure data.
[0023] The target single data file stores the data content of the first attribute information for each language version, and the target data information description file includes the index paths of the first attribute information for each language version in the target single data file.
[0024] Fifthly, this application also provides an electronic device, comprising:
[0025] Processor; and
[0026] A memory for storing a data processing program, which, when the electronic device is powered on and runs through the processor, executes the method described in the first or second aspect.
[0027] Sixthly, embodiments of this application also provide a computer-readable storage medium storing a data processing program that is executed by a processor to perform the methods described in the first or second aspect.
[0028] Compared with the prior art, this application has the following advantages:
[0029] The data processing method provided in this application includes the following steps: responding to a first data loading request for first attribute information in a first application, calling a first proxy class corresponding to the first attribute information; obtaining a first language parameter corresponding to the local application; establishing a first reference pointer pointing to a first index path in the first proxy class, wherein the first index path is the index path of the first attribute information in a first language version, and the first language is the language represented by the first language parameter; and loading the data content of the first attribute information in the first language version from a pre-generated target single data file corresponding to the first attribute information based on the first reference pointer.
[0030] As can be seen, the data processing method provided in this application, when receiving a first data loading request for first attribute information and making a data interface call, constructs an abstract data hierarchy by calling the first proxy class of the first attribute information. By reading the local first language parameters, the first proxy class can create a reference pointer to the index path of the first language version corresponding to the first language parameters, thereby caching the data content of the first attribute information in the first language version and returning it through the interface, thus achieving correct loading of the data content of the current language. Compared with the prior art, the data processing method provided in this application does not require unloading all data modules of old languages and loading all data modules of new languages, and can correctly load the data corresponding to the local language environment in a multilingual environment while improving data loading efficiency. Attached Figure Description
[0031] Figure 1This is a data processing system diagram provided in an embodiment of the present application for implementing a data processing method;
[0032] Figure 2 This is a flowchart of the data processing method provided in the first embodiment of this application;
[0033] Figure 3 This is a schematic diagram illustrating an example of data loading in existing technology;
[0034] Figure 4 This is a schematic diagram illustrating an example of loading data in the data processing method provided in the first embodiment of this application;
[0035] Figure 5 This is a schematic diagram of the logic flow when loading data in the data processing method provided in the first embodiment of this application;
[0036] Figure 6 This is a flowchart illustrating an example of a change in the local language parameters in the data processing method provided in the first embodiment of this application;
[0037] Figure 7 This is a flowchart illustrating the data loading process before and after hot-updating the code in the data processing method provided in the first embodiment of this application;
[0038] Figure 8 This is a schematic diagram illustrating an example of storing data in the form of data fragments in the data processing method provided in the first embodiment of this application;
[0039] Figure 9 As shown, the second embodiment of this application provides a data processing method;
[0040] Figure 10 This is a flowchart illustrating the data processing method provided in the second embodiment of this application, which generates a single data file and a data information description file for each attribute information.
[0041] Figure 11 This is a structural block diagram of an example of the data processing apparatus provided in the third embodiment of this application;
[0042] Figure 12 This is a structural block diagram of an example of the data processing apparatus provided in the fourth embodiment of this application;
[0043] Figure 13 This is a structural block diagram of an example of an electronic device provided in the fifth embodiment of this application. Detailed Implementation
[0044] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.
[0045] It should be noted that the terms "first," "second," "third," etc., in the claims, specification, and drawings of this application are used to distinguish similar objects and are not used to describe a specific order or sequence. Such data are interchangeable where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that shown or described herein. Furthermore, the terms "comprising," "having," and their variations are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or apparatuses.
[0046] It should be understood that in the embodiments of this application, "at least one" means one or more, and "more than one" means two or more. "And / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. The character " / " generally indicates that the related objects before and after it are in an "or" relationship. "Contains A, B and / or C" means containing any one, two, or three of A, B, and C.
[0047] It should be understood that in the embodiments of this application, "B corresponding to A", "B corresponding to A", "A corresponds to B" or "B corresponds to A" means that B is associated with A, and B can be determined based on A. Determining B based on A does not mean that B is determined solely based on A; B can also be determined based on A and / or other information.
[0048] Before detailing the implementation methods of this application, the prior art will be further described first.
[0049] With globalization, the ability of software products to adapt to different regional languages has become extremely important. For example, a game might initially only support English, but to enter the Chinese market, it needs to provide a Chinese interface and related localization features. Software products include localized data (such as interface text, prompts, etc.) and non-localized data (underlying parameters, etc.). Currently, the following two methods are commonly used to separate localized and non-localized data in software products:
[0050] Method 1: For a software product, separate configuration files are created for each language to separate localized data and non-localized data. When the user selects the desired language, the program only needs to load the configuration file corresponding to the selected language to load the corresponding localized data.
[0051] For example, for a game application product, the "health value" in the English version is "HP", and in the Chinese version, the "health value" is "blood volume". The texts of "HP" and "blood volume" are stored separately in a configuration file independent of the game's core logic. When the player selects Chinese, the program loads the configuration file containing the text "blood volume", and when the player selects English, the program loads the configuration file with the text "HP".
[0052] Method 2: For a software product, all data in each language is made into an independent language module. When the program starts, the corresponding language module is loaded according to the regional parameter. Moreover, the data file reference names are the same under different language modules, so that the correct data file can be called.
[0053] However, although the method of completely separating data in the above Method 1 can achieve the complete separation of localized data and non-localized data, in traditional single-display language software projects with thousands of existing data files, it is very difficult to implement. These projects often have complex architectures and highly coupled modules. Therefore, a large amount of work is required to completely separate the data, and new errors may be introduced. Moreover, in the field of game development, the design requirement of completely separating data requires strict implementation by all participants in the whole process, increasing the learning costs of functional personnel such as project planners, artists, and UI designers.
[0054] Although the above Method 2 reduces the transformation cost, it has the following problems: First, in a dynamic language running environment, it is difficult to instantaneously hot-load and unload a large amount of data, which will affect the program's performance and user experience, and the loading and unloading efficiency is extremely low; Second, the data of each language version is a complete copy, resulting in a high data redundancy, increasing the storage pressure and the complexity of data synchronization; Third, when releasing a new version, it is necessary to repackage the data of all language modules, resulting in a long release process. Especially in the case of a large amount of data, this disadvantage is extremely obvious; Fourth, the data is stored in the form of language modules. In a dynamic language running environment, once a language module is loaded into memory, it usually will not be automatically unloaded. This means that if the data in the language module needs to be updated, the language module must be reloaded. However, frequently reloading the language module may cause performance problems and it is difficult to achieve real-time online hot updates.
[0055] In summary, while both completely separating data and using independent data modules are effective localization strategies, they have certain limitations and challenges. Therefore, how to achieve on-demand loading of data for the corresponding language in a multilingual environment with minimal changes to the application, and improve data loading efficiency, has become an urgent technical problem to be solved.
[0056] For the reasons mentioned above, in order to correctly load data corresponding to the local language environment in a multilingual environment while improving data loading, the first embodiment of this application provides a data processing method. This method is applied to an electronic device, which may be a desktop computer, a laptop computer, a mobile phone, a tablet computer, an electronic watch, or other electronic devices capable of data processing. This embodiment of the application does not specifically limit the application.
[0057] For example, Figure 1 This application illustrates a data processing system 100 for implementing a data processing method, which may include at least one terminal 101, at least one server 102, and a network 103. The terminal 101 can be connected to different servers 102 via the network. The terminal can be any device with computing hardware capable of supporting and executing software applications corresponding to the game.
[0058] In the aforementioned data processing system 100, terminal 101 is used to install and run a first application. In some cases, the first application may not need to be pre-installed on terminal 101; users can directly access the first application through a browser or other client. When a user logs into the first application, terminal 101 sends a login request to server 102. Server 102 verifies the user's login account and returns a login success notification to terminal 101 upon successful verification. During the user's login to the first application, terminal 101 and server 102 can interact. Terminal 101 sends various information to server 102. Server 102 determines the display data for terminal 101 based on the stored application mechanism and the received information, and sends the display data back to terminal 101 so that terminal 101 can display the data sent by server 102 to the user.
[0059] In possible application scenarios, different terminals 101 may be served by different servers 102, and the servers 102 corresponding to different terminals 101 may be the same server.
[0060] In addition, when the data processing system 100 includes multiple terminals, multiple servers, and multiple networks, different terminals can connect to different servers through different networks.
[0061] The terminal 101 may have one or more multi-touch screens for sensing and obtaining input from touch or swipe operations performed by the user at multiple points on one or more touch displays. The terminal 101 may also be connected to a keyboard and / or mouse and / or game controller, enabling the user to perform interface operations via a keyboard and / or mouse and / or game controller.
[0062] The network can be a wireless network or a wired network. Wireless networks include Wi-Fi, LAN, cellular networks, 2G, 3G, 4G, and 5G networks. Additionally, different terminals can connect to other terminals or to a server using their own Bluetooth network or hotspot network. Furthermore, the system 100 can include multiple databases, which are coupled to different servers and store information related to the first application within these databases.
[0063] It should be noted that, Figure 1 The schematic diagram of the data processing system shown is merely an example. The data processing system 100 described in this application embodiment is intended to more clearly illustrate the technical solutions of this application embodiment and does not constitute a limitation on the technical solutions provided in this application embodiment.
[0064] The technical solution of this application will be described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0065] The following, combined with Figures 2-8 This application introduces a data processing method provided in its embodiments.
[0066] like Figure 2 The diagram shown is a flowchart of a data processing method provided in an embodiment of this application, including the following steps S101 to S104:
[0067] Step S101: In response to the first data loading request of the first attribute information in the first application, the first proxy class corresponding to the first attribute information is called.
[0068] The aforementioned first application may include, but is not limited to, any of the following software products: game applications, instant messaging applications, and online shopping applications. To more clearly illustrate the data processing method provided in the embodiments of this application, the first application is described as a game application in this embodiment, which does not constitute a limitation of this application.
[0069] It is understood that a game application refers to an application developed according to the requirements of a game application. The types of games may include, but are not limited to, at least one of the following: two-dimensional (2D) game applications, three-dimensional (3D) game applications, virtual reality (VR) game applications, augmented reality (AR) game applications, and mixed reality (MR) game applications.
[0070] The aforementioned first attribute information refers to the information corresponding to an entity in the first application. For example, in a game application, the first attribute information can be one of the following: item information, character information, skill information, etc.
[0071] In this embodiment of the application, in response to a first data loading request for first attribute information in the first application, a first proxy class corresponding to the first attribute information can be invoked. It should be noted that one type of attribute information can correspond to one proxy class; for example, item information corresponds to proxy class 1, character information corresponds to proxy class 2, and skill information corresponds to proxy class 3. The data proxy class is an abstract class; this proxy class does not store the data but is used to indirectly access the actual storage location of the data.
[0072] In one alternative implementation, a proxy class can declare a data identifier with corresponding attribute information. The data identifier may include at least one of a data table name and dimension variables. For example, for item information, the data table name may be a list of item information, and the dimension variables may include at least one of item name, item type, item level, etc.; for character information, the data table name may be a list of character names, and the dimension variables may be at least one of character name, character's profession, character's skills, etc.
[0073] In this way, the target data identifier based on the first attribute information can be invoked to the first proxy class corresponding to the first attribute information.
[0074] Step S102: Obtain the corresponding first language parameters locally.
[0075] Users can manually set the first language parameter in their local user space. The first language parameter can represent one of the following languages: Chinese, English, Japanese, Russian, French, etc. It should be noted that, typically, applications can have logic to load language parameters from the local user space. With the user's permission, this logic can be used to read the set first language parameter from the local user space.
[0076] Step S103: In the first proxy class, establish a first reference pointer pointing to the first index path, wherein the first index path is the index path of the first attribute information of the first language version, and the first language is the language represented by the first language parameter.
[0077] It should be noted that the first proxy class called in step S101 may have loading information, and a first reference pointer pointing to the first index path can be established in the first proxy class based on the loading information.
[0078] In one optional implementation, the loading information of the first proxy class may include a first index path of the first attribute information of the first language version corresponding to the first language parameter. Thus, a first reference pointer can be established in the first proxy class based on the first index path in the loading information. That is, the step "establishing a first reference pointer to the first index path in the first proxy class" can be achieved through the following steps:
[0079] Obtain the index path loaded by the first proxy class;
[0080] If the index path loaded by the first proxy class includes the first index path, a first reference pointer pointing to the first index path is created in the first proxy class.
[0081] In this embodiment, after the first proxy class is created and initialized, it can load the index path of the current language from the corresponding data information description file (on-demand loading) or load the index paths of all languages (full loading). Thus, when the first proxy class is called subsequently, its loading information, i.e., the loaded index paths, can be obtained. If the first index path of the first language version is included in the index paths loaded by the first proxy class (i.e., the first proxy class fully loads the index paths of all languages when it is created and initialized), a pointer to the first index path can be established in the first proxy class based on the loading information of the first proxy class.
[0082] In another optional implementation, the loading information of the first proxy class does not include the first index path of the first attribute information of the first language version corresponding to the first language parameter. In this case, the above step "establishing a first reference pointer to the first index path in the first proxy class" can be achieved through the following steps:
[0083] If the index path loaded by the first proxy class does not include the first index path, then load the first index path recorded in the target data information description file corresponding to the first proxy class.
[0084] In the first proxy class, a first reference pointer is created that points to the first index path.
[0085] In this embodiment of the application, if the first index path of the first language version is not found in the loading information (index path loaded by the first proxy class) corresponding to the first proxy class, the target data information description file corresponding to the first attribute information can be loaded first, and the first index path of the first language version can be obtained from it, thereby establishing a pointer to the first index path in the first proxy class.
[0086] It should be noted that for a given attribute information, a corresponding single data file and a data information description file can be pre-generated. The single data file stores the data content of that attribute information in various language versions, and the data information description file can at least include the index paths of the attribute information in each language version within the single data file. In this way, the first index path of the first language version can be obtained from the target data information description file corresponding to the first attribute information.
[0087] Table 1.
[0088]
[0089]
[0090] Table 1 shows an example of establishing a first reference pointer in the data processing method provided in this application. The first attribute information is item information. The target data information description file pre-generated for the item information includes index paths for item information in various languages, specifically index path 1 for the English version, index path 2 for the Chinese version, and index path 3 for the Japanese version. When creating the first proxy class corresponding to this item information, if the local language is configured as English and the loading configuration is set to fully load all language paths, the index paths loaded when the first proxy class is created are index path 1 for English, index path 2 for Chinese, and index path 3 for Japanese. If the loading configuration is set to load the path for the current language on demand, the index path loaded when the first proxy class is created is index path 1 for English. Upon receiving the first data loading request for item information and calling the first proxy class, if the local language is switched from English to Chinese, and the index path loaded when the first proxy class is created is index path 1 for English, index path 2 for Chinese, and index path 3 for Japanese (i.e., the index path for all languages), a first reference pointer pointing to index path 2 for Chinese can be established based on the loading information of the first proxy class. If the index path loaded when the first proxy class is created is index path 1 for English, index path 2 for Chinese can be loaded from the target data information description file, and a first reference pointer pointing to index path 2 can be established.
[0091] Then, the program can pass the query parameters corresponding to the first data loading request to the first proxy class, and the corresponding data can be indexed through the first reference pointer established in the first proxy class.
[0092] Step S104: Based on the first reference pointer, load the data content of the first attribute information in the first language version from the pre-generated target single data file corresponding to the first attribute information.
[0093] In this embodiment of the application, for a single attribute information, a corresponding single data file can be pre-generated, which is used to store the data content of the attribute information for each language version.
[0094] It should be noted that when the data content of this attribute information is consistent across language versions, that is, when the data of this attribute information in each language version is non-localized data, the single data file can be a file storing common data (i.e., non-localized data) (hereinafter referred to as common_data); when the data content of this attribute information is inconsistent across language versions, that is, when the data of this attribute information in each language version contains differentiated localized data, the single data file can be a file storing the data content of this attribute information in each language version using different language variables.
[0095] Table 2.
[0096]
[0097] Table 2 shows an example of a single data file for item information in the data processing method provided in this application embodiment. Single data files are pre-generated for the English version of item information (en_data) and the Japanese version of item information (jp_data). If the English and Japanese versions of item information are identical (i.e., en_data = jp_data), a single data file named common_data is generated. Thus, when the first language is English, the proxy class corresponding to the item information needs to load the English data class (i.e., en_data), and the first reference pointer can represent the pointing relationship between en_data and common_data. If the English and Japanese versions of item information are inconsistent (i.e., en_data ≠ jp_data), a single data file containing both en_data and jp_data is generated. Thus, when the first language is English, the proxy class corresponding to the item information needs to load the English version of the data class (i.e., en_data), and the first reference pointer can represent the pointing relationship between the single data file and en_data.
[0098] In step S104, the storage location of the first attribute information of the first language version can be accessed through the first reference pointer established in the first proxy class, thereby correctly loading the data content of the first attribute information of the first language version.
[0099] The aforementioned target single data file includes either first data content or second data content. The first data content is the general data content when the first attribute information of each language version is consistent, and the second data content is the differentiated data content stored when the first attribute information of each language version is inconsistent.
[0100] When the aforementioned target single data file includes first data content, "loading the data content of the first attribute information in the first language version" specifically refers to loading the general data content in the target single data file; when the aforementioned target single data file includes second data content, "loading the data content of the first attribute information in the first language version" specifically refers to loading the differentiated data content corresponding to the first language in the target single data file.
[0101] The data processing method provided in this application includes the following steps: responding to a first data loading request for first attribute information in a first application, calling a first proxy class corresponding to the first attribute information; obtaining a first language parameter corresponding to the local application; establishing a first reference pointer pointing to a first index path in the first proxy class, wherein the first index path is the index path of the first attribute information in a first language version, and the first language is the language represented by the first language parameter; and loading the data content of the first attribute information in the first language version from a pre-generated target single data file corresponding to the first attribute information based on the first reference pointer.
[0102] As can be seen, the data processing method provided in this application, when receiving a first data loading request for first attribute information and making a data interface call, constructs an abstract data hierarchy by calling the first proxy class of the first attribute information. By reading the local first language parameters, the first proxy class can create a reference pointer to the index path of the first language version corresponding to the first language parameters, thereby caching the data content of the first attribute information in the first language version and returning it through the interface, thus achieving correct loading of the data content of the current language. Compared with the prior art, the data processing method provided in this application does not require unloading all data modules of old languages and loading all data modules of new languages, and can correctly load the data corresponding to the local language environment in a multilingual environment while improving data loading efficiency.
[0103] The following combination Figure 3 and Figure 4 A detailed comparison is made between the data processing method provided in the embodiments of this application and the prior art:
[0104] like Figure 3 The diagram shown illustrates an example of data loading in the prior art, including steps S201 to S203. Step S201: The client script calls the data interface; Step S202: The native module loads a specific data file from the data module; Step S203: The data dictionary is returned, and the content of a specific field is queried through the data dictionary index.
[0105] As can be seen, in existing technologies, specific data files within a data module are loaded using a native module reference mechanism to query specific field content. However, once a data module is successfully loaded, it will not be reloaded unless manually unloaded. Therefore, the returned data dictionary can only be used to retrieve the content of already loaded data segments and cannot dynamically adjust the loaded data file based on local language parameters. Thus, existing technologies cannot dynamically load files corresponding to a specific language using local language parameters.
[0106] like Figure 4 The diagram shown illustrates an example of loading data in the data processing method provided in this application, including steps S301 to S303. Step S301: The client script calls the data interface; Step S302: The specific field content of the current language in the single data file is indexed through the corresponding proxy class; Step S303: The specific field content is returned.
[0107] As can be seen, the data processing method provided in this application embodiment can index the specific field content of the current language in a single data file based on the proxy class corresponding to the data to be loaded when loading data. Therefore, the data processing method provided in this application embodiment can switch languages without modifying the code and realize the on-demand loading of data content in the corresponding language. In addition, the data processing method provided in this application embodiment does not modify the code. When it is necessary to add new language support, it is usually only necessary to modify the corresponding single data file and data information description file, which improves the extensibility and maintainability of the code.
[0108] In an optional implementation, the "calling the first proxy class corresponding to the first attribute information" in step S101 can be achieved through the following steps S1011 and S1012:
[0109] Step S1011: Detect whether the first proxy class corresponding to the first attribute information has been generated in the first application, and obtain the detection result;
[0110] Step S1012: If the detection result indicates that the first proxy class has been generated in the first application, call the first proxy class.
[0111] It should be noted that the proxy class generated in the first application is module-level. In a Python environment, after importing a module, it is usually loaded into memory, and this module will not be loaded again during the same program's execution. Thus, when calling the first proxy class corresponding to the first attribute information, it can first check whether the first proxy class has been generated. If the first proxy class has been generated, the instance of the first proxy class loaded into memory can be called directly.
[0112] In this embodiment, the proxy class in the first application exists as a module and runs in singleton mode. Throughout the entire lifecycle of the first application, only one instance of the proxy class exists, and a global access point is provided to access this instance. Furthermore, the instance is cached after its initial creation. Thus, during continuous program execution, when the proxy class is loaded subsequently, there is no need to re-execute the code of the module containing the proxy class; the cached instance can be used directly. In other words, a proxy class only needs to be initialized once during program execution.
[0113] Since the proxy class exists in the singleton pattern, the same object reference will be obtained when the same proxy class is called multiple times, ensuring the uniqueness of the proxy class in the global scope. On the one hand, this avoids the waste of resources caused by multiple instantiations of the same proxy class, and on the other hand, it effectively reduces space usage.
[0114] Optionally, the first application may include the generated second proxy class. As described above, the second proxy class declares a data identifier with corresponding attribute information, which may include at least one of a data table name and a dimension variable. Step S1011 can be performed as follows:
[0115] From the second proxy class, search for whether there exists a first proxy class that declares a target data identifier corresponding to the first attribute information, wherein the target data identifier includes at least one of the target data table name and the target dimension variable;
[0116] If it exists, obtain the detection result of the first proxy class already generated in the first application.
[0117] In a specific implementation, it can be determined from the second proxy classes already generated by the first application whether a first proxy class exists that declares the target data identifier corresponding to the first attribute information. If the aforementioned data identifier includes a data table name and dimension variables, it can be determined whether a first proxy class exists that declares the target data table name and target dimension variables corresponding to the first attribute information.
[0118] For example, the generated second proxy class includes proxy class a, proxy class b, and proxy class c. Proxy class a declares a data table named "Item Information," with declared dimension variables of item name, item type, and item level; proxy class b declares a data table named "Character Information," with declared dimension variables of character name, character's class, and character's skills; proxy class c declares a data table named "Skill Information," with declared dimension variables of skill release conditions, skill cooldown time, and skill damage. When the first attribute information is "Item Information," it is possible to search for a proxy class in the generated second proxy class that declares a data table named "Item Information" and declared dimension variables of item name, item type, and item level. In this way, the second proxy class can be found.
[0119] In an optional implementation, the first proxy class corresponding to the first attribute information may not have been created. Prior to step S102 above, the data processing method provided in this application embodiment may further include the following steps:
[0120] If the first proxy class is not invoked, the first proxy class corresponding to the first attribute information is generated based on the pre-generated target data information description file corresponding to the first attribute information.
[0121] In this embodiment of the application, when the first proxy class corresponding to the first attribute information is not generated, the target data information description file corresponding to the first attribute information can be loaded first, and then the first proxy class corresponding to the first attribute information can be created based on the information in the target data information description file.
[0122] In one optional implementation, the above step of "generating the first proxy class corresponding to the first attribute information based on the pre-generated target data information description file corresponding to the first attribute information" can be achieved through the following steps:
[0123] Load a pre-generated target data information description file corresponding to the first attribute information, wherein the target data information description file includes a target data identifier and the index paths of the first attribute information in each language version in the target single data file, and the target data identifier includes at least one of the target data table name and the target dimension variable;
[0124] Based on the target data identifier, a first proxy class corresponding to the first attribute information is created, wherein the first proxy class declares the target data identifier;
[0125] Based on each of the index paths, the first proxy class loads at least the index path that includes the first index path to obtain the first proxy class with loading information.
[0126] It should be noted that when creating the first proxy class corresponding to the first attribute information, the target data information description file corresponding to the first attribute information can be loaded first. As mentioned above, for an attribute information, its corresponding data information description file includes the index paths of that attribute information in each language version within the corresponding single data file. Furthermore, a data information description file may also include the data identifier of the corresponding attribute information. Therefore, the target data information description file includes the index paths of the first attribute information in each language version within the target single data file, as well as the target data identifier.
[0127] After loading the target data information description file, a first proxy class corresponding to the first attribute information can be created based on the target data identifier included in the target data information description file. The created first proxy class declares the target data identifier. It should be noted that by registering the target data identifier when creating the first proxy class, a one-to-one mapping relationship between the first proxy class and the first attribute information is achieved. In this way, when subsequently requesting to load the data of the first attribute information, the corresponding first proxy class can be called based on this mapping relationship.
[0128] After creating the first proxy class, the first proxy class can load index paths that include at least the first index path, based on the index paths of the first attribute information for each language version included in the target data information description file. As described above, the loading of index paths during proxy class creation can be configured to load all language versions' index paths fully, or it can be configured to load the index paths of the current language only on demand. Therefore, the index paths loaded in the first proxy class that include at least the first index path include: the first index path of the first attribute information for the first language version, or the index paths of the first attribute information for each language version.
[0129] In an optional implementation, the step "loading the index path that includes at least the first index path in the first proxy class" may include the following steps:
[0130] Get the configuration parameters to load;
[0131] If the loading configuration parameter is a first parameter indicating the index path of the current local language, load the first index path of the first attribute information of the first language version in the first proxy class;
[0132] If the loading configuration parameter is a second parameter indicating the index path for loading all languages, then each of the index paths is loaded in the first proxy class.
[0133] In a specific implementation, loading configuration parameters can be obtained first. Then, based on the loading configuration parameters, the corresponding index paths, which at least include the first index path, can be loaded in the first proxy class. Specifically, when the loading configuration parameter is a first parameter indicating the loading of the index path for the current local language, the first index path of the first attribute information for the first language version can be loaded from the loaded data information description file. When the loading configuration parameter is a second parameter indicating the loading of index paths for all languages, the respective index paths of the first attribute information for each language version can be loaded from the loaded data information description file.
[0134] In this way, a first proxy class with loading information can be created. Then, based on the loading information of the first proxy class, a first reference pointer pointing to the first index path can be established in the first proxy class, so that the corresponding data content can be loaded correctly based on the first reference pointer.
[0135] like Figure 5 The diagram shown is a logical flow diagram of the data processing method provided in this application embodiment when loading data, including the following steps S401 to S407:
[0136] Step S401: Receive the first data loading request for the first attribute information;
[0137] Step S402: Determine whether the first proxy class of the first attribute information has been generated;
[0138] If the judgment result of step S402 is yes, then step S403 is executed; if the judgment result of step S402 is no, then step S406 is skipped.
[0139] Step S403: Load the target data information description file corresponding to the target attribute data;
[0140] Step S404: Create the first proxy class corresponding to the first attribute information;
[0141] Step S405: Load the first index path corresponding to the current local language in the first proxy class;
[0142] Step S406: Establish a first reference pointer pointing to the first index path;
[0143] Step S407: Based on the first reference pointer, read the data and return the data result.
[0144] As can be seen, in the data processing method provided in this application embodiment, when a first data loading request for first attribute information is received, it is first determined whether a first proxy class for the first attribute information has been generated; if the first proxy class has been generated, a first application pointer pointing to the first index path is directly established in the first proxy class; if the first proxy class has not been generated, a target data information description file corresponding to the first attribute information is first loaded, which includes a target data identifier and index paths for the first attribute information in each language version; thus, based on the target data identifier, a first proxy class declaring the target data identifier can be created; and based on the index paths for the first attribute information in each language version, at least the first index path corresponding to the current local language is loaded; thereby, a first reference pointer pointing to the first index path is established in the first proxy class; thus, based on the first reference pointer established in the first proxy class, the corresponding data content can be read from the target single data file corresponding to the first attribute information, thereby returning the correct data content.
[0145] like Figure 6 The diagram shown is a flowchart illustrating an example of a change in local language parameters in the data processing method provided in this application. The following section will further elaborate on this. Figure 6 Detailed introduction:
[0146] In an optional implementation, prior to step S102 above, the data processing method provided in this application embodiment may further include: Figure 6 Steps S501 and S502 in the following steps:
[0147] Step S501: In response to the language switching command, update the local second language parameter to the first language parameter;
[0148] Step S502: Persist the first language parameter so that the local application can be configured using the first language represented by the first language parameter.
[0149] In a specific implementation, users can set the local language in the graphical user interface. Specifically, users can click to enter the local language settings interface and change the currently used second language to the first language. This generates a language switching command, which triggers the second language parameter stored in memory to be updated to the first language parameter.
[0150] For example, a user can go to the local language settings interface and switch the current language from Chinese to English. In this way, the language parameter stored in memory that indicates the current language is Chinese will be changed to the language parameter that indicates the current language is English.
[0151] After the language parameter is updated from the second language parameter to the first language parameter, the first language parameter can be persisted. This ensures that when the application or system restarts, the local language remains the first language represented by the first language parameter without needing to be manually set again. This allows local applications to be configured using the first language represented by the first language parameter.
[0152] In one optional implementation, the data processing method provided in this application embodiment may further include: Figure 6 Steps S503 and S504 in the following steps:
[0153] Determine the generated second proxy class corresponding to the first application;
[0154] Clear the reference pointer to the index path corresponding to the second language established in the second proxy class, where the second language is the language represented by the second language parameter.
[0155] In this embodiment of the application, in response to the language switching instruction, for the first application, all the second proxy classes generated in the first application can be traversed and the reference pointers to the index paths corresponding to the second language (old language) established in the second proxy classes can be cleared.
[0156] Furthermore, when switching language parameters, while clearing the reference pointer to the index path corresponding to the second language established in the second proxy class, the index path corresponding to the second language loaded in the second proxy class can also be cleared.
[0157] For example, the second proxy classes currently generated in the first application include: proxy class 1 corresponding to item information, proxy class 2 corresponding to character information, and proxy class 3 corresponding to skill information. The local language before the switch is Chinese, and the local language after the switch is English. Then, the reference pointer to the index path of the Chinese version of item information established in proxy class 1 can be cleared, and the index path of the loaded Chinese version of item information can be cleared; the reference pointer to the index path of the Chinese version of character information established in proxy class 2 can be cleared, and the index path of the loaded Chinese version of character information can be cleared; the reference pointer to the index path of the Chinese version of skill information established in proxy class 3 can be cleared, and the index path of the loaded Chinese version of skill information can be cleared.
[0158] It should be noted that by clearing the reference pointer to the index path corresponding to the second language established in the second proxy class and clearing the index path corresponding to the second language loaded in the second proxy class, the mapping relationship between the second proxy class and the index path corresponding to the second language can be terminated. Thus, during the execution of the first application, when a first data loading request is received, language version errors caused by directly loading data content from the old language's index path are avoided. Instead, the corresponding data content is loaded based on the index path of the new language currently set locally.
[0159] Specifically, after clearing the index path corresponding to the second language loaded in the second proxy class and clearing the reference pointer to the index path corresponding to the second language established in the second proxy class, when data is called in the first application and data of a certain attribute information needs to be loaded, then... Figure 6 Step S505: When there is a need to load certain attribute information in the first application, it is achieved through the above steps S101 to S104. Steps S101 to S104 have been described in detail above and will not be repeated here.
[0160] In one optional implementation, the data content of the first attribute information of the first language version is the first code content of the target single data file; the data processing method provided in this application embodiment may further include the following steps:
[0161] During the operation of the first application, in response to the first code content corresponding to the first attribute information being updated to the second code content, if the second code content is non-localized content, the target single data file corresponding to the first attribute information is loaded to obtain a copy file;
[0162] Update the first code content in the data content corresponding to each language in the copy file to the second code content;
[0163] In response to a second data loading request for the first attribute information, the second code content is loaded from the copy file via the first proxy class.
[0164] It's worth noting that hot updates are a common technique in many applications, used to update code or data without downtime. Hot updates typically involve downloading new code or data into a running application and applying these updates without stopping the application. On the one hand, this avoids downtime and resource consumption caused by restarting the application; on the other hand, users are unaware that the application has been updated, improving the user experience.
[0165] In Python, hot updates typically refer to the behavior of dynamically modifying or replacing code during program execution, thereby implementing new features or fixing bugs without restarting the program. This method usually involves dynamically modifying classes, functions, or modules, and is often referred to in the industry as "monkey patching".
[0166] In this embodiment of the application, before the code is hot-updated, when requesting to call the data of the first attribute information, the first code content is loaded from the target single data file corresponding to the first attribute information through the first proxy class corresponding to the first attribute information. The first code content is the data content of the first attribute information of the current local language version.
[0167] If the code in the data content corresponding to the first attribute information is updated from the first code content to the second code content, it can be first checked whether the second code content is non-localized content, that is, common content across languages. For example, if the updated content is the cooldown time of a skill, then it is non-localized content. If the second code content is non-localized, the target single data file corresponding to the first attribute information can be loaded into memory to obtain a copy file. Then, the first code content in the data content corresponding to each language in the copy file in memory can be updated to the second code content. In this way, whether loading the target attribute information of the current first language version or switching the first language to another language locally, the hot-updated target attribute information, including the second code content, can be loaded from memory.
[0168] like Figure 7 The diagram shown is a flowchart of data loading before and after code hot-update in the data processing method provided in this application embodiment, including steps S601 to S607.
[0169] Steps S601 to S603 constitute the data loading process before hot code update.
[0170] Step S601: The user accesses certain data;
[0171] Step S602: Proxy class 201 forwards the corresponding query parameters to a single data file;
[0172] Step S603: Return the corresponding data A from the single data file.
[0173] Step S604: In response to hot code updates in the program, if the hot update content is non-localized content, load the single data file corresponding to the hot update content into memory, and update data A in the single data file loaded into memory with data B.
[0174] Steps S605 to S607 constitute the data loading process after hot code update:
[0175] Step S605: The user accesses the same type of data accessed in step S601;
[0176] Step S606: Proxy class 201 forwards the corresponding query parameters to a single data file loaded into memory;
[0177] Step S607: Return the corresponding data B from the single data file loaded into memory. In the prior art, when hot updates and language switching conflict, the hot update may fail and roll back, negating its effects. During a hot update, new data or code is downloaded and applied to the currently running application; for example, updating text from "old text" to "new text." During a language switching process, the application unloads all data for the current language and loads the new language data. This completely unloads the current language data, clearing the most recently updated data or code, and the language data reloaded from storage is the old data from before the hot update, causing the most recent update to be overwritten.
[0178] For example, suppose an application supports both English and Chinese languages. When the application is currently in English and a hot update occurs, a certain prompt text is updated from "old text" to "new text". When the user switches from English to Chinese, the current English data will be unloaded and Chinese data will be loaded from storage. As a result, the prompt text in the loaded Chinese data will still be the "old text", causing the hot update to fail.
[0179] Compared with the prior art, in the data processing method provided in this application embodiment, when the content to be hot-updated is content required by all languages, a single data file can be loaded into memory first, and the content corresponding to each language in memory can be replaced with the content to be hot-updated. In this way, when switching from an old language to a new language, the hot-updated content corresponding to the new language can also be loaded from memory, thereby avoiding the problem of hot-updating failure caused by switching languages.
[0180] In an optional implementation, the first application includes multiple attribute information, and the data content of the single data file corresponding to different attribute information is stored in different data fragments. The data content of the target single data file is stored in the target data fragment, and the first proxy class has a communication connection with the target data fragment. The above step S104 can be implemented through the following steps:
[0181] The first proxy class loads the data content corresponding to the first attribute information of the first language from the data content stored in the target data fragment.
[0182] In this embodiment of the application, a data shard may store only the data content of a single data file corresponding to one attribute information. For example, the data content of a single data file corresponding to item information may be stored in data shard 1, the data content of a single data file corresponding to character information may be stored in data shard 2, and the data content of a single data file corresponding to skill information may be stored in data shard 3.
[0183] In a specific implementation, data content can be divided according to key values, and data content with the same key value can be allocated to a data shard. It should be noted that data content with the same key value has the same data identifier and belongs to the same attribute information. In this way, data content belonging to the same attribute information is divided into a data shard, thereby realizing on-demand loading.
[0184] like Figure 8 The diagram shown illustrates an example of data storage in the form of data fragments in the data processing method provided in this application. As can be seen, the data entry point 301 is connected to the proxy class corresponding to each data fragment. Specifically, each data fragment includes data fragment 1, data fragment 2, and data fragment 3. The proxy class corresponding to data fragment 1 is proxy class 1, the proxy class corresponding to data fragment 2 is proxy class 2, and the proxy class corresponding to data fragment 3 is proxy class 3. Each proxy class is connected to its corresponding data fragment. Data fragment 1 stores data with a key value of 1, data fragment 2 stores data with a key value of 2, and data fragment 3 stores data with a key value of 3. For example... Figure 8 Data shard 1 can store data corresponding to item information, data shard 2 can store data corresponding to character information, and data shard 3 can store data corresponding to skill information. Thus, when accessing data corresponding to item information, simply call proxy class 1 to load data from data shard 1; when accessing data corresponding to character information, simply call proxy class 2 to load data from data shard 2; and when accessing data corresponding to item information, simply call proxy class 3 to load data from data shard 3.
[0185] This configuration stores data of the same attribute in a single data shard. When data of a certain attribute is frequently loaded during a certain period, only the content of the data shard corresponding to that attribute needs to be loaded, without loading the content of other data shards, thus saving memory space.
[0186] The above is a description of the data processing method provided in the first embodiment of this application.
[0187] like Figure 9 As shown, the second embodiment of this application provides a data processing method, including the following steps S701 to S702:
[0188] Step S701: Determine the first structure data corresponding to each language version configured for the first attribute information in the first application;
[0189] Step S702: Based on each of the first structure data, generate a target single data file and a target data information description file corresponding to the first attribute information;
[0190] The target single data file stores the data content of the first attribute information for each language version, and the target data information description file includes the index paths of the first attribute information for each language version in the target single data file.
[0191] Optionally, step S701 above may include the following steps:
[0192] Obtain the second structure data corresponding to each language version configured for the first attribute information;
[0193] According to the preset data conversion rules, each of the second structure data is processed into each of the first structure data.
[0194] The aforementioned second-structure data refers to the configuration data set for each language version segment of the first attribute information. This can be CSV (Comma-Separated Values) tabular data, a commonly used file format for storing tabular data. In a CSV file, each row represents a record, and each column represents an attribute or field of that record. Fields are typically separated by commas (,), while rows are separated by newline characters.
[0195] The second structure data corresponding to a language version can include localized data and non-localized data. Localized data refers to data customized for different languages and regions, while non-localized data refers to data that does not distinguish between languages. Typically, the non-localized data is the same for different language versions, while the localized data is different.
[0196] For example, if the first attribute information is item information, then you can obtain the item information configuration data 1 for Chinese, configuration data 2 for English, configuration data 3 for Japanese, etc. in the first application.
[0197] In this embodiment, the format of each second structure data can be converted according to preset data conversion rules, thereby processing each of the second structure data into a first structure data. In Python, a dictionary is a data structure used to store key-value pairs. Each element in a dictionary has a unique key, corresponding to a value. The corresponding value can be quickly accessed through the key. In this way, the second structure data (configuration data) for each language version supported by the first attribute information can be converted into the corresponding first structure data (dictionary structure data), that is, each first structure data includes the first structure data corresponding to each language version.
[0198] It should be noted that the first-structured data can be directly read by the program, facilitating fast access and manipulation. The first-structured data can include, but is not limited to, any of the following: taggeddict structure data and ShardDict structure data. Specifically, a taggeddict structure refers to a dictionary with additional tags or metadata, typically used to store data items with additional information; a ShardDict structure refers to a data structure that stores data in shards, typically used for processing large amounts of data or implementing distributed storage.
[0199] After obtaining each first structure data, a target single data file and target data information description information corresponding to the first attribute information can be generated based on each first structure data.
[0200] In this embodiment of the application, each first structure data can be integrated and compressed to obtain an integrated and compressed target single data file, and a target data information description file can be generated accordingly.
[0201] It should be noted that the target data information description file may include the index paths of the first attribute information of each language version in the target single data file, and may also record the languages supported by the target single data file. In this way, the index paths of each language version in the target single data file can be obtained through the target data information description file, and the data corresponding to the first attribute information of each language version can be obtained from the target single data file.
[0202] The aforementioned target single data file includes either first data content or second data content. The first data content is the general data content when the first attribute information of each language version is consistent, and the second data content is the differentiated data content stored when the first attribute information of each language version is inconsistent.
[0203] The data processing method provided in the second embodiment of this application includes the following steps: determining each first structure data corresponding to each language version configured for the first attribute information in the first application; generating a target single data file and a target data information description file corresponding to the first attribute information based on each first structure data; wherein, the target single data file stores the data content of the first attribute information for each language version, and the target data information description file includes each index path of the first attribute information for each language version in the target single data file, and the languages supported by the target single data file.
[0204] As can be seen, the data processing method provided in the second embodiment of this application, after obtaining the first structure data for each language version set for the first attribute information, integrates the first structure data to obtain a target single data file storing the data content of each language version, and generates a target data information description file including the index paths of the first attribute information of each language version in the target single data file. In this way, by integrating multilingual data content with only minor modifications to the traditional import process, a target single data file and a target data information description file are obtained. On the one hand, this reduces the cost of code modification in traditional data separation methods; on the other hand, generating a target single data file compresses redundant data, thereby reducing memory usage. Furthermore, the index paths of the first attribute information for each language version can be obtained through the generated target data information description file, thus supporting multilingual switching.
[0205] In an optional implementation, step S702 may include steps S7021 and S7022:
[0206] Step S7021: Compare whether the data of each of the first structures are consistent to obtain the comparison results;
[0207] Step S7022: Based on the comparison results, generate a target single data file and a target data information description file corresponding to the first attribute information.
[0208] In this embodiment, the data content in each first structure data can be compared to see if they are consistent. Specifically, step S7021 refers to comparing each element of the first structure data corresponding to each language version, which belongs to the first attribute information, to obtain a comparison result.
[0209] It should be noted that for the same attribute information, the first structure data corresponding to different language versions may be consistent. For example, if the data table for a certain language version is currently localized content, after iteration, the localized content may be split and removed, thus converting it into non-localized content. In this way, the embodiments of this application can flexibly support the free conversion between localized and non-localized content, and flexibly generate data content storing the first attribute information of each language version by comparing the results.
[0210] Optionally, step S7022 above can include the following two implementation methods:
[0211] Implementation Method 1: If the comparison result is consistent with each of the first structure data, generate a target single data file storing general data and a target data information description file;
[0212] The target data information description file is used to indicate that the first attribute information corresponding to each language is the general data stored in the target single data file.
[0213] When the first attribute information of each language version is consistent across all first structure data, it indicates that the first attribute information of each language version is non-localized data. A common data file (common_data) can be used to store the common data (i.e., non-localized data). This common data file is the target single data file, and the calling interface of each language for this first attribute information points to the common_data reference.
[0214] By generating a single data file that stores common data when the first data of the first attribute information is consistent across language versions, the actual storage, loading, and reading of the first attribute information for each language version only use a single copy of the common_data data, effectively reducing redundant data storage.
[0215] Implementation Method 2: If the comparison result shows that the first structure data are inconsistent, export the first structure data corresponding to each language to the target single data file using different language variables, and generate a target data information description file.
[0216] The target data information description file is used to indicate the storage location of the first attribute information corresponding to each language in the target single data file.
[0217] When the first structure data of the first attribute information of different language versions are inconsistent, it indicates that the first attribute information of each language version contains differentiated localized data. The data content corresponding to the first attribute information of each language version can be exported one by one to the target single data file and stored with different language variables. The calling interface of each language for the first attribute information points to its respective language variable in the target single data file.
[0218] When the first structure data of the first attribute information in different language versions are inconsistent, a single data file is generated that stores the data content corresponding to the first attribute information of each language version in different language variables. In this way, when data is retrieved, the corresponding data content can be indexed from the target single data file through their respective language variables.
[0219] In one optional implementation, when generating the target single data file corresponding to the first attribute information based on each of the first structure data, the target single data file corresponding to the first attribute information can be generated according to the configured import parameters and each of the first structure data.
[0220] Specifically, the import parameters include one of two types: parameters representing full import and parameters representing incremental import. When the import parameter represents full import, all first-structure data of each attribute information for each language version is loaded, and all first-structure data of the first attribute information for each language version is selected from these, which are the first-structure data of the first attribute information for each language version to be processed. Pre-processing is then performed on the first-structure data of the first attribute information for each language version. When the import parameter represents incremental import, the incremental first-structure data of each attribute information for each language version within the current incremental period (e.g., the last 24 hours or the last 12 hours) is loaded, and the incremental first-structure data of the first attribute information for each language version is selected from these, which are the first-structure data of the first attribute information for each language version to be processed. Pre-processing is then performed on the first-structure data of the first attribute information for each language version.
[0221] The aforementioned pre-processing includes comparing the consistency of the first structure data to obtain a comparison result, and generating a target single data file in different ways under different comparison results (consistent or inconsistent), and correspondingly generating a target data information description file. Here, generating a target single data file in different ways under different comparison results includes either implementation method one or implementation method two.
[0222] like Figure 10The diagram shown is a flowchart of the data processing method provided in this application, which generates a single data file and a data information description file for each attribute information, including steps S801 to S809.
[0223] Step S801: Update the code to obtain the latest data;
[0224] Step S802: Determine whether to import the entire data based on the import parameters;
[0225] If step S802 is a full import, then execute step S805: load all the first structure data of each attribute information of each language version to obtain the data to be processed;
[0226] If step S802 is an incremental import, execute steps S803 and S804. Step S803: Scan the incremental first structure data of each attribute information of each language version within the current incremental cycle; Step S804: Load the incremental first structure data of each attribute information of each language version to obtain the data to be processed;
[0227] After steps S805 and S804 are completed, step S806 is executed: for each first structure data of each language with the same attribute information in the data to be processed, it is determined whether each first structure data is consistent;
[0228] If the judgment result of step S806 is yes, proceed to step S807: merge all language data into common_data (i.e., a single data file), and each language references common_data;
[0229] If the judgment result of step S806 is negative, proceed to step S808: export each first structure data of each language to a single data file one by one with different language variables;
[0230] After steps S807 and S808 are completed, step S809 is executed: a single data file for each attribute information is obtained, and a corresponding data information description file is generated.
[0231] It should be noted that for each attribute information in the first application, a corresponding single data file and data information description file can be generated. Thus, when a certain attribute information is called, the corresponding proxy class can obtain the index path corresponding to the current local language from the corresponding data information description file, thereby establishing a reference pointer to the index path corresponding to the current local language, and loading the data content of the corresponding language from the corresponding single data file.
[0232] The data processing method provided in this application has the following advantages:
[0233] The data processing method provided in the second embodiment of this application can generate a single data file integrating multilingual data information and a corresponding data information description file for each attribute information with only minor modifications to the traditional import process. During data reading and loading on the program client, the data processing method provided in the second embodiment of this application can index and load data tables in different languages through a proxy mechanism at the underlying level, without modifying the upstream business program. Furthermore, when the local language is switched, by clearing the reference pointers to the index paths of the old language in the proxy class and re-establishing reference pointers to the index paths of the new language, the language mapping relationship can be modified in a timely manner. This ensures that the data called during language switching can be updated to the correct data in a timely manner. During hot data updates, by calling the updated data from the single data file, the timely effectiveness of the updated data can be guaranteed.
[0234] Furthermore, the data processing method provided in this application significantly improves data loading efficiency and reduces memory usage. In the second embodiment of this application, when the data content of different languages is the same for a single attribute, it will be aggregated into common_data, enabling multiple languages to share a single data storage and retrieval method. In the first embodiment of this application, dynamically loading the corresponding data based on local language parameters can avoid the lag caused by loading the full amount of data.
[0235] Corresponding to the data processing method provided in the first embodiment of this application, the third embodiment of this application also provides a data processing apparatus, such as... Figure 11 As shown, the data processing device 1100 includes:
[0236] Calling unit 1101 is used to call the first proxy class corresponding to the first attribute information in response to the first data loading request of the first attribute information in the first application;
[0237] The acquisition unit 1102 is used to acquire the corresponding first language parameters locally;
[0238] Establishment unit 1103 is used to establish a first reference pointer pointing to a first index path in the first proxy class, wherein the first index path is the index path of the first attribute information in the first language version, and the first language is the language represented by the first language parameter;
[0239] The loading unit 1104 is used to load the data content of the first attribute information in the first language version from a pre-generated target single data file corresponding to the first attribute information based on the first reference pointer.
[0240] Optionally, the calling unit 1101 is specifically used for:
[0241] Detect whether the first proxy class corresponding to the first attribute information has been generated in the first application, and obtain the detection result;
[0242] If the detection result indicates that the first proxy class has been generated in the first application, then the first proxy class is invoked.
[0243] Optionally, the calling unit 1101 is further configured to:
[0244] If the first proxy class is not invoked, the first proxy class corresponding to the first attribute information is generated based on the pre-generated target data information description file corresponding to the first attribute information.
[0245] Optionally, the calling unit 1101 is further specifically used for:
[0246] Load a pre-generated target data information description file corresponding to the first attribute information, wherein the target data information description file includes a target data identifier and the index paths of the first attribute information in each language version in the target single data file, and the target data identifier includes at least one of the target data table name and the target dimension variable;
[0247] Based on the target data identifier, a first proxy class corresponding to the first attribute information is created, wherein the first proxy class declares the target data identifier;
[0248] Based on each of the index paths, the first proxy class loads at least the index path that includes the first index path to obtain the first proxy class with loading information.
[0249] Optionally, the calling unit 1101 is further specifically used for:
[0250] Get the configuration parameters to load;
[0251] If the loading configuration parameter is a first parameter indicating the index path of the current local language, load the first index path of the first attribute information of the first language version in the first proxy class;
[0252] If the loading configuration parameter is a second parameter indicating the index path for loading all languages, then each of the index paths is loaded in the first proxy class.
[0253] Optionally, the establishment unit 1103 is specifically used for:
[0254] Obtain the index path loaded by the first proxy class;
[0255] If the index path loaded by the first proxy class includes the first index path, a first reference pointer pointing to the first index path is created in the first proxy class.
[0256] Optionally, the establishing unit 1103 is further configured to:
[0257] If the index path loaded by the first proxy class does not include the first index path, load the first index path recorded in the target data information description file corresponding to the first attribute information;
[0258] In the first proxy class, a first reference pointer is created that points to the first index path.
[0259] Optionally, the first application includes a generated second proxy class, which declares a data identifier with corresponding attribute information. The data identifier includes at least one of a data table name and a dimension variable. The calling unit 1101 is further specifically used for:
[0260] From the second proxy class, search for whether there exists a first proxy class that declares a target data identifier corresponding to the first attribute information, wherein the target data identifier includes at least one of the target data table name and the target dimension variable;
[0261] If it exists, obtain the detection result of the first proxy class already generated in the first application.
[0262] Optionally, the data processing device 1100 further includes an update unit, the update unit being used for:
[0263] In response to a language switching command, update the local second language parameter to the first language parameter;
[0264] The first language parameter is persisted so that the local application can be configured using the first language represented by the first language parameter.
[0265] Optionally, the data processing device 1100 further includes a clearing unit, the clearing unit being used for:
[0266] Determine the generated second proxy class corresponding to the first application;
[0267] Clear the reference pointer to the index path corresponding to the second language established in the second proxy class, where the second language is the language represented by the second language parameter.
[0268] Optionally, the data content of the first attribute information in the first language version is the first code content in the target single data file; the loading unit 1104 is further configured to:
[0269] During the operation of the first application, in response to the first code content corresponding to the first attribute information being updated to the second code content, if the second code content is non-localized content, the target single data file corresponding to the first attribute information is loaded to obtain a copy file;
[0270] Update the first code content in the data content corresponding to each language in the copy file to the second code content;
[0271] In response to a second data loading request for the first attribute information, the second code content is loaded from the copy file via the first proxy class.
[0272] Optionally, the first application includes multiple attribute information, and the single data files corresponding to different attribute information are stored in different data shards. The target single data file is stored in the target data shard, and the first proxy class has a communication connection with the target data shard; the loading unit 1104 is further specifically used for:
[0273] The first proxy class loads the data content corresponding to the first attribute information of the first language from the target single data file stored in the target data fragment.
[0274] Corresponding to the data processing method provided in the second embodiment of this application, the fourth embodiment of this application also provides a data processing apparatus, such as... Figure 12 As shown, the data processing device 1200 includes:
[0275] The determining unit 1201 is used to determine the first structure data corresponding to each language version configured for the first attribute information in the first application;
[0276] The generation unit 1202 is used to generate a target single data file and a target data information description file corresponding to the first attribute information based on each of the first structure data;
[0277] The target single data file stores the data content of the first attribute information for each language version, and the target data information description file includes the index paths of the first attribute information for each language version in the target single data file.
[0278] Optionally, the determining unit 1201 is specifically used for:
[0279] Obtain the second structure data corresponding to each language version configured for the first attribute information;
[0280] According to the preset data conversion rules, each of the second structure data is processed into each of the first structure data.
[0281] Optionally, the generation unit 1202 is specifically used for:
[0282] Compare whether the data of each of the first structures are consistent to obtain the comparison results;
[0283] Based on the comparison results, a target single data file and a target data information description file corresponding to the first attribute information are generated.
[0284] Optionally, the generation unit 1202 is specifically used for:
[0285] If the comparison result is consistent with each of the first structure data, a target single data file storing general data and a target data information description file are generated;
[0286] The target data information description file is used to indicate that the first attribute information corresponding to each language is the general data stored in the target single data file.
[0287] Optionally, the generation unit 1202 is specifically used for:
[0288] If the comparison result shows that the first structure data are inconsistent, the first structure data corresponding to each language is exported to the target single data file with different language variables, and a target data information description file is generated.
[0289] The target data information description file is used to indicate the storage location of the first attribute information corresponding to each language in the target single data file.
[0290] Corresponding to the data processing method provided in the first embodiment or the second embodiment of this application, the fifth embodiment of this application also provides an electronic device for data processing.
[0291] like Figure 13 The diagram shown is a structural block diagram of an example of an electronic device for data processing provided in an embodiment of this application.
[0292] In this embodiment, an optional hardware structure of the electronic device 1300 may be as follows: Figure 13 As shown, it includes: at least one processor 1301, at least one memory 1302 and at least one communication bus 1305; the memory 1302 contains a program 1303 and data 1304.
[0293] Bus 1305 can be a communication device for transmitting data between components within electronic device 1300, such as an internal bus (e.g., CPU-memory bus, where the processor is the central processing unit, or CPU for short) or an external bus (e.g., a universal serial bus port or a peripheral component interconnection fast port).
[0294] Additionally, the electronic device also includes at least one network interface 1306 and at least one peripheral interface 1307. The network interface 1306 provides wired or wireless communication with an external network 1308 (e.g., the Internet, intranet, local area network, mobile communication network, etc.). In some embodiments, the network interface 1306 may include any number of network interface controllers (NICs), radio frequency (RF) modules, repeaters, transceivers, modems, routers, gateways, any combination of wired network adapters, wireless network adapters, Bluetooth adapters, infrared adapters, near field communication (NFC) adapters, cellular network chips, etc.
[0295] Peripheral interface 1307 is used to connect to peripherals, such as peripheral 1 in the figure. Figure 13 1309 in the middle), peripheral 2 ( Figure 13 1310 in the middle) and peripheral 3 ( Figure 13 (1311 in the original text). Peripherals are peripheral devices, which may include, but are not limited to, cursor control devices (such as mice, touchpads, or touchscreens), keyboards, displays (such as cathode ray tube displays, liquid crystal displays), displays or light-emitting diode displays, video input devices (such as cameras or input interfaces coupled to video files), etc.
[0296] The processor 1301 may be a CPU, an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.
[0297] The memory 1302 may include high-speed RAM (Random Access Memory) memory, and may also include non-volatile memory, such as at least one disk storage device.
[0298] The processor 1301 calls the program and data stored in the memory 1302 and executes the following steps:
[0299] In response to a first data loading request for first attribute information in the first application, the first proxy class corresponding to the first attribute information is invoked;
[0300] Retrieve the corresponding first language parameters locally;
[0301] In the first proxy class, a first reference pointer is established pointing to the first index path, wherein the first index path is the index path of the first attribute information in the first language version, and the first language is the language represented by the first language parameter;
[0302] Based on the first reference pointer, load the data content of the first attribute information in the first language version from the pre-generated target single data file corresponding to the first attribute information; or
[0303] Determine the first structure data corresponding to each language version configured for the first attribute information in the first application;
[0304] Based on each of the first structural data, generate a target single data file and a target data information description file corresponding to the first attribute information;
[0305] The target single data file stores the data content of the first attribute information for each language version, and the target data information description file includes the index paths of the first attribute information for each language version in the target single data file.
[0306] Corresponding to the data processing method provided in the first embodiment or the second embodiment of this application, the sixth embodiment of this application provides a computer-readable storage medium storing a program of the data processing method provided in the first embodiment or the second embodiment of this application. This program is executed by a processor to perform the following steps:
[0307] In response to a first data loading request for first attribute information in the first application, the first proxy class corresponding to the first attribute information is invoked;
[0308] Retrieve the corresponding first language parameters locally;
[0309] In the first proxy class, a first reference pointer is established pointing to the first index path, wherein the first index path is the index path of the first attribute information in the first language version, and the first language is the language represented by the first language parameter;
[0310] Based on the first reference pointer, load the data content of the first attribute information in the first language version from the pre-generated target single data file corresponding to the first attribute information; or
[0311] Determine the first structure data corresponding to each language version configured for the first attribute information in the first application;
[0312] Based on each of the first structural data, generate a target single data file and a target data information description file corresponding to the first attribute information;
[0313] The target single data file stores the data content of the first attribute information for each language version, and the target data information description file includes the index paths of the first attribute information for each language version in the target single data file.
[0314] It should be noted that for detailed descriptions of the methods, apparatus, electronic devices, and computer-readable storage media provided in the second, third, fourth, fifth, and sixth embodiments of this application, please refer to the relevant descriptions of the first embodiment of this application, which will not be repeated here.
[0315] Although this application discloses preferred embodiments as described above, it is not intended to limit this application. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of this application. Therefore, the scope of protection of this application should be determined by the scope defined in the claims of this application.
[0316] In a typical configuration, a node device in a blockchain includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0317] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0318] 1. Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage media, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include non-transitory computer-readable media, such as modulated data signals and carrier waves.
[0319] 2. Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0320] Although this application discloses preferred embodiments as described above, it is not intended to limit this application. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of this application. Therefore, the scope of protection of this application should be determined by the scope defined in the claims of this application.
Claims
1. A data processing method, characterized in that, The method includes: In response to a first data loading request for first attribute information in the first application, the first proxy class corresponding to the first attribute information is invoked; Retrieve the corresponding first language parameters locally; In the first proxy class, a first reference pointer is established pointing to the first index path, wherein the first index path is the index path of the first attribute information in the first language version, and the first language is the language represented by the first language parameter; Based on the first reference pointer, load the data content of the first attribute information in the first language version from the pre-generated target single data file corresponding to the first attribute information; The invocation of the first proxy class corresponding to the first attribute information includes: Detect whether the first proxy class corresponding to the first attribute information has been generated in the first application, and obtain the detection result; If the detection result indicates that the first proxy class has been generated in the first application, then the first proxy class is invoked. The step of establishing a first reference pointer to the first index path in the first proxy class includes: Obtain the index path loaded by the first proxy class; If the index path loaded by the first proxy class includes the first index path, a first reference pointer pointing to the first index path is created in the first proxy class.
2. The method according to claim 1, characterized in that, Before obtaining the corresponding first language parameters locally, the method further includes: If the first proxy class is not invoked, the first proxy class corresponding to the first attribute information is generated based on the pre-generated target data information description file corresponding to the first attribute information.
3. The method according to claim 2, characterized in that, The step of generating a first proxy class corresponding to the first attribute information based on a pre-generated target data information description file corresponding to the first attribute information includes: Load a pre-generated target data information description file corresponding to the first attribute information, wherein the target data information description file includes a target data identifier and the index paths of the first attribute information in each language version in the target single data file, and the target data identifier includes at least one of the target data table name and the target dimension variable; Based on the target data identifier, a first proxy class corresponding to the first attribute information is created, wherein the first proxy class declares the target data identifier; Based on each of the index paths, the first proxy class loads at least the index path that includes the first index path to obtain the first proxy class with loading information.
4. The method according to claim 3, characterized in that, Loading an index path that includes at least the first index path in the first proxy class includes: Get the configuration parameters to load; If the loading configuration parameter is a first parameter indicating the index path of the current local language, load the first index path of the first attribute information of the first language version in the first proxy class; If the loading configuration parameter is a second parameter indicating the index path for loading all languages, then each of the index paths is loaded in the first proxy class.
5. The method according to claim 1, characterized in that, The method further includes: If the index path loaded by the first proxy class does not include the first index path, load the first index path recorded in the target data information description file corresponding to the first attribute information; In the first proxy class, a first reference pointer is created that points to the first index path.
6. The method according to claim 1, characterized in that, The first application includes a generated second proxy class, which declares a data identifier with corresponding attribute information. The data identifier includes at least one of a data table name and a dimension variable. The step of detecting whether the first proxy class corresponding to the first attribute information has been generated in the first application, and obtaining the detection result, includes: From the second proxy class, search for whether there exists a first proxy class that declares a target data identifier corresponding to the first attribute information, wherein the target data identifier includes at least one of the target data table name and the target dimension variable; If it exists, obtain the detection result of the first proxy class already generated in the first application.
7. The method according to claim 1, characterized in that, Before obtaining the corresponding first language parameters locally, the method further includes: In response to a language switching command, update the local second language parameter to the first language parameter; The first language parameter is persisted so that the local application can be configured using the first language represented by the first language parameter.
8. The method according to claim 7, characterized in that, The method further includes: Determine the generated second proxy class corresponding to the first application; Clear the reference pointer to the index path corresponding to the second language established in the second proxy class, where the second language is the language represented by the second language parameter.
9. The method according to claim 1, characterized in that, The data content of the first attribute information in the first language version is the first code content in the target single data file; The method further includes: During the operation of the first application, in response to the first code content corresponding to the first attribute information being updated to the second code content, if the second code content is non-localized content, the target single data file corresponding to the first attribute information is loaded to obtain a copy file; Update the first code content in the data content corresponding to each language in the copy file to the second code content; In response to a second data loading request for the first attribute information, the second code content is loaded from the copy file via the first proxy class.
10. The method according to claim 1, characterized in that, The first application includes multiple attribute information, and the single data files corresponding to different attribute information are stored in different data shards. The target single data file is stored in the target data shard, and the first proxy class has a communication connection with the target data shard. The step of loading the data content of the first attribute information in the first language version from a pre-generated target single data file corresponding to the first attribute information based on the first reference pointer includes: The first proxy class loads the data content corresponding to the first attribute information of the first language version from the target single data file stored in the target data fragment.
11. A data processing method, characterized in that, The method includes: Determine the first structure data corresponding to each language version configured for the first attribute information in the first application; Based on each of the first structural data, generate a target single data file and a target data information description file corresponding to the first attribute information; The target single data file stores the data content of the first attribute information for each language version, and the target data information description file includes the index paths of the first attribute information for each language version in the target single data file. The determination of the first structure data corresponding to each language version configured for the first attribute information in the first application includes: Obtain the second structure data corresponding to each language version configured for the first attribute information; According to the preset data conversion rules, each of the second structure data is processed into each of the first structure data; The step of generating a target single data file and a target data information description file corresponding to the first attribute information based on each of the first structure data includes: Compare whether the data of each of the first structures are consistent to obtain the comparison results; Based on the comparison results, a target single data file and a target data information description file corresponding to the first attribute information are generated.
12. The method according to claim 11, characterized in that, The step of generating a target single data file and a target data information description file corresponding to the first attribute information based on the comparison result includes: If the comparison result is consistent with each of the first structure data, a target single data file storing general data and a target data information description file are generated; The target data information description file is used to indicate that the first attribute information corresponding to each language version is the general data stored in the target single data file.
13. The method according to claim 11, characterized in that, The step of generating a target single data file and a target data information description file corresponding to the first attribute information based on the comparison result includes: If the comparison result shows that the first structure data are inconsistent, the first structure data corresponding to each language version is exported to the target single data file with different language variables, and a target data information description file is generated. The target data information description file is used to indicate the storage location of the first attribute information corresponding to each language version in the target single data file.
14. A data processing apparatus, characterized in that, The device includes: The calling unit is used to call the first proxy class corresponding to the first attribute information in response to the first data loading request of the first attribute information in the first application; The acquisition unit is used to retrieve the corresponding first language parameters locally. The establishment unit is used to establish a first reference pointer pointing to a first index path in the first proxy class, wherein the first index path is the index path of the first attribute information in the first language version, and the first language is the language represented by the first language parameter; The loading unit is configured to load the data content of the first attribute information in the first language version from a pre-generated target single data file corresponding to the first attribute information, based on the first reference pointer. The invocation of the first proxy class corresponding to the first attribute information includes: Detect whether the first proxy class corresponding to the first attribute information has been generated in the first application, and obtain the detection result; If the detection result indicates that the first proxy class has been generated in the first application, then the first proxy class is invoked. The step of establishing a first reference pointer to the first index path in the first proxy class includes: Obtain the index path loaded by the first proxy class; If the index path loaded by the first proxy class includes the first index path, a first reference pointer pointing to the first index path is created in the first proxy class.
15. A data processing apparatus, characterized in that, The device includes: The determining unit is used to determine the first structure data corresponding to each language version configured for the first attribute information in the first application. The generation unit is configured to generate a target single data file and a target data information description file corresponding to the first attribute information based on each of the first structure data. The target single data file stores the data content of the first attribute information for each language version, and the target data information description file includes the index paths of the first attribute information for each language version in the target single data file. The determination of the first structure data corresponding to each language version configured for the first attribute information in the first application includes: Obtain the second structure data corresponding to each language version configured for the first attribute information; According to the preset data conversion rules, each of the second structure data is processed into each of the first structure data; The step of generating a target single data file and a target data information description file corresponding to the first attribute information based on each of the first structure data includes: Compare whether the data of each of the first structures are consistent to obtain the comparison results; Based on the comparison results, a target single data file and a target data information description file corresponding to the first attribute information are generated.
16. An electronic device, characterized in that, include: processor; as well as A memory for storing a data processing program, which, when the electronic device is powered on and runs through the processor, performs the method as described in any one of claims 1-10 or 11-13.
17. A computer-readable storage medium, characterized in that, The system contains a data processing program that is executed by a processor to perform the method as described in any one of claims 1-10 or 11-13.
Citation Information
Patent Citations
Multi-language information providing method and device, multi-language information configuration method and device, equipment and medium
CN110597595A
Program running method and device, electronic equipment and storage medium
CN113918214A