Language switching method and device of application page and storage medium

By using application configuration files and cache lists to update control text attributes in the vehicle infotainment system, the problems of state loss and interaction interruption caused by page reconstruction were solved, and an efficient language switching process was achieved.

CN120950157APending Publication Date: 2025-11-14ECARX (HUBEI) TECHCO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511037681.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-25
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

In existing technologies, when the language of the application page of the vehicle system is switched, the page reconstruction leads to loss of state, loss of data and interruption of interaction. The manual refresh solution is inefficient and prone to missing controls.

Method used

By responding to language switching requests, the application configuration file is used to prevent page restarts, the text identifiers of control objects in the cache list are obtained, and the text properties of the controls are updated according to the string management file of the target language, thus avoiding page rebuilds.

Benefits of technology

It enables dynamic refresh and immediate effect of page language switching, maintains page state, avoids loss of interactive content, improves switching efficiency, and avoids missing controls.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120950157A_ABST
    Figure CN120950157A_ABST
Patent Text Reader

Abstract

The invention provides a language switching method and device of an application page and a storage medium, the method responds to a detected language switching request of the application page, restarting of the application page is shielded according to an application configuration file, text identifiers of all control objects of configured texts are obtained from a cache list corresponding to the application page, and the text identifiers of all the control objects of the configured texts are stored in the cache list; according to the method, the target language of the application page is determined, the target text of the control object is determined for each control object according to the text identifier and the character string management file corresponding to the target language, and the text attribute of the control object is updated according to the target text, so that dynamic refreshing and immediate effectiveness of application page language switching are realized. The effect of switching the page language without reconstructing the page can be achieved, the page state is kept in the page language switching process, interactive content in the page is prevented from being lost, and user interaction interruption is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of application page technology, specifically to a method, apparatus, and storage medium for switching the language of an application page. Background Technology

[0002] Currently, in the development of Android applications for in-vehicle infotainment systems, the following methods are commonly used to achieve multi-language adaptation: 1. Page reconstruction solution: When switching languages, the current page is destroyed and then recreated. During the recreation, the text on the page will be updated to the new language. 2. Manual refresh solution: On each page, the controls that need to have their text changed are manually identified and cached. When switching languages, new text is set for these controls on each page. However, each custom control requires special handling and cannot be generalized.

[0003] Among the aforementioned technologies, page reconstruction solutions, which require destroying and rebuilding the page, may lead to state loss, data loss, and interaction interruptions for complex or highly interactive pages, impacting user experience. Manual refresh solutions require pre-defining the controls to be replaced, which is inefficient, labor-intensive, and prone to missing some controls. Summary of the Invention

[0004] In view of the above-mentioned defects or deficiencies in the prior art, this application aims to provide a method, apparatus and storage medium for switching the language of an application page, so as to solve the problem of page progress loss and interaction interruption caused by page reconstruction in the related art.

[0005] This application provides a method for switching the language of an application page, the method comprising:

[0006] In response to the detection of a language switching request on an application page, the application page is blocked from restarting according to the application configuration file;

[0007] From the cache list corresponding to the application page, obtain the text identifiers of each control object with configured text, and determine the target language of the application page;

[0008] For each control object, the target text of the control object is determined based on the text identifier and the string management file corresponding to the target language, and the text attribute of the control object is updated based on the target text.

[0009] Optionally, the target text of the control object is determined based on the text identifier and the string management file corresponding to the target language, including:

[0010] In the string management file corresponding to the target language, query the preset text corresponding to the text identifier;

[0011] The retrieved preset text is used as the target text of the control object.

[0012] Optionally, the text identifier includes at least one of a display text identifier and a prompt text identifier. In the string management file corresponding to the target language, querying the preset text corresponding to the text identifier includes:

[0013] Based on the displayed text identifier, query the corresponding preset displayed text in the string management file corresponding to the target language;

[0014] And / or, based on the prompt text identifier, query the corresponding preset prompt text in the string management file corresponding to the target language.

[0015] Optionally, the construction of the application configuration file includes:

[0016] Obtain the initial configuration file corresponding to the application and generate control statements to prevent the application page from restarting;

[0017] The control statements are inserted into the initial configuration file to obtain the application configuration file.

[0018] Optionally, the construction of the string management file includes:

