Language package updating method and device, storage medium and computer program product
By maintaining language packs on the server side and dynamically obtaining them on the H5 side, the problem of H5 developers need to frequently develop multiple language packs is solved, efficient updates and international services of language packs are realized, and development costs and distribution risks are reduced. .
Patent Information
- Application Number
- CN202411344915.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-27
AI Technical Summary
H5 developers need to complete the development of multiple language packages in the H5 side code to meet the needs of users to choose different languages, resulting in excessive development costs.
By parsing the language pack information from the request when receiving the switching language request, querying whether the language pack exists on the server side, and obtaining and rendering it to the front-end interactive page from the server side when it exists. All language packs are maintained on the server side, H5 Side-only obtain the multiple language switching to complete, reducing development work.
It saves development costs and human resources for H5 developers, reduces the risk of frequent releases, and improves the efficiency and user experience of international services.
Smart Images

Figure CN119201172A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of smart home technology, and more specifically, to a method and device for updating a language package, a storage medium, and a computer program product. Background Art
[0002] As economic globalization becomes the mainstream, cross-border trade of major companies has become increasingly frequent, which has led to the need to provide international services. Based on this, the internationalization of APP usage has been put on the agenda. Traditional H5 internationalization requires a large amount of multilingual copywriting to be maintained on the H5 front end, and the copywriting is replaced according to the different languages selected by the user. When faced with the addition of new languages or the need to modify the language copywriting, this method often requires H5 developers to modify the copywriting in the source code and solve the problem by publishing a version. This method artificially increases the maintenance cost, and frequent version releases may bring unknown risks.
[0003] The existing implementation methods basically maintain static copy in H5 code. This method has the following disadvantages: it increases the development workload and makes maintenance difficult; and it requires frequent releases. Once an error is modified or business requirements change, it needs to be re-released.
[0004] Regarding related technologies, H5 developers need to complete the development of multiple language packages in the H5 side code to meet the needs of users to choose different languages. There are problems such as high development costs, and no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present application provide a language pack updating method and device, a storage medium, and a computer program product to at least solve the problem in the related art that H5 developers need to complete the development of multiple language packs in the H5 side code to meet the needs of users to choose different languages, and the development cost is too high.
[0006] According to an embodiment of the embodiments of the present application, a method for updating a language package is provided, comprising: upon receiving a language switching request sent by a first object through the front-end interaction page, parsing language package information of a first language package to be switched by the first object from the language switching request, wherein the first language package is used to indicate a text category in the front-end interaction page; querying whether the first language package exists in a server side according to the language package information; and when it is determined that the first language package exists in the server side, obtaining the first language package from the server side, and rendering the front-end interaction page according to the first language package.
[0007] In an exemplary embodiment, upon receiving a language switching request sent by a first object, before parsing the language pack information of the first language pack to be switched by the first object from the language switching request, the method also includes: upon determining that the first object accesses the front-end interaction page, obtaining a default language pack stored in the front-end interaction page; performing initial page rendering on the front-end interaction page according to the default language pack; and upon determining that the initial page rendering is completed, sending a link request to the server side to establish a link relationship with the server side.
[0008] In an exemplary embodiment, after rendering the front-end interactive page according to the first language package, the method further includes: determining whether the rendering of the first language package is completed; if it is determined that the rendering of the first language package is completed, querying whether the front-end interactive page has received a change request, wherein the change request is used to request a change to the default language package; if the change request is received, updating the default language package to the first language package.
[0009] In an exemplary embodiment, the method also includes: receiving a language pack update message sent by the server side, wherein the language pack update message is used to indicate that a second language pack is newly added to the server side; generating a first update instruction according to the language pack update message, and displaying the first update instruction in the front-end interaction page, wherein the first update instruction is used to prompt the first object to obtain the second language pack; when it is determined that the first object responds to the first update instruction, obtaining the second language pack from the server side, and rendering the front-end interaction page according to the second language pack.
[0010] In an exemplary embodiment, the method also includes: receiving a language package change message sent by the server side, wherein the language package change message is used to indicate that a change has occurred in the third language package in the server side; determining whether the language package currently used by the front-end interaction page is the third language package; in the case where it is determined that the language package currently used by the front-end interaction page is the third language package, generating a second update instruction based on the changed third language package, and displaying the second update instruction on the front-end interaction page, wherein the second update instruction is used to prompt the first object to obtain the changed third language package; in the case where it is determined that the first object responds to the second update instruction, obtaining the changed third language package from the server side, and rendering the front-end interaction page according to the changed third language package.
[0011] In an exemplary embodiment, the method further includes: receiving error information fed back by the first object, wherein the error information is used to indicate an error existing in a language package currently used by the front-end interactive page; performing a security check on the error information; and when it is determined that the error information passes the security check, uploading the error information to the server.
[0012] In an exemplary embodiment, before querying whether the first language package exists in the server side according to the language package information, the method also includes: querying the first language package in the language package list of the front-end interaction page according to the language package information, wherein the language package list stores multiple language packages acquired by the front-end interaction page, and the multiple language packages include the default language package; when the first language package is queried, rendering the front-end interaction page according to the first language package; when the first language package is not queried, querying whether the first language package exists in the server side.
[0013] According to another embodiment of the embodiment of the present application, a language package updating device is also provided, including: a parsing module, for, upon receiving a language switching request sent by a first object through a front-end interactive page, parsing language package information of a first language package to be switched by the first object from the language switching request, wherein the first language package is used to indicate a text category in the front-end interactive page; a query module, for querying whether the first language package exists in a server side according to the language package information; an acquisition module, for acquiring the first language package from the server side when it is determined that the first language package exists in the server side, and rendering the front-end interactive page according to the first language package.
[0014] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned language package update method when running.
[0015] According to another aspect of the embodiments of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the language package updating method through the computer program.
[0016] According to another aspect of the embodiments of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps of the method described in each embodiment of the present application are implemented.
[0017] In an embodiment of the present application, after receiving a language switching request sent by the first object through the front-end interaction page, the language package information of the first language package to be switched by the first object is parsed from the language switching request, wherein the first language package is used to indicate the text category of the text rendered in the front-end interaction page; the server is queried whether the first language package exists according to the language package information; if it exists, the first language package is obtained from the server, and the front-end interaction page is rendered to complete the update of the language package in the front-end interaction page; by adopting the above scheme, all language packages are placed on the server for maintenance, and the H5 side (i.e. the above-mentioned front-end interaction page) only needs to obtain the language package from the server to complete the switching of multiple languages, and developers do not need to frequently perform development work on the H5 side, saving manpower costs; thereby solving the problem in the related technology that H5 developers need to complete the development of multiple language packages in the H5 side code to meet the needs of users to choose different languages, and the development cost is too high. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0020] Figure 1 is a hardware environment diagram of an optional language package update method according to an embodiment of the present application;
[0021] Figure 2 is a flowchart of an optional language pack update method according to an embodiment of the present application;
[0022] Figure 3 is a flow chart of an optional language package update method according to an embodiment of the present application (I);
[0023] Figure 4 is a flow chart (II) of an optional method for updating a language package according to an embodiment of the present application;
[0024] Figure 5 is a flow chart of an optional language package update method according to an embodiment of the present application (III);
[0025] Figure 6 It is a structural block diagram of an optional language package updating device according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] According to one aspect of an embodiment of the present application, a method for updating a language package is provided. The method for updating a language package is widely used in smart home, smart home, smart home device ecology, smart residential ecology and other whole-house intelligent digital control application scenarios. Optionally, in this embodiment, the method for updating the language package can be applied to Figure 1 In the hardware environment composed of the terminal device 102 and the server 104 shown in FIG. Figure 1 As shown, the server 104 is connected to the terminal device 102 via a network, and can be used to provide services (such as application services, etc.) for the terminal or a client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data computing services for the server 104.
[0029] The network may include but is not limited to at least one of the following: wired network, wireless network. The wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal device 102 may be but is not limited to a PC, a mobile phone, a tablet computer, a smart air conditioner, a smart range hood, a refrigerator, a smart oven, a smart stove, a smart washing machine, a smart water heater, a smart washing equipment, a smart dishwasher, a smart projection equipment, a smart TV, a smart clothes drying rack, a smart curtain, a smart audio and video, a smart socket, a smart speaker, a smart fresh air equipment, a smart kitchen and bathroom equipment, a smart bathroom equipment, a smart sweeping robot, a smart window cleaning robot, a smart mopping robot, a smart air purification equipment, a smart steamer, a smart microwave oven, a smart kitchen treasure, a smart purifier, a smart water dispenser, a smart door lock, etc.
[0030] In this embodiment, a method for updating a language package is provided, which is applied to a front-end interactive page. Figure 2 : is a flowchart of an optional method for updating a language package according to an embodiment of the present application, the process comprising the following steps:
[0031] Step S202, when receiving a language switching request sent by the first object through the front-end interactive page, parsing the language switching request to obtain a first language package to be switched by the first object, wherein the first language package is used to indicate a text category in the front-end interactive page;
[0032] It should be noted that the first object can be understood as a user who uses the front-end interactive page, or as a tester who performs usage tests on the front-end interactive page, or as other objects, and this application does not impose any restrictions on this.
[0033] Step S204, querying whether the first language package exists in the server;
[0034] Step S206: when it is determined that the first language package exists in the server, the first language package is obtained from the server, and the front-end interactive page is rendered according to the first language package.
[0035] In an embodiment of the present application, after receiving a language switching request sent by the first object through the front-end interaction page, the language package information of the first language package to be switched by the first object is parsed from the language switching request, wherein the first language package is used to indicate the text category of the text rendered in the front-end interaction page; the server is queried whether the first language package exists according to the language package information; if it exists, the first language package is obtained from the server, and the front-end interaction page is rendered to complete the update of the language package in the front-end interaction page; by adopting the above scheme, all language packages are placed on the server for maintenance, and the H5 side (i.e. the above-mentioned front-end interaction page) only needs to obtain the language package from the server to complete the switching of multiple languages, and developers do not need to frequently perform development work on the H5 side, saving manpower costs; thereby solving the problem in the related technology that H5 developers need to complete the development of multiple language packages in the H5 side code to meet the needs of users to choose different languages, and the development cost is too high.
[0036] Optionally, when receiving a language switching request sent by the first object, before parsing the language pack information of the first language pack to be switched by the first object from the language switching request, the method also includes: when it is determined that the first object accesses the front-end interaction page, obtaining the default language pack stored in the front-end interaction page; performing initial page rendering on the front-end interaction page according to the default language pack; and when it is determined that the initial page rendering is completed, sending a link request to the server side to establish a link relationship with the server side.
[0037] Each time a user (i.e., the first object) visits the front-end interactive page, the front-end interactive page will perform an initial page rendering. At this time, H5 (the front-end interactive page) needs to render the page through the built-in default language package for the user to view. After the initial page rendering is completed, H5 will actively send a websocket link request (i.e., the above link request) to the server (server side) to establish a link with the server, so that the language package-related interaction process can be carried out with the server side.
[0038] In an optional embodiment, the present application provides an optional language package update method, the process of which is as follows: Figure 3 As shown, the following steps are included:
[0039] Step 3.1, the user enters the app and opens the H5 page;
[0040] Step 3.2, H5 uses the built-in default language package to render the initial page and displays the rendered page to the user;
[0041] Step 3.3, H5 sends a request to the server to establish a websocket connection;
[0042] Step 3.4, the server returns a message indicating that the server has established a successful connection.
[0043] Step 3.5, the user chooses to switch the language pack;
[0044] Step 3.6, H5 queries the server for the language package that the user wants to switch to (i.e., the first language package mentioned above);
[0045] Step 3.7, sever confirms whether the language pack is included;
[0046] Step 3.8: After confirmation, the server returns the language package required by the user to H5;
[0047] Step 3.9, H5 renders the page according to the language pack and displays it to the user.
[0048] Optionally, after rendering the front-end interactive page according to the first language package, the method further includes: determining whether the rendering of the first language package is completed; if it is determined that the rendering of the first language package is completed, querying whether the front-end interactive page has received a change request, wherein the change request is used to request a change to the default language package; if the change request is received, updating the default language package to the first language package.
[0049] After the user selects the first language pack to render the front-end interactive page, H5 can proactively ask the user whether the user needs to update the default language pack. If the user selects yes, a change request is automatically initiated to update the default language pack to the first language pack. The next time the user starts H5, the initial page rendering will be performed with the first language pack.
[0050] Optionally, the method also includes: receiving a language pack update message sent by the server, wherein the language pack update message is used to indicate that a second language pack is added to the server; generating a first update instruction according to the language pack update message, and displaying the first update instruction in the front-end interaction page, wherein the first update instruction is used to prompt the first object to obtain the second language pack; when it is determined that the first object responds to the first update instruction, obtaining the second language pack from the server, and rendering the front-end interaction page according to the second language pack.
[0051] The operation personnel will regularly configure new language names and language contents in the operation background and generate new language packs. After receiving the newly added language packs sent by the operation background, the server will send a language pack update message to H5; H5 will generate a first update instruction based on the language pack update message to guide the user to update the language pack; if the user responds to the first update instruction, H5 will cache the newly added second language pack, and then after the user chooses to switch the language pack, the page will be re-rendered according to the second language pack and displayed to the user.
[0052] The above language pack update process is as follows Figure 4 As shown, Figure 4 An optional language pack update process is shown, which specifically includes the following steps:
[0053] Step 4.1: The operator configures the new language name and language content in the operation background;
[0054] Step 4.2: After adding a new language package (i.e. the second language package mentioned above), the operation backend will send the new language package to the server;
[0055] Step 4.3: The server pushes the language pack update message to H5;
[0056] Step 4.4, H5 guides users to update the language pack;
[0057] Step 4.5, the user chooses to download the language pack to the local computer;
[0058] Step 4.6, H5 responds to the user operation and caches the language pack;
[0059] Step 4.7, the user chooses to switch the language pack;
[0060] Step 4.8, H5 renders the page to the user.
[0061] Optionally, the method also includes: receiving a language package change message sent by the server, wherein the language package change message is used to indicate that a change has occurred in the third language package in the server; determining whether the language package currently used by the front-end interaction page is the third language package; when it is determined that the language package currently used by the front-end interaction page is the third language package, generating a second update instruction based on the changed third language package, and displaying the second update instruction on the front-end interaction page, wherein the second update instruction is used to prompt the first object to obtain the changed third language package; when it is determined that the first object responds to the second update instruction, obtaining the changed third language package from the server, and rendering the front-end interaction page according to the changed third language package.
[0062] The language pack uploaded to the server is not immutable. When the operator finds errors in the language pack or needs to update the content, the operator will edit the language pack on the operation platform and update it on the server after the editing is completed. After the server detects that there is a change in the language pack, it will push the language pack change message to H5, and H5 will generate a second update instruction to guide the user to update the language pack; if the user responds to the second update instruction, H5 will obtain the changed third language pack from the server, render the page, and display it to the user.
[0063] In an optional embodiment, the above language pack change process can be performed by Figure 5 The process shown is completed as follows: Figure 5 As shown, the specific steps include:
[0064] Step 5.1: The operator edits the language content on the operation platform;
[0065] Step 5.2, the operation platform sends the edited language package to the server;
[0066] Step 5.3: After detecting that the language pack has changed, the server pushes the language pack change message to the H5 side;
[0067] Step 5.4, H5 side guides users to update language pack;
[0068] Step 5.5, the user chooses to download the language pack to the local computer;
[0069] Step 5.6, H5 cache language package;
[0070] Step 5.7, the user chooses to switch the language pack;
[0071] Step 5.8, H5 renders the page according to the language pack and displays it to the user.
[0072] Optionally, the method also includes: receiving error information fed back by the first object, wherein the error information is used to indicate an error existing in a language package currently used by the front-end interactive page; performing a security check on the error information; and when it is determined that the error information passes the security check, uploading the error information to the server.
[0073] In an optional embodiment, after the user downloads and uses the language pack, the user's feedback information can also be accepted to collect error information in the language pack. After receiving the user feedback, an initial verification is first performed on it to avoid the user feedback of harassing information and other useless information; after the verification, the error information is uploaded to the server or operation background so that the operation personnel can correct the language pack in time.
[0074] Optionally, before querying whether the first language package exists in the server side according to the language package information, the method also includes: querying the first language package in a language package list of the front-end interaction page according to the language package information, wherein the language package list stores multiple language packages acquired by the front-end interaction page, and the multiple language packages include the default language package; when the first language package is queried, rendering the front-end interaction page according to the first language package; when the first language package is not queried, querying whether the first language package exists in the server side.
[0075] H5 can store multiple language packs. The language pack list shows users the language packs that H5 has cached. After the user chooses to update to the first language pack, the user can first query in the language pack list to confirm whether the user has cached the first language pack in H5. If not, further query on the server side. If it is cached, the first language pack cached by H5 can be directly used to render the page.
[0076] With the development of the global market, the demand for expanding user groups and increasing market share is strong. The internationalization of applications is no longer a technical choice, but a strategic decision that can help companies open up new markets, improve user satisfaction, and maintain competitive advantages in global competition. With the deepening of the globalization process, internationalization will become an indispensable and important part of APP development. With the increasingly popular trend of APP hybrid development mode, how to quickly support a new language has become a difficult problem for H5 development in hybrid APP. Traditional language updates are nothing more than establishing multiple files in the front-end code, mapping different languages through js or plug-ins. Maintaining such files is time-consuming and laborious and requires version updates. Versions still need to be released when the copy is changed. This application sets the file to be dynamically updated by means of the configuration of the operation platform, and establishes a push mechanism between H5 and sever, ensuring that as long as the initialization code is integrated in different versions of H5 packages, the user side can always receive the latest language updates without the need to release versions, reducing the development workload of H5 and reducing the frequency of version releases; in addition, the code volume is reduced to a certain extent, so that the language package can be loaded on demand, which improves the user experience.
[0077] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0078] In this embodiment, a language package update device is also provided, and the language package update device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0079] Figure 6 is a structural block diagram of an optional language package updating device according to an embodiment of the present application; Figure 6 As shown, including:
[0080] The parsing module 62 is used to parse the language package information of the first language package to be switched by the first object from the language switching request when receiving the language switching request sent by the first object through the front-end interactive page, wherein the first language package is used to indicate the text category in the front-end interactive page;
[0081] A query module 64, configured to query whether the first language package exists in the server according to the language package information;
[0082] The acquisition module 66 is used to acquire the first language package from the server side when it is determined that the first language package exists in the server side, and render the front-end interactive page according to the first language package.
[0083] Through the above-mentioned device, after receiving the language switching request sent by the first object through the front-end interactive page, the language package information of the first language package to be switched by the first object is parsed from the language switching request, wherein the first language package is used to indicate the text category of the text rendered in the front-end interactive page; according to the language package information, it is queried whether the first language package exists in the server side; if it exists, the first language package is obtained from the server side, and the front-end interactive page is rendered to complete the update of the language package in the front-end interactive page; by adopting the above-mentioned scheme, all language packages are placed on the server side for maintenance, and the H5 side (i.e. the above-mentioned front-end interactive page) only needs to obtain the language package from the server side to complete the switching of multiple languages, and the developers do not need to frequently perform development work on the H5 side, saving manpower costs; thereby solving the problem in the related technology that the H5 developers need to complete the development of multiple language packages in the H5 side code to meet the needs of users to choose different languages, and the development cost is too high.
[0084] Optionally, the above-mentioned parsing module 62 is also used to obtain a default language package stored in the front-end interaction page when it is determined that the first object accesses the front-end interaction page; perform initial page rendering on the front-end interaction page according to the default language package; and when it is determined that the initial page rendering is completed, send a link request to the server side to establish a link relationship with the server side.
[0085] Each time a user (i.e., the first object) visits the front-end interactive page, the front-end interactive page will perform an initial page rendering. At this time, H5 (the front-end interactive page) needs to render the page through the built-in default language package for the user to view. After the initial page rendering is completed, H5 will actively send a websocket link request (i.e., the above link request) to the server (server side) to establish a link with the server, so that the language package-related interaction process can be carried out with the server side.
[0086] Optionally, the acquisition module 66 is also used to determine whether the rendering of the first language package is completed; when it is determined that the rendering of the first language package is completed, query whether the front-end interactive page has received a change request, wherein the change request is used to request a change to the default language package; when the change request is received, update the default language package to the first language package.
[0087] After the user selects the first language pack to render the front-end interactive page, H5 can proactively ask the user whether the user needs to update the default language pack. If the user selects yes, a change request is automatically initiated to update the default language pack to the first language pack. The next time the user starts H5, the initial page rendering will be performed with the first language pack.
[0088] Optionally, the above-mentioned acquisition module 66 is also used to receive a language pack update message sent by the server side, wherein the language pack update message is used to indicate that a second language pack is added to the server side; generate a first update instruction according to the language pack update message, and display the first update instruction in the front-end interaction page, wherein the first update instruction is used to prompt the first object to obtain the second language pack; when it is determined that the first object responds to the first update instruction, obtain the second language pack from the server side, and render the front-end interaction page according to the second language pack.
[0089] The operation personnel will regularly configure new language names and language contents in the operation background and generate new language packs. After receiving the newly added language packs sent by the operation background, the server will send a language pack update message to H5; H5 will generate a first update instruction based on the language pack update message to guide the user to update the language pack; if the user responds to the first update instruction, H5 will cache the newly added second language pack, and then after the user chooses to switch the language pack, the page will be re-rendered according to the second language pack and displayed to the user.
[0090] Optionally, the above-mentioned acquisition module 66 is also used to receive a language package change message sent by the server side, wherein the language package change message is used to indicate that a change has occurred in the third language package in the server side; determine whether the language package currently used by the front-end interaction page is the third language package; when it is determined that the language package currently used by the front-end interaction page is the third language package, generate a second update instruction according to the changed third language package, and display the second update instruction in the front-end interaction page, wherein the second update instruction is used to prompt the first object to obtain the changed third language package; when it is determined that the first object responds to the second update instruction, obtain the changed third language package from the server side, and render the front-end interaction page according to the changed third language package.
[0091] The language pack uploaded to the server is not immutable. When the operator finds errors in the language pack or needs to update the content, the operator will edit the language pack on the operation platform and update it on the server after the editing is completed. After the server detects that there is a change in the language pack, it will push the language pack change message to H5, and H5 will generate a second update instruction to guide the user to update the language pack; if the user responds to the second update instruction, H5 will obtain the changed third language pack from the server, render the page, and display it to the user.
[0092] Optionally, the above-mentioned device is also used to receive error information fed back by the first object, wherein the error information is used to indicate an error existing in the language package currently used by the front-end interactive page; perform a security check on the error information; and when it is determined that the error information passes the security check, upload the error information to the server.
[0093] In an optional embodiment, after the user downloads and uses the language pack, the user's feedback information can also be accepted to collect error information in the language pack. After receiving the user feedback, an initial verification is first performed on it to avoid the user feedback of harassing information and other useless information; after the verification, the error information is uploaded to the server or operation background so that the operation personnel can correct the language pack in time.
[0094] Optionally, the query module 64 is further used to query the first language package in the language package list of the front-end interaction page according to the language package information, wherein the language package list stores multiple language packages acquired by the front-end interaction page, and the multiple language packages include the default language package; when the first language package is queried, the front-end interaction page is rendered according to the first language package; when the first language package is not queried, query whether the first language package exists in the server side.
[0095] H5 can store multiple language packs. The language pack list shows users the language packs that H5 has cached. After the user chooses to update to the first language pack, the user can first query in the language pack list to confirm whether the user has cached the first language pack in H5. If not, further query on the server side. If it is cached, the first language pack cached by H5 can be directly used to render the page.
[0096] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.
[0097] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:
[0098] S1, when receiving a language switching request sent by a first object through a front-end interactive page, parsing language package information of a first language package to be switched by the first object from the language switching request, wherein the first language package is used to indicate a text category in the front-end interactive page;
[0099] S2, querying the server side according to the language package information whether the first language package exists;
[0100] S3: When it is determined that the first language package exists in the server, the first language package is obtained from the server, and the front-end interactive page is rendered according to the first language package.
[0101] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0102] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0103] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0104] S1, when receiving a language switching request sent by a first object through a front-end interactive page, parsing language package information of a first language package to be switched by the first object from the language switching request, wherein the first language package is used to indicate a text category in the front-end interactive page;
[0105] S2, querying the server side according to the language package information whether the first language package exists;
[0106] S3: When it is determined that the first language package exists in the server, the first language package is obtained from the server, and the front-end interactive page is rendered according to the first language package.
[0107] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0108] An embodiment of the present application further provides a computer program product, comprising a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program product, and when the computer program is executed by a processor, the steps of the method described in each embodiment of the present application are implemented.
[0109] Optionally, in this embodiment, the above computer program may be configured to implement the following steps when executed by a processor:
[0110] S1, when receiving a language switching request sent by a first object through a front-end interactive page, parsing language package information of a first language package to be switched by the first object from the language switching request, wherein the first language package is used to indicate a text category in the front-end interactive page;
[0111] S2, querying the server side according to the language package information whether the first language package exists;
[0112] S3: When it is determined that the first language package exists in the server, the first language package is obtained from the server, and the front-end interactive page is rendered according to the first language package.
[0113] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0114] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0115] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for updating a language package, characterized in that: Applied to front-end interactive pages, including: When receiving a language switching request sent by the first object through the front-end interactive page, parsing language package information of a first language package to be switched by the first object from the language switching request, wherein the first language package is used to indicate a text category in the front-end interactive page; querying the server side according to the language package information whether the first language package exists; When it is determined that the first language package exists in the server side, the first language package is obtained from the server side, and the front-end interactive page is rendered according to the first language package.
2. The method for updating a language pack according to claim 1, characterized in that: In the case of receiving a language switching request sent by a first object, before parsing language package information of a first language package to be switched by the first object from the language switching request, the method further includes: In the case of determining that the first object accesses the front-end interaction page, acquiring a default language package stored in the front-end interaction page; Performing initial page rendering on the front-end interactive page according to the default language package; When it is determined that the initial page rendering is completed, a link request is sent to the server to establish a link relationship with the server.
3. The method for updating a language pack according to claim 2, characterized in that: After rendering the front-end interactive page according to the first language package, the method further includes: Determining whether the first language package has been rendered; When it is determined that the rendering of the first language package is completed, querying whether the front-end interactive page has received a change request, wherein the change request is used to request to change the default language package; When the change request is received, the default language package is updated to the first language package.
4. The method for updating a language pack according to claim 1, characterized in that: The method further includes: receiving a language package update message sent by the server, wherein the language package update message is used to indicate that a second language package is newly added in the server; generating a first update instruction according to the language pack update message, and displaying the first update instruction on the front-end interaction page, wherein the first update instruction is used to prompt the first object to obtain the second language pack; When it is determined that the first object responds to the first update instruction, the second language package is obtained from the server, and the front-end interactive page is rendered according to the second language package.
5. The method for updating a language pack according to claim 1, characterized in that: The method further includes: receiving a language package change message sent by the server, wherein the language package change message is used to indicate that a change has occurred in a third language package in the server; Determining whether the language package currently used by the front-end interactive page is the third language package; When it is determined that the language package currently used by the front-end interactive page is the third language package, generating a second update instruction according to the changed third language package, and displaying the second update instruction on the front-end interactive page, wherein the second update instruction is used to prompt the first object to obtain the changed third language package; When it is determined that the first object responds to the second update instruction, the changed third language package is obtained from the server, and the front-end interactive page is rendered according to the changed third language package.
6. The method for updating a language package according to any one of claims 1 to 5, characterized in that: The method further comprises: receiving error information fed back by the first object, wherein the error information is used to indicate an error existing in a language package currently used by the front-end interactive page; Performing a security check on the error information; When it is determined that the error information passes the security check, the error information is uploaded to the server.
7. The method for updating a language pack according to claim 2, characterized in that: Before querying whether the server side has the first language package according to the language package information, the method further includes: Searching for the first language package in a language package list of the front-end interactive page according to the language package information, wherein the language package list stores multiple language packages acquired by the front-end interactive page, and the multiple language packages include the default language package; When the first language package is found, rendering the front-end interactive page according to the first language package; If the first language package is not found, query the server to see whether the first language package exists.
8. A language pack updating device, characterized in that: include: a parsing module, configured to, upon receiving a language switching request sent by a first object through a front-end interactive page, parse the language switching request to obtain language package information of a first language package to be switched by the first object, wherein the first language package is used to indicate a text category in the front-end interactive page; A query module, configured to query whether the first language package exists in the server according to the language package information; The acquisition module is used to acquire the first language package from the server side when it is determined that the first language package exists in the server side, and render the front-end interactive page according to the first language package.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 7 when executed.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.