Language package distribution method and device, electronic equipment and storage medium
Through the data distribution network, combining user location and distribution node load information, dynamically selecting the language pack transmission path, solving the problem of delay and inconsistency in language pack updates on the international financial loan platform, and improving user experience and system efficiency.
Patent Information
- Application Number
- CN202510483942.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2025-08-08
AI Technical Summary
In the prior art, international financial loan platforms have problems such as high maintenance costs, update delays and inconsistent language content when updating language packages, resulting in poor user experience.
The language pack dynamically updates through the data distribution network, uses the user's location information and the load information of the distribution node, and selects the nearest and lightest load distribution node for language pack transmission, ensuring the timeliness and consistency of language content.
It realizes fast, unified management and efficient loading of language packs, reduces network latency, improves user experience and system stability.
Smart Images

Figure CN120455527A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data request processing, and in particular to a language package distribution method, device, electronic device and storage medium. Background Art
[0002] With the globalization of internet finance, many financial lending platforms are beginning to support cross-border lending services to meet the needs of users in different countries and regions. For example, international financial lending platform A has a global user base, including in China, the United States, Germany, Japan, and other countries. To enhance the user experience, the platform needs to support multiple languages, such as Chinese, English, German, and Japanese. Therefore, efficient and fast loading and switching of language packs is crucial to improving the user experience.
[0003] In the existing language pack loading solution, International Financial Loan Platform A embeds language packs into the code during the development phase and deploys them along with the software system. The user end then loads the appropriate language pack based on local settings. For example, when a Chinese user applies for a loan on the platform, the platform loads the Chinese language pack and displays the Chinese interface; whereas, when a German user uses the platform, the platform loads the German language pack and displays the German interface.
[0004] This approach is feasible in small projects, but it exposes many problems in large financial loan platforms such as International Financial Loan Platform A. Since the platform's front-end pages, back-end services, and mobile applications each maintain a set of language packs, once the language content needs to be updated (such as adding new loan product introductions, updating loan terms, or adjusting interface copy), operations and R&D personnel need to frequently manually update the configuration files and redeploy the software system to release the new language content. For example, when Platform A launches a new loan product, it needs to update the copy in multiple language versions at the same time, which not only increases maintenance costs, but also causes delays in updating the language pack content. Alternatively, users may not see the latest product information for a period of time, or the language versions they see may be inconsistent, which affects the user experience.
[0005] Therefore, how to achieve dynamic updates of language packs and ensure the timeliness and consistency of language content is a technical problem that needs to be solved urgently. Summary of the Invention
[0006] In view of the above, it is necessary to provide a language pack distribution method, the purpose of which is to publish the language pack to the data distribution network, and obtain the language pack from the data distribution network by the user end, so as to realize the dynamic update of the language pack and ensure the timeliness and consistency of the language content.
[0007] The present invention provides a method for distributing a language package, the method comprising:
[0008] receiving a request from a user terminal to load a target language package, and querying, based on an identifier of the target language package, whether a local cache of the user terminal stores the target language package;
[0009] If the target language package is not stored in the local cache, calling the positioning module of the user terminal to obtain the first location information of the user terminal, and accessing the data distribution network according to a preset AIP interface between the user terminal and the data distribution network storing the target language package, to obtain the operating environment information of each distribution node in the data distribution network, the operating environment information including the load information of each distribution node and the second location information of the server corresponding to each distribution node;
[0010] Determining, based on the first location information and the second location information, at least one first candidate distribution node from a plurality of distribution nodes, where a geographical distance between the first candidate distribution node and the user terminal is less than a preset threshold, and calculating, based on load information of each first candidate distribution node, a transmission time required for each first candidate distribution node to transmit the target language package to the user terminal;
[0011] A first candidate distribution node with the shortest transmission time is selected from the at least one first candidate distribution node as a target distribution node, and the target distribution node is called to load the target language package and transmit it to the user terminal.
[0012] Optionally, the method further includes:
[0013] If the target language package is stored in the local cache, then according to the identifier of the target language package, a language package file matching the identifier of the target language package is matched from the local cache;
[0014] The matching language package file is loaded into the operating environment of the user terminal.
[0015] Optionally, the calling of a positioning module of the user terminal to obtain the first location information of the user terminal includes:
[0016] Calling the positioning module of the user terminal to obtain the latitude and longitude information of the user terminal;
[0017] The latitude and longitude information is sent to a preset geographic location resolution server for location information resolution, a resolution result returned by the geographic location resolution server is received, and the first location information of the user terminal is obtained from the resolution result.
[0018] Optionally, determining at least one first candidate distribution node from a plurality of distribution nodes according to the first location information and the second location information includes:
[0019] Calculating the location distance between the user terminal and the server corresponding to each distribution node based on the first location information and the second location information;
[0020] A distribution node whose location distance is less than a preset threshold is selected as the first candidate distribution node.
[0021] Optionally, the target language package is created in the following manner:
[0022] Creating a basic structure of an initial language package, and adding the entry ID and entry content of the initial language package to the basic structure, wherein the entry content includes an entry key and an entry value;
[0023] The properties of the initial language package are set to obtain the target language package, wherein the properties include the running status, validity period, and version number of the initial language package.
[0024] Optionally, after the target language package is created, the method further includes:
[0025] Convert the created target language package into a JSON format file;
[0026] Publish the JSON format file to the data distribution network, and use the data distribution network to store the JSON format file to each distribution node in the data distribution network, so as to call the data distribution network to send the release message of the target language package to the user end through the preset AIP interface.
[0027] Optionally, the load information includes a current load rate and available bandwidth; and calculating, based on the load information of each first candidate distribution node, a transmission time required for each first candidate distribution node to transmit the target language package to the user terminal includes:
[0028] Calculating the effective bandwidth of each first candidate distribution node according to the load rate and available bandwidth of each first candidate distribution node;
[0029] The transmission time required for each first candidate distribution node to transmit the target language packet to the user terminal is calculated according to the size of the target language packet and the effective bandwidth.
[0030] In order to solve the above problem, the present invention further provides a language pack distribution device, the device comprising:
[0031] a query module, configured to receive a request from a user terminal to load a target language package, and query, based on an identifier of the target language package, whether the target language package is stored in a local cache of the user terminal;
[0032] a calling module configured to, if the target language package is not stored in the local cache, call the positioning module of the user terminal to obtain first location information of the user terminal, and access the data distribution network according to a preset AIP interface between the user terminal and the data distribution network storing the target language package, to obtain operating environment information of each distribution node in the data distribution network, the operating environment information including load information of each distribution node and second location information of a server corresponding to each distribution node;
[0033] a determination module, configured to determine, based on the first location information and the second location information, at least one first candidate distribution node from a plurality of distribution nodes, where a geographical location distance between the first candidate distribution node and the user terminal is less than a preset threshold, and calculate, based on load information of each first candidate distribution node, a transmission time required for each first candidate distribution node to transmit the target language package to the user terminal;
[0034] The sending module is configured to select a first candidate distribution node with the shortest transmission time from the at least one first candidate distribution node as a target distribution node, call the target distribution node to load the target language package, and transmit the target language package to the user terminal.
[0035] In order to solve the above problem, the present invention further provides an electronic device, comprising:
[0036] at least one processor; and,
[0037] a memory communicatively connected to the at least one processor; wherein,
[0038] The memory stores a language pack distribution program executable by the at least one processor. The language pack distribution program is executed by the at least one processor so that the at least one processor can perform the above-mentioned language pack distribution method.
[0039] In order to solve the above problem, the present invention further provides a computer-readable storage medium, on which a language pack distribution program is stored. The language pack distribution program can be executed by one or more processors to implement the above language pack distribution method.
[0040] Compared to existing technologies, this invention obtains the user's first location information and selects a distribution node closer to the user from the data distribution network as a candidate node based on the user's first location information and the distribution node's second location information. This location-based selection mechanism can significantly reduce network latency and improve loading speed.
[0041] By calculating the effective bandwidth and transmission time of each candidate node, the node with the shortest transmission time is selected as the target node, and the target language package is loaded from this node. This load-aware mechanism ensures the efficiency of resource allocation and the stability of the system.
[0042] Language packs are centrally managed and maintained through a unified backend management system, and published to the data distribution network. The user end obtains the language packs from the data distribution network. By combining the user end's location information, the load of the distribution node, and the network conditions, the language pack loading process is dynamically optimized to ensure the timeliness and consistency of the language content. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A flow chart of a language pack distribution method provided in one embodiment of the present invention;
[0044] Figure 2 A schematic diagram of a module of a language pack distribution device provided by an embodiment of the present invention;
[0045] Figure 3 A schematic diagram of the structure of an electronic device for implementing a language package distribution method provided by an embodiment of the present invention;
[0046] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0048] It should be noted that the descriptions of "first", "second", etc. in the present invention are for descriptive purposes only and should not be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the fact that they can be implemented by ordinary technicians in this field. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0049] Reference Figure 1FIG. 1 is a flow chart of a method for distributing language packages according to an embodiment of the present invention. The method is executed by an electronic device.
[0050] In this embodiment, the language pack distribution method includes:
[0051] S1. Receive a request from a user terminal to load a target language package, and query, based on an identifier of the target language package, whether the local cache of the user terminal stores the target language package;
[0052] In this embodiment, when a user switches languages in an application or website, a request is triggered to load the target language pack for the corresponding language. For example, if a user switches from Chinese to English, the unified backend management system will receive a request to load the English language pack.
[0053] Each language pack has a unique identifier (for example, language_pack_en_US_1.0.0 represents the English language pack, version 1.0.0). Check whether the target language pack corresponding to the identifier has been stored in the local cache of the user end (such as the browser's localStorage, sessionStorage, IndexedDB, or the local storage of the mobile device).
[0054] Each language pack has a unique identifier (for example, language_pack_en_US_1.0.0 represents the English language pack, version 1.0.0). Check whether the target language pack corresponding to the identifier has been stored in the local cache of the user end (such as the browser's localStorage, sessionStorage, IndexedDB, or the local storage of the mobile device).
[0055] If the user has previously loaded the English language pack and it is still stored in the local cache, the language pack can be directly read and loaded from the local cache, avoiding network requests and improving loading speed. If the target language pack does not exist in the local cache, it will need to be obtained from an external data distribution network through the unified backend management system.
[0056] In one embodiment, the method further comprises:
[0057] If the target language package is stored in the local cache, then according to the identifier of the target language package, a language package file matching the identifier of the target language package is matched from the local cache;
[0058] The matching language package file is loaded into the operating environment of the user terminal.
[0059] The local cache is where the user end (such as browsers, mobile devices, etc.) stores temporary data for quick access to commonly used resources.
[0060] Based on the identifier of the target language pack, the system searches the local cache for a corresponding language pack file. If a matching language pack file is found, the system loads it into the user's operating environment (such as a web page or mobile application interface), completing the language switch.
[0061] S2. If the target language package is not stored in the local cache, calling the positioning module of the user terminal to obtain first location information of the user terminal, and accessing the data distribution network storing the target language package according to a preset AIP interface between the user terminal and the data distribution network to obtain operating environment information of each distribution node in the data distribution network, the operating environment information including load information of each distribution node and second location information of a server corresponding to each distribution node;
[0062] In this embodiment, when the target language package does not exist in the local cache, the user's location information is obtained by calling the positioning module of the user terminal. The positioning module can be one of the following methods:
[0063] GPS positioning information: Get the precise geographic location through the user's GPS module.
[0064] IP address information: The user's approximate geographic location can be inferred from their IP address.
[0065] Base station information: Determine the user's location through the base station signals to which the mobile device is connected.
[0066] Wi-Fi information: Infer the user's location through the Wi-Fi hotspots they are connected to.
[0067] After obtaining the location information, the language pack loading strategy can be further optimized based on the user's geographic location, such as selecting the distribution node closest to the user or switching to a more appropriate language version based on the geographic location.
[0068] User-side location information refers to the geographic location of the user's device, including latitude and longitude or specific locations such as country, city, region, and street. A data distribution network refers to a content distribution network (including Content Delivery Network, CDS network, edge computing nodes, and distributed storage systems), which is used to store and distribute static resources (such as language packs, images, and CSS files) across multiple distribution nodes around the world to improve resource loading speed.
[0069] Pre-configure the CDN API in your client application (e.g., mobile app or web app for the target language pack). Assuming the CDN API address is https: / / api.cdn.example.com, you need to configure this address in your application code.
[0070] If the client interacts with the CDN through a backend server, the backend server must also be configured with the CDN's API. The backend server's configuration file contains the CDN's API address: https: / / api.cdn.example.com. The API is provided by the CDN provider and is used to access language packages in the CDN.
[0071] The data distribution network is accessed according to the preset AIP interface between the user end and the data distribution network where the target language package is stored, specifically including: using the preset API interface address and the target language package identifier to construct an API request, and adding necessary request header information to the URL of the API request, such as Authorization (for authentication), Content-Type (specify the format of the request body), etc. Additional parameters such as user location information can also be added to the request body. The user end sends the constructed API request to the data distribution network through the API interface through the HTTP client (such as the browser's XMLHttpRequest, the mobile application's network library, etc.). If the user end interacts with the data distribution network through the back-end server, the back-end server will forward the API request to the data distribution network after receiving the API request.
[0072] The data distribution network's operation monitoring module obtains operating environment information for all distribution nodes. The operation monitoring module is a core component of the data distribution network, responsible for monitoring, managing, and scheduling each distribution node. The operation monitoring module requires real-time information on the operating status of distribution nodes to make informed decisions, such as selecting the optimal node for data distribution.
[0073] Operating environment information includes load information and second location information. Load information is used to describe the current workload of the distribution node. Specifically, it includes: Current Load Rate: This indicates the node's current resource utilization, such as CPU, memory, or network bandwidth usage. A higher load rate indicates greater workload pressure on the node. Available Bandwidth: This indicates the network bandwidth currently available for data transmission. A higher available bandwidth indicates that the node is likely to be more efficient in transmitting data.
[0074] Secondary location information refers to the geographic location of the server (including physical and virtual servers) corresponding to the distribution node. This second location information corresponds to the client's location information (first location information) and is used to calculate the distance or network latency between the client and the distribution node. Geographic location information includes latitude and longitude, which accurately represents the node's geographic location.
[0075] The present invention is illustrated by way of example:
[0076] Consider an international loan platform with users from all over the world. The platform supports multiple languages (such as Chinese, English, Japanese, and Spanish). Users can switch the interface language based on their language preference. To improve the user experience, the platform needs to efficiently load the corresponding language packs.
[0077] User A (assuming he is from China but currently in Germany) opens the loan platform's mobile app and wants to switch to the Chinese interface. He clicks the "Language Switch" button in the app and selects "Chinese" as the interface language.
[0078] The mobile app receives a request from the user to switch languages. The target language pack is the "Chinese language pack" and the identifier of the target language pack is language_pack_zh_CN_1.0.0 (assuming the version number is 1.0.0). The app first checks whether the language pack with the identifier language_pack_zh_CN_1.0.0 has been stored in the local cache (such as the local storage of the mobile phone).
[0079] If user A has never used the Chinese language pack before, or the local cache has been cleared, the target language pack does not exist in the local cache. Since there is no target language pack in the local cache, the mobile app uses the phone's positioning module (such as IP address positioning or GPS positioning) to obtain user A's location information.
[0080] In one embodiment, the calling of the positioning module of the user terminal to obtain the first location information of the user terminal includes:
[0081] Calling the positioning module of the user terminal to obtain the latitude and longitude information of the user terminal;
[0082] The latitude and longitude information is sent to a preset geographic location resolution server for location information resolution, a resolution result returned by the geographic location resolution server is received, and the first location information of the user terminal is obtained from the resolution result.
[0083] The latitude and longitude information of the user end is obtained through the positioning function of the user end (such as GPS, IP address, base station or WIFI information), and the latitude and longitude information is sent to a pre-configured geographic location resolution server. The server will resolve the user's specific location information (such as country, city, region, street, etc.) based on the latitude and longitude information. According to the resolution result returned by the geographic location resolution server, the user's specific location information is obtained as the first location information for subsequent business logic processing.
[0084] The geolocation resolution server is specifically used to resolve longitude and latitude information and convert it into specific geographic location information (such as country, city, region, street, etc.). The geolocation resolution server can be an internal server or a third-party service.
[0085] In one embodiment, the target language package is created in the following manner:
[0086] Creating a basic structure of an initial language package, and adding the entry ID and entry content of the initial language package to the basic structure, wherein the entry content includes an entry key and an entry value;
[0087] The properties of the initial language package are set to obtain the target language package, wherein the properties include the running status, validity period, and version number of the initial language package.
[0088] The developer enters the unified backend management system, selects the language code of the language pack to be created (such as zh_CN for Simplified Chinese) in the interface of the language pack management module, and enters the version number (such as 1.0.0) to identify the version of the language pack.
[0089] Click the "Create New Language Pack" button to generate the basic structure of an initial language pack. The basic structure includes basic attributes such as language code, version number, status, validity period, and an empty entry list.
[0090] In the Language Pack Management module, find the "Term Management" section. Click the "Add Term" button and enter the key and value for the term. The key is a unique identifier, and the value is the specific translation content. Repeat the above steps to add more terms until all the content you need to translate is covered.
[0091] Set the properties of the initial language pack (operating status, validity period, and version number) to obtain the target language pack. For example, set the operating status, validity period, and version number in the basic information section of the language pack.
[0092] Select the language pack's running state. The running states include: active: The language pack can be loaded by the client. paused: The language pack is temporarily unavailable.
[0093] Set validity period: Enter the validity period of the language pack, usually in the format of YYYY-MM-DD. Example: Set the validity period to 2025-12-31.
[0094] Confirm the version number: Make sure the version number is correct. The version number is used to identify the version of the language pack for easy management and updating. Example: The version number is 1.0.0
[0095] Finally, in the language pack management module interface, check the complete content of the language pack, ensure that all entries and attributes have been set correctly, and click the "Save Language Pack" button to obtain the target language pack.
[0096] It supports operations and R&D personnel to centrally manage and maintain all language packs in a unified backend management system, supports dynamic updates of language packs, ensures the timeliness and consistency of language pack content, and solves the problem of maintaining a set of language packs for front-end pages, back-end services, and mobile applications in existing technologies, which easily leads to complex dynamic updates, maintenance costs, and update delays.
[0097] In one embodiment, after the target language package is created, the method further includes:
[0098] Convert the created target language package into a JSON format file;
[0099] Publish the JSON format file to the data distribution network, and use the data distribution network to store the JSON format file to each distribution node in the data distribution network, so as to call the data distribution network to send the release message of the target language package to the user end through the preset AIP interface.
[0100] Export the created target language pack as a JSON file (for example, file name: language_pack_zh_CN_1.0.0.json). Ensure that the JSON file content is formatted correctly and meets the requirements of the front-end and back-end systems.
[0101] Upload the language pack file in JSON format to the designated path of the data distribution network. Ensure that the distribution network is correctly configured with the target language pack and that the language pack file can be distributed and cached across multiple distribution nodes. Configure a subscription publishing mechanism (for example, using webhooks, message queues (such as RabbitMQ), or event-driven mechanisms) in the unified backend management system to ensure that all relevant software systems (such as web applications and mobile applications) receive notifications of language pack updates.
[0102] When the target language package is released, the data distribution network (CDN) is called through the preset API interface to send a release message of the target language package to the data distribution network to the user end. For example, the data distribution network automatically sends an update notification to all subscribed software systems. After the user end of each software system receives the notification, it obtains the target language package from the API interface of the data distribution network according to the content of the notification. The user end parses the release message and obtains the storage path and version information of the target language package to update the local cache or reload the language package. The release message includes the identifier, storage path, and version information of the target language package.
[0103] In existing technologies, language packs are often scattered across various systems or modules, lacking a unified management mechanism, leading to inconsistent versions and difficulty updating. This invention creates and manages language packs through a unified backend management system, ensuring version consistency and accuracy, improving management efficiency, and reducing manual errors. Leveraging a data distribution network, language packs are rapidly distributed to multiple distribution nodes worldwide, ensuring that users can quickly load the required language packs.
[0104] S3. Determine, based on the first location information and the second location information, at least one first candidate distribution node from a plurality of distribution nodes, where the geographical location distance between the first candidate distribution node and the user terminal is less than a preset threshold, and calculate, based on the load information of each first candidate distribution node, a transmission time required for each first candidate distribution node to transmit the target language package to the user terminal;
[0105] In this embodiment, the first location information of the user terminal refers to the geographical location information of the user device, including longitude and latitude or a specific location such as a country, city, region, or street. The data distribution network is used to store and distribute static resources (such as language packs, images, CSS files, etc.) across multiple distribution nodes around the world to improve resource loading speed.
[0106] Based on the first location information and the second location information, at least one first candidate distribution node is determined from multiple distribution nodes, and the location distance between the first candidate distribution node and the user terminal is less than a preset threshold, which is determined comprehensively based on network latency and geographical distance. For example, the platform sets a threshold of 500 kilometers based on experience to ensure that the selected distribution node can provide a fast response. The threshold can be adjusted according to actual needs. For example, in areas with better network conditions, a higher threshold (such as 800 kilometers) can be set. In areas with poorer network conditions, a lower threshold (such as 300 kilometers) can be set. Filter out distribution nodes whose distance from the user terminal is less than the preset threshold from all distribution nodes.
[0107] In the prior art, language packs are usually loaded from a fixed server without considering the user's location information, causing the user to load resources from a distant server, increasing network latency.
[0108] By selecting a distribution node close to the user to load the target language package, this method significantly reduces network latency and increases language package loading speed. By incorporating geographic location information and a distribution node selection mechanism, it can flexibly address the needs of diverse users while supporting global expansion. This mechanism dynamically adjusts resource allocation based on user distribution, ensuring system stability and responsiveness.
[0109] By connecting to the operation monitoring module of the data distribution network through the API of the data distribution network, the load information of the distribution node (including the current load rate and available bandwidth) can be obtained in real time, and the current load rate and available bandwidth of each first candidate distribution node can be obtained from the operation monitoring module.
[0110] The effective bandwidth of each first candidate distribution node is calculated based on its load rate and available bandwidth. Effective bandwidth = available bandwidth × (1 - current load rate). The file size of the target language package (e.g., 1 MB) is obtained from the operation monitoring module or local records. Based on the target language package size and effective bandwidth, the transmission time required for each first candidate distribution node to transmit the target language package to the user end is calculated. Transmission time = language package size / effective bandwidth.
[0111] A distribution node with the shortest transmission time is selected from the first candidate distribution nodes as the target distribution node.
[0112] The present invention obtains the load information (load rate and available bandwidth) of the distribution node in real time, dynamically calculates the transmission time, selects the optimal distribution node, and ensures the fastest loading speed.
[0113] In one embodiment, determining at least one first candidate distribution node from a plurality of distribution nodes based on the first location information and the second location information includes:
[0114] Calculating the location distance between the user terminal and the server corresponding to each distribution node based on the first location information and the second location information;
[0115] A distribution node whose location distance is less than a preset threshold is selected as the first candidate distribution node.
[0116] The user's latitude and longitude are obtained from the user's location module (such as GPS, IP address, base station, or Wi-Fi). The second latitude and longitude of all distribution nodes are obtained from the data distribution network's operation monitoring module based on the data distribution network's API. The Haversine formula is used to calculate the location distance between the user and each distribution node. A preset threshold is determined based on network latency and geographic distance. For example, the threshold can be set to 500 kilometers. All distribution nodes are filtered out to select those whose distance from the user is less than the preset threshold.
[0117] In one embodiment, the load information includes a current load rate and available bandwidth; and calculating, based on the load information of each first candidate distribution node, the transmission time required for each first candidate distribution node to transmit the target language package to the user terminal includes:
[0118] Calculating the effective bandwidth of each first candidate distribution node according to the load rate and available bandwidth of each first candidate distribution node;
[0119] The transmission time required for each first candidate distribution node to transmit the target language packet to the user terminal is calculated according to the size of the target language packet and the effective bandwidth.
[0120] Connect to the operation monitoring module of the data distribution network through the API provided by the data distribution network to obtain the current load rate and available bandwidth of each first candidate distribution node. According to the request data returned by the data distribution network, parse the request data to obtain the current load rate and available bandwidth of each first candidate distribution node.
[0121] The effective bandwidth of each first candidate distribution node is calculated based on the load rate and available bandwidth of each first candidate distribution node. The calculation formula is:
[0122] Effective bandwidth = available bandwidth × (1-current load rate).
[0123] The calculation formula takes into account the current load of the distribution node. The higher the load, the lower the effective bandwidth.
[0124] Obtain the target language package's file size (e.g., 1MB) from the run monitoring module or local records. Based on the target language package's size and available bandwidth, calculate the transmission time required for each first candidate distribution node to transmit the target language package to the user end. Transmission time = language package size / available bandwidth.
[0125] By calculating the effective bandwidth and transmission time of each distribution node, the optimal distribution node is selected to load the target language package, ensuring efficient resource allocation and avoiding transmission delays caused by excessive distribution node load.
[0126] In existing technologies, distribution node selection is usually static, without considering the actual load of the distribution nodes and network conditions, which may cause some distribution nodes to be overloaded while others are idle. The present invention dynamically selects the optimal distribution node by calculating the effective bandwidth and transmission time, optimizes resource allocation, and improves the overall efficiency of the system.
[0127] In step S3, by calculating the effective bandwidth and transmission time of each distribution node, the optimal distribution node is selected to load the target language package, which significantly improves the efficiency of resource allocation, optimizes the user experience, and solves the problems in the existing technology such as lack of dynamic load optimization, unreasonable resource allocation, poor user experience, and lack of adaptation to network dynamics.
[0128] S4. Select a first candidate distribution node with the shortest transmission time from the at least one first candidate distribution node as a target distribution node, call the target distribution node to load the target language package, and transmit it to the user terminal.
[0129] In an embodiment, based on the location information of the user terminal and a preset threshold, all qualified first candidate distribution nodes are screened out, and the distribution node with the shortest transmission time is selected from the first candidate distribution nodes as the target distribution node. The language package loading request is sent to the target distribution node through the IPA interface of the data distribution network, requesting the target distribution node to transmit the language package to the user terminal.
[0130] The target distribution node obtains the target language package from the database according to the identifier of the target language package, compresses the target language package, and returns the compressed target language package to the user terminal through the IPA interface of the data distribution network.
[0131] After receiving the target language package, the user terminal decompresses the target language package and loads the decompressed target language package to update the interface.
[0132] The present invention calculates the effective bandwidth and transmission time, dynamically selects the optimal distribution node, optimizes resource allocation, and improves the overall efficiency of the system.
[0133] The present invention is illustrated by taking a financial scenario as an example: User A uses a mobile application of a loan platform in Frankfurt, Germany, and wishes to switch to the Chinese interface. The user clicks the "Language Switch" button in the application and selects "Chinese".
[0134] Since the target language package is not available in the local cache, the application obtains the user's location information through the user's location module (such as IP address location) and obtains the location information of all distribution nodes from the data distribution network.
[0135] Calculate the geographical distance between the user and each distribution node, filter out the first candidate distribution nodes that meet the conditions based on a preset threshold (such as 500 kilometers), obtain the current load rate and available bandwidth of each first candidate node from the data distribution network, calculate the effective bandwidth of each node based on the load rate and available bandwidth, calculate the transmission time based on the size of the target language package and the effective bandwidth, select the node with the shortest transmission time from the first candidate nodes as the target node, load the target language package from the target node, and cache it locally to the application.
[0136] In one embodiment, the method further comprises:
[0137] Identifying a first language system used by the user terminal, and identifying a second language system used in the region where the user terminal is located based on the first location information of the user terminal;
[0138] Identify whether the language versions of the first language system and the second language system are consistent,
[0139] If they are inconsistent, the target language package is switched to a language package corresponding to the version of the first language system, and the switched language package is transmitted to the user terminal by using the target distribution node.
[0140] Get the user's first language system through the user's device system settings or browser language preferences. Assume that the user's language is set to zh-CN (Simplified Chinese).
[0141] The user's location information is obtained by using a positioning module (such as an IP address, GPS, base station, or WIFI) on the user side. Based on the user's location information, the second language system used in the region (country or region) where the user side is located is identified. For example, if the user's location information is country: "DE" (Germany), the regional language system is de-DE (German).
[0142] Compare the language setting of the user terminal (first language system) and the language system of the region (second language system) to see if they are consistent. If they are consistent, directly obtain the corresponding version of the target language package based on the first and second language systems.
[0143] If the language system of the user terminal is inconsistent with the regional language system, the corresponding version of the target language package is selected according to the first language system of the user terminal, and the switched language package is transmitted to the user terminal using the target distribution node.
[0144] Existing technologies generally do not consider the difference between the user's language preference and the local language, which may cause the user to see the wrong language version. The present invention ensures that the loaded language package is consistent with the user's preference by dynamically identifying the language system of the user and the region.
[0145] Ensuring that users always use their preferred language, even if the default language in their region is inconsistent with their preferences, can provide more personalized services and reduce the manual steps for users to switch languages.
[0146] In other embodiments, a unified backend management system integrated SDK is obtained from the data distribution network. The SDK (Software Development Kit) contains a series of pre-written codes and functional modules to support predetermined functions (such as language package management, error code conversion, database interaction, etc.). These functions need to be called during the user's operation.
[0147] By pre-installing the SDK on the user side, you can reduce runtime network requests and loading time, improving application performance and responsiveness. Installing the SDK ensures that your application has consistent functionality and behavior across different platforms (such as web, mobile devices, and desktop applications).
[0148] The SDK automatically loads language pack data from the data distribution network and caches it in local memory. If necessary, you can also cache the language pack to a local file. If an exception occurs during the pull process (such as a network problem), the SDK will use the locally cached language pack data to ensure normal application operation.
[0149] The SDK can convert error codes into corresponding entry business IDs and use these IDs to find specific entry content, allowing error information to be displayed in the user's local language. For example, suppose an application has an error code 404, and the corresponding entry business ID is error_404, with content such as "Page Not Found." The SDK can convert the error code into entry content and display it to the user.
[0150] The SDK of the present invention supports storing entry IDs in a database and obtaining corresponding entry content through these IDs. This enables applications to dynamically load and update entry content without relying on hard coding.
[0151] This method obtains the user's location information (such as GPS, IP address, base station, or Wi-Fi) and selects a distribution node that is closer to the user from the data distribution network as a candidate node based on the user's first location information and the distribution node's second location information. This location-based selection mechanism can significantly reduce network latency and improve loading speed.
[0152] By calculating the effective bandwidth and transmission time of each candidate node, the node with the shortest transmission time is selected as the target node, and the target language package is loaded from this node. This load-aware mechanism ensures the efficiency of resource allocation and the stability of the system.
[0153] Language packs are centrally managed and maintained through a unified backend management system, and published to the data distribution network. The user end obtains the language packs from the data distribution network. By combining the user end's location information, the load of the distribution node, and the network conditions, the language pack loading process is dynamically optimized to ensure the timeliness and consistency of the language content.
[0154] like Figure 2 FIG. 1 is a module diagram of a language pack distribution device provided by an embodiment of the present invention.
[0155] The language pack distribution device 100 described in the present invention can be installed in an electronic device. Depending on the functionality implemented, the language pack distribution device 100 may include a query module 110, a call module 120, a determination module 130, and a sending module 140. A module described in the present invention, also referred to as a unit, refers to a series of computer program segments that can be executed by an electronic device processor and perform a fixed function, and is stored in the memory of the electronic device.
[0156] In this embodiment, the functions of each module / unit are as follows:
[0157] The query module 110 is configured to receive a request from a user terminal to load a target language package, and query the local cache of the user terminal to determine whether the target language package is stored therein according to an identifier of the target language package.
[0158] A calling module 120 is configured to, if the local cache does not store the target language package, call the positioning module of the user terminal to obtain first location information of the user terminal, and access the data distribution network according to a preset AIP interface between the user terminal and the data distribution network storing the target language package, to obtain operating environment information of each distribution node in the data distribution network, the operating environment information including load information of each distribution node and second location information of the server corresponding to each distribution node;
[0159] a determination module 130 configured to determine, based on the first location information and the second location information, at least one first candidate distribution node from a plurality of distribution nodes, where a geographical distance between the first candidate distribution node and the user terminal is less than a preset threshold, and calculate, based on load information of each first candidate distribution node, a transmission time required for each first candidate distribution node to transmit the target language package to the user terminal;
[0160] The sending module 140 is configured to select a first candidate distribution node with the shortest transmission time from the at least one first candidate distribution node as a target distribution node, call the target distribution node to load the target language package, and transmit the target language package to the user terminal.
[0161] In one embodiment, the method further comprises:
[0162] If the target language package is stored in the local cache, then according to the identifier of the target language package, a language package file matching the identifier of the target language package is matched from the local cache;
[0163] The matching language package file is loaded into the operating environment of the user terminal.
[0164] In one embodiment, the calling of the positioning module of the user terminal to obtain the first location information of the user terminal includes:
[0165] Calling the positioning module of the user terminal to obtain the latitude and longitude information of the user terminal;
[0166] The latitude and longitude information is sent to a preset geographic location resolution server for location information resolution, a resolution result returned by the geographic location resolution server is received, and the first location information of the user terminal is obtained from the resolution result.
[0167] In one embodiment, determining at least one first candidate distribution node from a plurality of distribution nodes based on the first location information and the second location information includes:
[0168] Calculating the location distance between the user terminal and the server corresponding to each distribution node based on the first location information and the second location information;
[0169] A distribution node whose location distance is less than a preset threshold is selected as the first candidate distribution node.
[0170] In one embodiment, the target language package is created in the following manner:
[0171] Creating a basic structure of an initial language package, and adding the entry ID and entry content of the initial language package to the basic structure, wherein the entry content includes an entry key and an entry value;
[0172] The properties of the initial language package are set to obtain the target language package, wherein the properties include the running status, validity period, and version number of the initial language package.
[0173] In one embodiment, after the target language package is created, the method further includes:
[0174] Convert the created target language package into a JSON format file;
[0175] Publish the JSON format file to the data distribution network, and use the data distribution network to store the JSON format file to each distribution node in the data distribution network, so as to call the data distribution network to send the release message of the target language package to the user end through the preset AIP interface.
[0176] In one embodiment, the load information includes a current load rate and available bandwidth; and calculating, based on the load information of each first candidate distribution node, the transmission time required for each first candidate distribution node to transmit the target language package to the user terminal includes:
[0177] Calculating the effective bandwidth of each first candidate distribution node according to the load rate and available bandwidth of each first candidate distribution node;
[0178] The transmission time required for each first candidate distribution node to transmit the target language packet to the user terminal is calculated according to the size of the target language packet and the effective bandwidth.
[0179] like Figure 3 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing a language package distribution method according to an embodiment of the present invention.
[0180] In this embodiment, the electronic device 1 includes, but is not limited to, a memory 11, a processor 12, and a network interface 13 that can be interconnected via a system bus. The memory 11 stores a language package distribution program 10, which can be executed by the processor 12. Figure 3 Only the electronic device 1 having components 11-13 and the language pack distribution program 10 is shown. It can be understood by those skilled in the art that Figure 3 The structure shown does not constitute a limitation on the electronic device 1 , and the electronic device 1 may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0181] The memory 11 includes internal memory and at least one type of readable storage medium. The memory provides a cache for the operation of the electronic device 1; the readable storage medium can be a non-volatile storage medium such as flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, a magnetic disk, an optical disk, etc. In some embodiments, the readable storage medium can be an internal storage unit of the electronic device 1; in other embodiments, the non-volatile storage medium can also be an external storage device of the electronic device 1, such as a plug-in hard disk equipped on the electronic device 1, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. In this embodiment, the readable storage medium of the memory 11 is generally used to store the operating system and various application software installed on the electronic device 1, such as the code of the language pack distribution program 10 in one embodiment of the present invention. In addition, the memory 11 can also be used to temporarily store various types of data that have been output or are about to be output.
[0182] In some embodiments, the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 12 is generally used to control the overall operation of the electronic device 1, such as performing control and processing related to data interaction or communication with other devices. In this embodiment, the processor 12 is used to execute program code stored in the memory 11 or process data, such as executing the language package distribution program 10.
[0183] The network interface 13 may include a wireless network interface or a wired network interface, and the network interface 13 is used to establish a communication connection between the electronic device 1 and a terminal (not shown in the figure).
[0184] Optionally, the electronic device 1 may further include a user interface, which may include a display and an input unit such as a keyboard. The optional user interface may also include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.
[0185] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0186] The language package distribution program 10 stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 12, it can achieve the following:
[0187] receiving a request from a user terminal to load a target language package, and querying, based on an identifier of the target language package, whether a local cache of the user terminal stores the target language package;
[0188] If the target language package is not stored in the local cache, calling the positioning module of the user terminal to obtain the first location information of the user terminal, and accessing the data distribution network according to a preset AIP interface between the user terminal and the data distribution network storing the target language package, to obtain the operating environment information of each distribution node in the data distribution network, the operating environment information including the load information of each distribution node and the second location information of the server corresponding to each distribution node;
[0189] Determining, based on the first location information and the second location information, at least one first candidate distribution node from a plurality of distribution nodes, where a geographical distance between the first candidate distribution node and the user terminal is less than a preset threshold, and calculating, based on load information of each first candidate distribution node, a transmission time required for each first candidate distribution node to transmit the target language package to the user terminal;
[0190] A first candidate distribution node with the shortest transmission time is selected from the at least one first candidate distribution node as a target distribution node, and the target distribution node is called to load the target language package and transmit it to the user terminal.
[0191] Specifically, the processor 12 can refer to the specific implementation method of the language package distribution program 10. Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0192] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable medium can be non-volatile or non-volatile. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0193] The computer-readable storage medium stores a language pack distribution program 10, which can be executed by one or more processors. The specific implementation of the computer-readable storage medium of the present invention is basically the same as the above-mentioned embodiments of the language pack distribution method, and will not be repeated here.
[0194] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the module division is merely a logical function division, and other division methods may be used in actual implementation.
[0195] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected to achieve the purpose of the solution of this embodiment according to actual needs.
[0196] In addition, the functional modules in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or hardware plus software functional modules.
[0197] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0198] Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims rather than the foregoing description, and all changes that come within the meaning and range of equivalents of the claims are intended to be embraced therein. Any reference to a figure in a claim should not be construed as limiting the claim to which it relates.
[0199] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. Second-order terms are used to indicate names and do not imply any particular order.
[0200] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A language pack distribution method, characterized in that: The method comprises: receiving a request from a user terminal to load a target language package, and querying, based on an identifier of the target language package, whether a local cache of the user terminal stores the target language package; If the target language package is not stored in the local cache, calling the positioning module of the user terminal to obtain the first location information of the user terminal, and accessing the data distribution network according to a preset AIP interface between the user terminal and the data distribution network storing the target language package, to obtain the operating environment information of each distribution node in the data distribution network, the operating environment information including the load information of each distribution node and the second location information of the server corresponding to each distribution node; Determining, based on the first location information and the second location information, at least one first candidate distribution node from a plurality of distribution nodes, where a geographical distance between the first candidate distribution node and the user terminal is less than a preset threshold, and calculating, based on load information of each first candidate distribution node, a transmission time required for each first candidate distribution node to transmit the target language package to the user terminal; A first candidate distribution node with the shortest transmission time is selected from the at least one first candidate distribution node as a target distribution node, and the target distribution node is called to load the target language package and transmit it to the user terminal.
2. The language pack distribution method according to claim 1, wherein: The method further comprises: If the target language package is stored in the local cache, then according to the identifier of the target language package, a language package file matching the identifier of the target language package is matched from the local cache; The matching language package file is loaded into the operating environment of the user terminal.
3. The language pack distribution method according to claim 1, wherein: The calling of the positioning module of the user terminal to obtain the first location information of the user terminal includes: Calling the positioning module of the user terminal to obtain the latitude and longitude information of the user terminal; The latitude and longitude information is sent to a preset geographic location resolution server for location information resolution, a resolution result returned by the geographic location resolution server is received, and the first location information of the user terminal is obtained from the resolution result.
4. The language pack distribution method according to claim 1, wherein: The determining, according to the first location information and the second location information, at least one first candidate distribution node from a plurality of distribution nodes includes: Calculating the location distance between the user terminal and the server corresponding to each distribution node based on the first location information and the second location information; A distribution node whose location distance is less than a preset threshold is selected as the first candidate distribution node.
5. The language pack distribution method according to claim 1, wherein: The target language package is created in the following way: Creating a basic structure of an initial language package, and adding the entry ID and entry content of the initial language package to the basic structure, wherein the entry content includes an entry key and an entry value; The properties of the initial language package are set to obtain the target language package, wherein the properties include the running status, validity period, and version number of the initial language package.
6. The language pack distribution method according to claim 5, wherein: After the target language package is created, the method further includes: Convert the created target language package into a JSON format file; Publish the JSON format file to the data distribution network, and use the data distribution network to store the JSON format file to each distribution node in the data distribution network, so as to call the data distribution network to send the release message of the target language package to the user end through the preset AIP interface.
7. The language pack distribution method according to claim 1, wherein: The load information includes a current load rate and available bandwidth; and calculating, based on the load information of each first candidate distribution node, the transmission time required for each first candidate distribution node to transmit the target language package to the user terminal, includes: Calculating the effective bandwidth of each first candidate distribution node according to the load rate and available bandwidth of each first candidate distribution node; The transmission time required for each first candidate distribution node to transmit the target language packet to the user terminal is calculated according to the size of the target language packet and the effective bandwidth.
8. A language pack distribution device, characterized in that: The device comprises: a query module, configured to receive a request from a user terminal to load a target language package, and query, based on an identifier of the target language package, whether the target language package is stored in a local cache of the user terminal; a calling module configured to, if the target language package is not stored in the local cache, call the positioning module of the user terminal to obtain first location information of the user terminal, and access the data distribution network according to a preset AIP interface between the user terminal and the data distribution network storing the target language package, to obtain operating environment information of each distribution node in the data distribution network, the operating environment information including load information of each distribution node and second location information of a server corresponding to each distribution node; a determination module, configured to determine, based on the first location information and the second location information, at least one first candidate distribution node from a plurality of distribution nodes, where a geographical location distance between the first candidate distribution node and the user terminal is less than a preset threshold, and calculate, based on load information of each first candidate distribution node, a transmission time required for each first candidate distribution node to transmit the target language package to the user terminal; The sending module is configured to select a first candidate distribution node with the shortest transmission time from the at least one first candidate distribution node as a target distribution node, call the target distribution node to load the target language package, and transmit the target language package to the user terminal.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a language pack distribution program executable by the at least one processor. The language pack distribution program is executed by the at least one processor so that the at least one processor can perform the language pack distribution method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a language pack distribution program, which can be executed by one or more processors to implement the language pack distribution method according to any one of claims 1 to 7.
Citation Information
Patent Citations
System version updating method, content distribution network node and remote gateway
CN107707589A
Webpage language switching method and device and terminal device
CN110362370A
Multi-language configuration method based on Web end, server, storage medium and electronic equipment
CN117170762A
Multi-terminal page text hot update deployment method and device
CN117786262A
Dynamic load balancing method of server and related equipment
CN118540326A