[0019] Retrieve the preset text for each control in various languages;

[0020] For each language, a string management file corresponding to that language is created, and the preset text of each control under that language and the text identifier of each control are associated and stored in the string management file.

[0021] Optionally, the construction of the cache list includes:

[0022] In response to the detection of the creation of the application page, the layout file of the application page is parsed based on a predefined parser to obtain the control tags in the layout file, and control objects corresponding to each control in the application page are generated according to the control tags.

[0023] The text identifier in the attribute configuration information of each control is obtained based on a predefined parser, and it is determined whether the control has been configured with text based on the text identifier;

[0024] Create a cache list, write the control objects corresponding to the controls with configured text into the cache list, and cache the corresponding text identifiers in the control objects.

[0025] Optionally, determining whether the control has been configured with text based on the text identifier includes:

[0026] If the text identifier is greater than the preset identifier, then it is determined that the control has been configured with text.

[0027] Optionally, after writing the control object corresponding to the control with configured text to the cache list and caching the corresponding text identifier in the control object, the method further includes:

[0028] In response to the detection that the application page has been destroyed, the control objects in the cache list are removed.

[0029] This application embodiment also provides a language switching device for an application page, the device comprising:

[0030] The restart blocking module is used to block the restart of the application page in response to the detection of a language switching request on the application page, based on the application configuration file.

[0031] The list access module is used to retrieve the text identifiers of each control object with configured text from the cache list corresponding to the application page, and determine the target language of the application page;

[0032] The text setting module is used to determine the target text of each control object based on the text identifier and the string management file corresponding to the target language, and update the text attribute of the control object based on the target text.

[0033] This application embodiment also provides an electronic device, the electronic device comprising:

[0034] Processor and memory;

[0035] The processor executes the steps of the language switching method for the application page provided in any embodiment of this application by calling the program or instructions stored in the memory.

[0036] This application also provides a computer-readable storage medium storing a program or instructions that cause a computer to perform the steps of the language switching method for an application page provided in any embodiment of this application.

[0037] In summary, this application proposes a method for switching the language of an application page. This method, in response to a detected language switching request, prevents page restarts based on the application configuration file. It retrieves the text identifiers of each control object with configured text from the cache list corresponding to the application page, determines the target language of the application page, and then, for each control object, determines the target text of the control object based on the text identifier and the string management file corresponding to the target language. The method updates the text attributes of the control object based on the target text, achieving dynamic refresh and immediate effect of the application page language switching. When a user needs to switch the language of an application page, this method reads the text identifiers of each control object with configured text from the cache list corresponding to the application page, queries the string management file based on the text identifiers, and, combined with preventing page restarts based on the application configuration file, achieves the effect of switching the page language without rebuilding the page. It maintains the page state during language switching, avoids the loss of interactive content on the page and prevents user interaction interruption, ensuring the user interaction effect. Furthermore, this method does not require manual pre-classification of custom and non-custom controls, improving the efficiency of page language switching while avoiding missing controls on the page. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0039] Figure 1 This is a flowchart of a language switching method for an application page provided in an embodiment of this application;

[0040] Figure 2 This is a schematic diagram illustrating a process of switching application page language according to an embodiment of this application;

[0041] Figure 3 This is a schematic diagram of the structure of an application page language switching device provided in an embodiment of this application;

[0042] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0043] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0044] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0045] Before providing a detailed description of the language switching method for application pages provided in this application embodiment, the technical problem solved by this method will be explained first.

[0046] In related technologies, users typically need to restart the Activity or Fragment each time they need to change the page language. This involves destroying the current instance and creating a new one to reset the interface state or reload data. While this method saves the page's state and data before destruction and restores it after reconstruction, it can lead to lost interaction state, data loss, and interrupted interaction for complex pages or interactive processes. Besides restarting the instance for language switching, switching between day / night mode or landscape / portrait modes also requires restarting the instance to reset the interface state or reload data.

[0047] To address this issue, and considering that frequent language switching and Activity restarts may impact user experience and application performance, frequent page restarts should be avoided as much as possible. Furthermore, considering the need to ensure thorough testing of all supported languages ​​to avoid overlooking translation errors or layout issues, and considering the need to restore previous user interactions as much as possible when switching languages, and taking into account the version differences of different in-vehicle infotainment systems, this application provides a method for switching the language of an application page. This method does not require page reconstruction, ensures a good user experience, is applicable to any language, and is compatible with different in-vehicle infotainment system versions.

[0048] As mentioned in the background section, this application proposes a method for switching the language of an application page to address the problems in the prior art. Figure 1 This is a flowchart illustrating a language switching method for an application page provided in an embodiment of this application. See also... Figure 1 The specific methods for switching the language on the application page include:

[0049] S110. In response to the detection of a language switching request for the application page, prevent the application page from restarting according to the application configuration file.

[0050] The language switching request can be a user-triggered request to switch the language of an application page. For example, a user can initiate a voice command through the vehicle's infotainment system's voice module. After collecting the voice command, the voice module can recognize it. If the recognized voice command is for language switching, it can generate a language switching request. Besides initiating a language switching request based on a voice command, users can also trigger a language switching request through the application settings interface of the vehicle's infotainment system.

[0051] The application configuration file is a file that defines information about the application and is read by the vehicle's infotainment system when the application is installed and run. For example, the application configuration file can be an AndroidManifest.xml file.

[0052] In this embodiment of the application, statements for preventing the application page from restarting when the language is switched can be written in advance in the initial configuration file corresponding to the application to obtain the application configuration file.

[0053] In one example, building the application configuration file includes:

[0054] Obtain the initial configuration file corresponding to the application and generate control statements to block the application page from restarting; insert the control statements into the initial configuration file to obtain the application configuration file.

[0055] Among these, the control statement used to prevent page restart can specifically be used to prevent the application from restarting when switching languages, thereby avoiding the rebuilding of the application page. For example, the control statement could be: android:configChanges="locale|layoutDirection|keyboard".

[0056] After generating the control statement, it can be inserted into the application's initial configuration file to obtain the application configuration file. Subsequently, the application configuration file can be read during application runtime to disable application restart when switching languages.

[0057] The above example demonstrates how to modify the application's initial configuration file in advance to prevent the application from restarting when switching languages, thereby avoiding the need to rebuild the application pages.

[0058] In this embodiment of the application, if a language switching request for the application page is detected during application operation, the restart of the application page can be restricted by using the control statement in the application configuration file that is used to block page restart.

[0059] S120. Obtain the text identifier of each control object with configured text from the cache list corresponding to the application page, and determine the target language of the application page.

[0060] The cache list can be a storage structure for caching control objects with configured text in the application page. The control object with configured text can be a control object with at least one of configured display text and prompt text. When the application is running, the control objects with configured text can be determined by parsing the application page and then cached in the cache list.

[0061] In one specific implementation, the construction of the cache list includes:

[0062] In response to the detection of application page creation, the layout file of the application page is parsed based on a predefined parser to obtain the control tags in the layout file, and control objects corresponding to each control in the application page are generated according to the control tags.

[0063] The text identifier in the property configuration information of each control is obtained based on a predefined parser, and the control is determined to have been configured with text based on the text identifier.

[0064] Create a cache list, write the control objects corresponding to the controls with configured text to the cache list, and cache the corresponding text identifier in the control objects.

[0065] The predefined parser can be a custom parser that is pre-set to replace the default parser. For example, page parsing code and control property parsing code can be pre-generated, a predefined parser can be built based on the code, and the predefined parser can be used to replace the default parser.

[0066] Specifically, if the creation of an application page is detected, such as when a user launches the application or navigates to the next page within the application, a predefined parser can be invoked to parse the layout file of the application page, obtain the control tags in the layout file, and identify the controls in the application page. The control tags are used to identify the controls in the application page, and then for each control tag, a corresponding control object is generated.

[0067] Furthermore, a predefined parser can be invoked to retrieve the attribute configuration information of the control corresponding to the control label. This attribute configuration information describes the control's text attribute configuration, including the display text (android:text) and hint text (android:hint). The display text refers to the text actually displayed by the control, i.e., the text visible and operable by the user. The hint text refers to the text displayed by the control under certain operations, such as being displayed when the control content is empty and disappearing after input is entered.

[0068] Furthermore, a predefined parser can be invoked to read the text identifier in the attribute configuration information; whereby the text identifier can be understood as the index identifier corresponding to the configuration text of the control, and the text identifier may include the control's display text ID and tooltip text ID.

[0069] After obtaining the text identifiers from the property configuration information of each control, you can determine whether the control has been configured with text based on the text identifiers.

[0070] In one example, determining whether a control has been configured with text based on its text identifier includes:

[0071] If the text identifier is greater than the preset identifier, it is determined that the control has been configured with text.

[0072] The preset identifier can be a predefined identifier that indicates that the control is configured with text; for example, the preset identifier can be zero.

[0073] Specifically, if the text identifier is greater than the preset identifier, it can be determined that the control has been configured with text.

[0074] After identifying the controls with configured text, a cache list can be created, and the control objects corresponding to all controls with configured text can be written to the cache list. In the cache list, the text identifier of the controls with configured text can be cached into the corresponding control objects.

[0075] It should be noted that for controls configured with text, they may only be configured with display text or only with tooltip text, or both. Therefore, the display text identifier or tooltip text identifier of the control can be cached in the control object if it is greater than the preset identifier. For display text identifiers or tooltip text identifiers that are less than or equal to the preset identifier, caching is not required.

[0076] Through the above implementation method, when the application page is created, the control objects corresponding to the controls configured with text can be cached in a cache list in a timely manner. This makes it convenient to read the control objects configured with text in a timely manner and perform the corresponding text configuration when the language of the application page is switched in a later time.

[0077] Specifically, if a language switching request is detected on the application page, the cache list corresponding to the application page can be read first to obtain the text identifier of the control object corresponding to each control with configured text on the application page.

[0078] In addition to reading the text identifier of the control object with configured text, the target language can also be determined based on user settings or the context information of the control in the application page. The target language can be the language that the control in the application page is to be switched to.

[0079] S130. For each control object, determine the target text of the control object based on the text identifier and the string management file corresponding to the target language, and update the text property of the control object according to the target text.

[0080] Specifically, for each control object in the cache list, i.e. the control object with configured text, the target text of the control object can be determined according to the text identifier of the control object and the string management file corresponding to the target language. Then, the text property of the control object is updated according to the target text, such as at least one of the display text property or the prompt text property, that is, the target text is set in the text property of the control object.

[0081] The string management file corresponding to the target language can be a file used to store the text of each control in the target language, such as a strings.xml file. Specifically, different string management files can be pre-configured according to the text of each control in different language environments.

[0082] In one example, the construction of a string management file includes:

[0083] Retrieve the preset text of each control in various languages; for each language, create a string management file corresponding to that language, and associate and store the preset text of each control and the text identifier of each control in the string management file.

[0084] Specifically, the system can obtain the preset text of each control in various languages, and then create a corresponding string management file for each language. The preset text of each control in that language is associated with the text identifier of each control and stored in the string management file. This allows the text identifier to be used as an index to query the corresponding preset text in the string management file, thus improving search efficiency.

[0085] In one specific implementation, the target text of the control object is determined based on the text identifier and the string management file corresponding to the target language, including:

[0086] In the string management file corresponding to the target language, query the preset text corresponding to the text identifier; use the queried preset text as the target text of the control object.

[0087] Specifically, the text identifier of the control object can be used as an index, and then the preset text corresponding to the text identifier can be queried in the string management file corresponding to the target language based on the index, and used as the target text of the control object.

[0088] The above implementation method, by using the text identifier cached in the control object to query the target text of the control object in the string management file corresponding to the target language, can ensure the accuracy of the text displayed by the control after language switching and ensure the efficiency of page language switching.

[0089] In this embodiment of the application, when switching the language of the application page, some controls are pre-configured as display text and some controls are pre-configured as prompt text. Therefore, in the process of querying the target text, at least one of the display text and prompt text can be queried for the control object based on the text identifier cached in the control object.

[0090] In one example, the text identifier includes at least one of a display text identifier and a prompt text identifier. In the string management file corresponding to the target language, a preset text corresponding to the text identifier is queried, including:

[0091] Based on the display text identifier, search for the corresponding preset display text in the string management file corresponding to the target language; and / or, based on the prompt text identifier, search for the corresponding preset prompt text in the string management file corresponding to the target language.

[0092] Specifically, if the display text identifier of the control object is obtained from the cache list, it means that the control object has been configured with display text. Therefore, when switching languages, the display text of the control needs to be updated. You can query the preset display text corresponding to the display text identifier in the string management file corresponding to the target language.

[0093] Furthermore, if the tooltip identifier of the control object is obtained from the cache list, it means that the control object has been configured with tooltip text. Therefore, when switching languages, the tooltip text of the control needs to be updated. You can query the preset tooltip text corresponding to the tooltip identifier in the string management file corresponding to the target language.

[0094] In addition, if the display text identifier and tooltip text identifier of the control object are obtained from the cache list, it means that the control object has been configured with display text and tooltip text. Therefore, when switching languages, it is necessary to update the display text and tooltip text of the control at the same time. You can query the preset display text corresponding to the display text identifier and the preset tooltip text corresponding to the tooltip text identifier in the string management file corresponding to the target language.

[0095] The above example demonstrates how to query at least one of the display text and tooltip text of a control with configured text, thus avoiding the omission of switching the display text or tooltip text of the control.

[0096] In this embodiment of the application, considering that the cache list will occupy a certain amount of memory space of the vehicle system, after the cache list is created, if the application page is detected to be destroyed, the cached control object can be removed to release memory.

[0097] In one example, after writing the control object corresponding to the control with configured text to the cache list and caching the corresponding text identifier in the control object, the process also includes:

[0098] In response to the detection that the application page has been destroyed, remove the control objects from the cache list.

[0099] Specifically, if the application page is detected to be destroyed, such as when the user closes the application, or when the application actively stops its process when it detects insufficient system memory, the cached control objects can be removed.

[0100] The above example helps prevent cache lists of already launched applications from continuously consuming memory, thus improving system memory utilization.

[0101] The language switching method for application pages provided in this application embodiment responds to a detected language switching request for the application page. It prevents page restarts based on the application configuration file, retrieves the text identifiers of each control object with configured text from the cache list corresponding to the application page, determines the target language of the application page, and then, for each control object, determines the target text of the control object based on the text identifier and the string management file corresponding to the target language. The method updates the text attributes of the control object based on the target text, achieving dynamic refresh and immediate effect of the application page language switching. When a user needs to switch the language of the application page, this method reads the text identifiers of each control object with configured text in the page from the cache list corresponding to the application page, queries the string management file based on the text identifiers, and, combined with preventing page restarts based on the application configuration file, achieves the effect of switching the page language without rebuilding the page. It maintains the page state during language switching, avoids the loss of interactive content on the page and prevents user interaction interruption, ensuring the user interaction effect. Furthermore, this method does not require manual pre-classification of custom and non-custom controls, improving the efficiency of page language switching while avoiding missing controls on the page. In addition, the method provided in this application embodiment, by preventing page restarts during language switching, ensures the integrity of page resource updates.

[0102] Figure 2 This is a schematic diagram illustrating a process for switching the language of an application page, as provided in an embodiment of this application. Figure 2 As shown, firstly, string management files for different languages ​​can be preset, and control statements to disable switching and restarting the application can be configured in the application configuration file, replacing the default parser with a predefined parser.

[0103] Furthermore, in response to application page creation, the predefined parser can parse the control identifiers of each control from the layout text, namely textID and hintID, and determine whether the control is configured with text based on the control identifier. If not, the control object without configured text is not cached; if so, the control object with configured text is cached using the cache list, and the text identifier is cached in the control object.

[0104] Furthermore, in response to a system language switching notification, the cache list is traversed, and the target text in the target language is retrieved based on the cached text identifier. For example, the `Context.getString(int id)` method of the Android context object can be used to retrieve the preset text corresponding to `textID` and / or `hintID` from the string management file. The target text can then be set to the `text` and / or `hint` properties of the control object, where the `text` property is the display text property and the `hint` property is the prompt text property. The application language switching is then complete. Furthermore, in response to page destruction, the cached control objects in the cache list are cleared, releasing memory.

[0105] The process described in this application embodiment achieves the effect of switching page languages ​​without restarting the application. Furthermore, the switching process can be encapsulated within the application's UI framework layer. Once encapsulated, no further language adaptation is required, reducing workload and making it applicable to other applications. In addition, the process can cache control objects when the page is created and remove them when the page is destroyed. Language switching only requires a single iteration through the cache list, resulting in minimal performance overhead.

[0106] Figure 3 This is a schematic diagram of a language switching device for an application page provided in an embodiment of this application. The device includes a disable / restart module 310, a list access module 320, and a text setting module 330, wherein:

[0107] The restart blocking module 310 is used to block the restart of the application page in response to the detection of a language switching request of the application page, according to the application configuration file;

[0108] The list access module 320 is used to obtain the text identifiers of each control object with configured text from the cache list corresponding to the application page, and determine the target language of the application page;

[0109] The text setting module 330 is used to determine the target text of each control object based on the text identifier and the string management file corresponding to the target language, and update the text attribute of the control object based on the target text.

[0110] Based on the above embodiments, optionally, the text setting module 330 is specifically used for:

[0111] In the string management file corresponding to the target language, query the preset text corresponding to the text identifier;

[0112] The retrieved preset text is used as the target text of the control object.

[0113] Based on the above embodiments, optionally, the text identifier includes at least one of a display text identifier and a prompt text identifier, and the text setting module 330 is further configured to:

[0114] Based on the displayed text identifier, query the corresponding preset displayed text in the string management file corresponding to the target language;

[0115] And / or, based on the prompt text identifier, query the corresponding preset prompt text in the string management file corresponding to the target language.

[0116] Based on the above embodiments, optionally, the device further includes a shielding configuration module, which is used to obtain the initial configuration file corresponding to the application and generate control statements for shielding the application page restart; the control statements are inserted into the initial configuration file to obtain the application configuration file.

[0117] Based on the above embodiments, optionally, the device further includes a string file construction module, which is used to obtain the preset text of each control in various languages; for each language, a string management file corresponding to the language is created, and the preset text of each control in the language and the text identifier of each control are associated and stored in the string management file.

[0118] Optionally, based on the above embodiments, the apparatus further includes a list construction module, used for:

[0119] In response to the detection of the creation of the application page, the layout file of the application page is parsed based on a predefined parser to obtain the control tags in the layout file, and control objects corresponding to each control in the application page are generated according to the control tags.

[0120] The text identifier in the attribute configuration information of each control is obtained based on a predefined parser, and it is determined whether the control has been configured with text based on the text identifier;

[0121] Create a cache list, write the control objects corresponding to the controls with configured text into the cache list, and cache the corresponding text identifiers in the control objects.

[0122] Based on the above embodiments, optionally, the list construction module is further configured to determine that the control has been configured with text if the text identifier is greater than a preset identifier.

[0123] Based on the above embodiments, optionally, the list building module is also used to remove control objects from the cache list in response to detecting that the application page has been destroyed.

[0124] The language switching device for the application page provided in this application embodiment can execute the steps in the language switching method for the application page provided in this application method embodiment, and has the execution steps and beneficial effects, which will not be repeated here.

[0125] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. For example... Figure 4 As shown, the electronic device 400 includes one or more processors 401 and memory 402.

[0126] The processor 401 may be a central processing unit (CPU) or other form of processing unit with data processing and / or instruction execution capabilities, and may control other components in the electronic device 400 to perform desired functions.

[0127] The memory 402 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 401 may execute the program instructions to implement the language switching method for application pages in any embodiment of this application described above, and / or other desired functions. Various contents such as initial extrinsic parameters and thresholds may also be stored in the computer-readable storage medium.

[0128] In one example, the electronic device 400 may further include an input device 403 and an output device 404, these components being interconnected via a bus system and / or other forms of connection mechanisms (not shown). The input device 403 may include, for example, a keyboard, a mouse, etc. The output device 404 may output various information to the outside, including warning messages, braking force, etc. The output device 404 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.

[0129] Of course, for the sake of simplicity, Figure 4Only some of the components of the electronic device 400 relevant to this application are shown in this illustration; components such as buses, input / output interfaces, etc., are omitted. In addition, the electronic device 400 may include any other suitable components depending on the specific application.

[0130] In addition to the methods and devices described above, embodiments of this application may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps of the language switching method for application pages provided in any embodiment of this application.

[0131] The computer program product can be written in any combination of one or more programming languages ​​to perform the operations of the embodiments of this application. The programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0132] Furthermore, embodiments of this application may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps of the language switching method for application pages provided in any embodiment of this application.

[0133] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0134] It should be noted that the terminology used in this application is for the purpose of describing specific embodiments only and is not intended to limit the scope of this application. As shown in the specification and claims of this application, unless the context clearly indicates otherwise, words such as "a," "an," "an," and / or "the" do not specifically refer to the singular and may also include the plural. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, or apparatus. Without further limitations, an element defined by the phrase "comprising an..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes said element.

[0135] It should also be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on this application. Unless otherwise expressly specified and limited, the terms "installed," "connected," "linked," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication between two elements. For those skilled in the art, the specific meaning of the above terms in this application can be understood according to the specific circumstances.

[0136] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. The above descriptions are only preferred embodiments of this application. It should be noted that due to the limitations of written expression, while there are objectively infinite specific structures, those skilled in the art can make several improvements, modifications, or changes without departing from the principles of this application, and can also combine the above technical features in an appropriate manner. These improvements, modifications, changes, or combinations, or the direct application of the inventive concept and technical solution to other situations without modification, should all be considered within the scope of protection of this application.

Claims

1. A method for switching the language of an application page, characterized in that, include: In response to the detection of a language switching request on an application page, the application page is blocked from restarting according to the application configuration file; From the cache list corresponding to the application page, obtain the text identifiers of each control object with configured text, and determine the target language of the application page; For each control object, the target text of the control object is determined based on the text identifier and the string management file corresponding to the target language, and the text attribute of the control object is updated based on the target text.

2. The method according to claim 1, characterized in that, Based on the text identifier and the string management file corresponding to the target language, the target text of the control object is determined, including: In the string management file corresponding to the target language, query the preset text corresponding to the text identifier; The retrieved preset text is used as the target text of the control object.

3. The method according to claim 2, characterized in that, The text identifier includes at least one of a display text identifier and a prompt text identifier. In the string management file corresponding to the target language, a preset text corresponding to the text identifier is queried, including: Based on the displayed text identifier, query the corresponding preset displayed text in the string management file corresponding to the target language; And / or, based on the prompt text identifier, query the corresponding preset prompt text in the string management file corresponding to the target language.

4. The method according to claim 1, characterized in that, The construction of the application configuration file includes: Obtain the initial configuration file corresponding to the application and generate control statements to prevent the application page from restarting; The control statements are inserted into the initial configuration file to obtain the application configuration file.

5. The method according to claim 1, characterized in that, The construction of the string management file includes: Retrieve the preset text for each control in various languages; For each language, a string management file corresponding to that language is created, and the preset text of each control under that language and the text identifier of each control are associated and stored in the string management file.

6. The method according to claim 1, characterized in that, The construction of the cache list includes: In response to the detection of the creation of the application page, the layout file of the application page is parsed based on a predefined parser to obtain the control tags in the layout file, and control objects corresponding to each control in the application page are generated according to the control tags. The text identifier in the attribute configuration information of each control is obtained based on a predefined parser, and it is determined whether the control has been configured with text based on the text identifier; Create a cache list, write the control objects corresponding to the controls with configured text into the cache list, and cache the corresponding text identifiers in the control objects.

7. The method according to claim 6, characterized in that, Determining whether the control has been configured with text based on the text identifier includes: If the text identifier is greater than the preset identifier, then it is determined that the control has been configured with text.

8. The method according to claim 6, characterized in that, After writing the control object corresponding to the configured text control to the cache list and caching the corresponding text identifier in the control object, the method further includes: In response to the detection that the application page has been destroyed, the control objects in the cache list are removed.

9. A language switching device for an application page, characterized in that, The device includes: The restart blocking module is used to block the restart of the application page in response to the detection of a language switching request on the application page, according to the application configuration file. The list access module is used to retrieve the text identifiers of each control object with configured text from the cache list corresponding to the application page, and determine the target language of the application page; The text setting module is used to determine the target text of each control object based on the text identifier and the string management file corresponding to the target language, and update the text attribute of the control object based on the target text.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program or instructions that cause a computer to perform the steps of the language switching method for an application page as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Multi-language loading method and device for custom form controls

    CN112306620A

  • Page adaptation method and device

    CN113157270A

  • Language switching method and device, electronic equipment and storage medium

    CN115098200A

  • Application page processing method and device, storage medium and electronic equipment

    CN116302977A

  • Displaying computer interfaces in multiple languages

    US6559861B1