Android platform based language switching method and system

A technology for switching systems and languages, which is applied in the field of language switching methods and systems based on the Android platform, can solve problems such as slow switching speed, cumbersome language switching process, and low switching efficiency, so as to improve switching efficiency, improve language switching speed, and simplify language switching. The effect of the switching process

Active Publication Date: 2015-09-30
TCL CORPORATION
10 Cites 16 Cited by

AI-Extracted Technical Summary

Problems solved by technology

[0004] In view of the above-mentioned deficiencies in the prior art, the object of the present invention is to provide a language switching method and system based on the ...
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Method used

After obtaining priority information, can carry out language switching to each current visible display panel successively according to priority ordering rule, the process of language switching comprises: obtain the character string of each control on current display panel and according to preset multi-country The language resource file determines the encoding format of the target language type to form a string of the target language type and displays it. This language switching process only needs to read the multi-language resource file to determine the target language type string without starting the database corresponding to the respective UI interface Implement language switching. At the same time, the cutting test is performed on the controls on the currently visible display panel to determine whether the controls are in the visible area. In this way, only when the controls in the visible area are determined, the language is switched to ensure that only in the visible area The controls are switched to avoid the problem of screen freeze caused by a large number of textures generated by a single update, especially for the 3DUI interface, the method of the present invention improves the language switching efficiency and switching speed of the 3DUI interface, and does not need to restart the UI. The switching process is simplified, and the user experience is enhanced through this dynamic and gradual refreshing language switching method.
In summary, the present invention first determines the priority of each current visible display panel, and performs language switching on the controls of each display panel on the current display system according to the preset priority ordering rules, and the language switching process is achi...
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Abstract

The invention discloses an Android platform based language switching method and system. The method includes the steps: A, when receiving a language switching command, acquiring an index value of each current visible display module, and determining priority of each current visible display module; B, performing language switching on each current visible display module according to preset priority ordering rules, wherein the language switching process includes acquiring character string information of each control on the current display module and determining coding formats of the target language type according to preset multilanguage resource files so as to form and display target language type character strings. The display modules are subjected to language switching according to the preset priority ordering rules, and accordingly languages can be switched automatically without restarting the entire UI (user interface); besides only the multilanguage resource files have to be read during switching so as to start a corresponding database without starting the UI, further the switching process is simplified, and switching efficiency is increased.

Application Domain

Technology Topic

Image

  • Android platform based language switching method and system
  • Android platform based language switching method and system
  • Android platform based language switching method and system

Examples

  • Experimental program(1)

Example Embodiment

[0042] The present invention provides a language switching method and system based on the Android platform. In order to make the objectives, technical solutions and effects of the present invention clearer and clearer, the present invention will be described in further detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.
[0043] See figure 1 , figure 1 It is a flowchart of a preferred embodiment of a language switching method based on the Android platform of the present invention. As shown in the figure, it includes the steps:
[0044] S101. When receiving the language switching instruction, obtain the index value of each currently visible display panel, and determine the priority of each currently visible display panel;
[0045] S102. Perform language switching for each currently visible display panel according to a preset priority sorting rule. The process of language switching includes: obtaining character string information of each control on the current display panel and determining the target according to a preset multi-language resource file The encoding format of the language type thus forms and displays the target language type string.
[0046] In this embodiment, the display panel includes a visible display interface (that is, the interface that is visible on the display screen), an invisible display interface (that is, a display interface that is currently hidden in the display system or a partially visible and partially hidden interface), as well as settings in the display The resident bar (or status bar) and navigation bar on the screen, then the currently visible display panel includes the visible display interface, the resident bar and the navigation bar. And each display panel has an index value. For example, the index value of the first display panel (the first screen) of the mobile terminal is 1, the index value of the second display panel (the second screen) is 2, and the index value of the third display panel (the third The index value is 3, and so on. The index value is set to distinguish which display panel is in the current screen (that is, currently visible) position. When the user sends a screen change instruction by sliding or dragging, the record is The index value of the display panel of the current screen, so that you can know which display panel is on the current screen at any time. The resident bar and navigation bar displayed on the mobile terminal can also be individually set with an index value. For example, the resident bar index value is 10, the navigation bar index value is 11, and the resident bar and navigation bar are always at the forefront when changing the screen. , Which is on the current display. On the same screen of the mobile terminal, you can set the priority of the visible display interface, resident bar, and navigation bar respectively. For example, the priority of the visible display interface is the second level, and the priority of the resident bar and the navigation bar is the first. The second level is greater than the first level. Of course, the priority of the visible display interface can also be set to the first level, and the priority of the permanent bar and the navigation bar is the second level, so that when a language switching instruction is received, that is The priority of each currently visible display panel can be determined according to the index value, that is, the priority ordering of the display interface, the resident bar and the navigation bar can be seen.
[0047] The above situation is for each display panel on the current screen, that is, the priority set for each display panel on the visible area, and for each display panel on the non-visual area, such as other display interfaces, it can also be set Priority, its priority sorting rules will be detailed later.
[0048] After obtaining the priority information, the currently visible display panels can be switched in sequence according to the priority sorting rules. The process of language switching includes: obtaining the string of each control on the current display panel and following the preset multi-language resource files Determine the encoding format of the target language type to form and display the target language type string. This language switching process only needs to read the multi-language resource file to determine the target language type string without starting the database corresponding to the respective UI interface to achieve language Switch. At the same time, perform a crop test on the controls on the currently visible display panel to determine whether the control is in the visible area. In this way, only when the control is determined to be in the visible area, the language switch is performed to ensure that it is only in the visible area Controls are switched to avoid the problem that a large number of textures generated by a single update may cause screen freezes. Especially for 3DUI interfaces, the method of the present invention improves the language switching efficiency and switching speed of the 3DUI interface, and there is no need to restart the UI. The switching process is simplified, and the user experience is enhanced through this dynamic and gradually refreshing language switching method.
[0049] In the specific cutting test, the node (that is, the control that requires language switching) is cut through the bounding box and the screen view volume. The language switch is performed only when the node is confirmed to be inside the visible area. For the screen display Nodes outside the area can be switched without language switching, thereby improving switching efficiency. The bounding box is defined as the smallest hexahedron that contains the object and whose sides are parallel to the coordinate axis (the coordinate axis is the X, Y, and Z axis of the Cartesian coordinate system of the display screen). Its structure is relatively simple and the storage space is small. , The application is more convenient. For the specific technical details of the tailoring test, reference may be made to the prior art, which will not be repeated here.
[0050] As a more preferred embodiment of the present invention, such as figure 2 As shown, before the step S101, the method further includes:
[0051] S201. Initialize a multi-language resource file, and deserialize the multi-language resource file into a memory object;
[0052] The multi-language resource file is an XML file. The multi-language resource file saves the encoding format of all strings and various language types, including the encoding format of the current language type and the encoding format of the target language type. The above XML file is pre-saved, And it will be updated every time it is turned on or there is an application update on the interface. After initializing the multi-language resource file, the multi-language resource file is deserialized into a memory object, where the deserialization refers to converting the text information recorded in the XML file into a C++ object. For example, when parsing a file, deserialize two objects: a font object named "3D UI", in which two language-type strings are stored, the Chinese string "3D UI" and English characters String "3D UI"; a font object named "interface", in which two language strings are stored, the Chinese string "interface" and the English string "UI", the code is as follows:
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067] When the user adds a certain control, such as an application, the corresponding font object is added to the XML file for storage. When the user deletes a certain control, it checks whether the corresponding font object is referenced, and when it does not, delete it Therefore, in the embodiment of the present invention, if resources need to be modified, only multi-language resource files need to be updated, instead of restarting the UI interface to update all dynamic libraries, so resource modification is more convenient and simple.
[0068] S202: Associate the string information of the controls on each display panel with the content saved in the multi-language resource file, and set the priority of each display panel.
[0069] This step is to match the string information of the control that needs language switching with the content saved in the multi-language resource file, so that the encoding format of the string target language type can be obtained by searching for the multi-language resource file, and the encoding format is automatically converted , And perform subsequent rendering.
[0070] In addition, in step S101, when the language switching instruction is received, the current language type is first obtained, and it is judged whether the current language type is consistent with the target language type. When the two are consistent, there is no need to modify the current language type and just return; Only when the two are inconsistent, the language switching action is triggered, that is, to obtain the index value of the currently visible display panel, determine which display panel is currently on the screen, and determine the priority of each currently visible display panel.
[0071] As a more preferred embodiment of the present invention, such as image 3 As shown, the step S102 specifically includes:
[0072] S301. Obtain the current encoding format of the string of the control that needs to switch languages ​​on the current display panel in sequence, and obtain the encoding format of the target language by searching for multi-language resource files;
[0073] In the XML file, the default is Utf8 (universal code) format, which can save the encoding format of the Chinese and English language types, and the encoding format of the current language type of all strings is saved in the multi-language resource file (ie the current encoding format) , The encoding format of the target language type, so that the corresponding encoding format of the target language type can be found in the multi-language resource file according to the current language encoding format of the string and the target language type.
[0074] S302: Convert the character string into an encoding format of the target language type, and then generate a picture of the target language type;
[0075] After obtaining the string data, the string can be automatically converted into the encoding format of the target language type, and then through the freeType (an open source code used to convert the string into a picture format with a string) open source library To generate a picture of the string.
[0076] S303: Generate a texture from the picture and render it to a corresponding control.
[0077] After the picture is generated, the picture can be texture generated through OpenGL (graphics program interface) function and rendered to the node that needs to be updated, that is, the control.
[0078] For example, for a string of "recently viewed", first obtain the string data. The string data contains the encoding format information, that is, the encoding format of the current language type of the string. By searching the XML file and according to the string The current encoding format and the target language type are used to find the encoding format of the target language type of the string, and automatically convert it into the encoding format of the target language type, and then pass the string in the converted encoding format to freeType, thereby generating the target language type Picture, then generate a texture from this picture through OpenGL function and render it to the control.
[0079] Further, the priority sorting rules in the present invention are:
[0080] Set the visible display interface to the second level, the resident bar and the navigation bar to the first level, and the invisible display interface to the zero level.
[0081] Alternatively, the visible display interface can be set to the first level, the permanent bar and the navigation bar can be set to the second level, and the invisible display interface can be set to the zero level.
[0082] In the above case, the priority of the invisible display is zero, while for the visible display interface, the permanent bar and the navigation bar (also visible), the priority order can be selected according to the actual situation, that is, the priority is refreshed and visible. The display interface, resident bar and navigation bar of the invisible display interface can be refreshed step by step, or when a screen change instruction is received, the language of the new currently visible display panel can be switched. Such as Figure 4 As shown, the priority of visible panel 1 (display panel) is the first level, the priority of non-visible panels 0 and 2 is zero, and the priority of the status bar and navigation bar is the second level, so its language The switching sequence is as Figure 5 As shown, first refresh the status bar and navigation bar (the order of the two can be defined), and then refresh section 1. For sections 0 and 2 in the non-visible area, you can choose whether to refresh or not according to the specific situation.
[0083] As a more preferred embodiment of the present invention, the step S102 further includes:
[0084] According to the preset priority sorting rules, switch the language type in turn for each control of the currently invisible display panel; or, when receiving the screen change instruction, return to step S101 to obtain the index value of each currently visible display module And switch the new control language type of each currently visible display panel.
[0085] This embodiment is a specific implementation of the above embodiment. In the present invention, the language type of each control on the visible area is preferentially switched, and for each control on the non-visual area, you can set whether to refresh or not according to the actual situation. For example, you can set: for each control of the other display module that does not belong to the current display module, switch its language type in turn, that is, the display panels on the non-visual area are also refreshed in the order of priority; or, only after receiving When the screen change instruction is performed, return to step S101 to switch the control language types of the new currently visible display panels (that is, the visible display panels to be switched to).
[0086] It should be noted that on the same display panel, for example, on the same display screen, there are generally multiple controls. For example, a 4×4 layout display screen has a maximum of 16 controls. For these controls, you can follow from left to right. You can switch languages ​​in order from top to bottom, and you can also switch the controls with the highest frequency of use first in a customized way.
[0087] The present invention can be applied to various mobile terminals, such as mobile phones or tablet computers.
[0088] After the language switch of the controls of the current display panel is completed, if an application is newly installed on the display panel, an icon and corresponding text will be generated on the interface, and the Android system will broadcast the package name of the newly installed application, that is, the application name. When receiving the broadcast, obtain the package name of the application through the system interface, such as the string of "dangerous relationship", then create a text object, register the text object in the update container, and set the size of the string , Thickness and color information to generate a unique font texture object. The font texture object is combined with the corresponding icon on the interface to generate a font update object, and then the font update object is registered in the update container, and then the font in the update container is updated according to the The update object switches the language of the applied string.
[0089] Based on the above method, the present invention also provides a language switching system based on the Android platform, such as Image 6 As shown, it includes:
[0090] The priority determining module 100 is configured to obtain the index value of each currently visible display panel when receiving a language switching instruction, and determine the priority of each currently visible display panel;
[0091] The language switching module 200 is used to switch the language of each currently visible display panel according to a preset priority ordering rule. The process of language switching includes: obtaining the string information of each control on the current display panel and according to the preset multinational The language resource file determines the encoding format of the target language type to form and display the target language type string.
[0092] Further, the language switching system based on the Android platform, such as Figure 7 As shown, it also includes:
[0093] The initialization module 300 is used to initialize a multi-language resource file, where the multi-language resource file stores the multi-language type encoding format of each character string, and deserializes the multi-language resource file into a memory object;
[0094] The setting module 400 is used for associating the string information of the controls on each display panel with the content stored in the multi-language resource file, and setting the priority of each display panel.
[0095] Further, such as Figure 8 As shown, the language switching module 200 includes:
[0096] The encoding format acquisition unit 210 is configured to sequentially acquire the current encoding format of the string of the control that needs to switch languages ​​on the current display panel, and acquire the encoding format of the corresponding string target language type by searching for multi-language resource files;
[0097] The picture generating unit 220 is configured to convert a character string into an encoding format of the target language type, and then generate a picture of the target language type;
[0098] The texture rendering unit 230 is used to generate a texture from the picture and render it to the corresponding control.
[0099] Further, the system includes an update module (not shown in the figure), which is used to: when a new control is installed on the display panel, obtain the package name of the control through the system interface, create a font object, and save the font object to In multi-language resource files; when deleting the controls on the display panel, judge whether the corresponding font object is referenced, and if there is no reference, delete the corresponding text object.
[0100] Further, the language switching module 200 is further configured to: according to a preset priority sorting rule, switch the language types in turn for the controls of other invisible display panels that do not belong to the currently visible display panel; or, when receiving When the screen is changed, the index value of the new currently visible display panel is obtained, and the control language type of the new currently visible display panel is switched.
[0101] The language switching module 200 is also used to: perform a cutting test on the currently visible control on the display panel to determine whether the control is in the visible area, and if it is, switch the string of the control to the target language type and display it .
[0102] The technical details of the above-mentioned module unit have been described in detail in the previous method, so it will not be repeated.
[0103] In summary, the present invention first determines the priority of each currently visible display panel, and switches the language of the controls of each display panel on the current display system according to the preset priority sorting rules. The language switching process is through obtaining each display panel. Load the control string and determine the target language type encoding format according to the preset multi-language resource file and form the target language string, and switch the language of each display module according to the preset priority order. It can switch automatically without restarting the entire UI interface Language, and only need to read multi-language resource files during the switching process without starting the UI interface to start the corresponding database, which simplifies the switching process and improves the switching efficiency. At the same time, it only switches the language of the control that is judged to be in the visible area. Ensure that the controls are refreshed in the user's visual area, and eliminate the refresh of non-visual areas, thereby further improving the language switching speed.
[0104] It should be understood that the application of the present invention is not limited to the above examples, and those of ordinary skill in the art can make improvements or changes based on the above description, and all these improvements and changes should fall within the protection scope of the appended claims of the present invention.
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

no PUM

Description & Claims & Application Information

We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Similar technology patents

Device and method for induction brazing

Owner:珠海百锐思焊接技术有限公司

User interaction interface searching method and device based on mobile terminal

InactiveCN107357577ASimple switching processShort switching timeData processing applicationsNatural language data processingKeyword extractionSearch engine results page
Owner:BEIJING QIHOO TECH CO LTD

Communication cell switching method and device, electronic equipment and storage medium

PendingCN112566199ASimple switching processShorten cell switching timeWireless communicationEngineering5G
Owner:CHINA UNITED NETWORK COMM GRP CO LTD

Message display method and device

InactiveCN107526491ASimple switching processSimple and intuitive message displayInput/output processes for data processingApplication softwareUser needs
Owner:SHANGHAI YUDE TECH CO LTD

Classification and recommendation of technical efficacy words

  • Simple switching process
  • Improve switching efficiency

User interaction interface searching method and device based on mobile terminal

InactiveCN107357577ASimple switching processShort switching timeData processing applicationsNatural language data processingKeyword extractionSearch engine results page
Owner:BEIJING QIHOO TECH CO LTD

Device and method for induction brazing

Owner:珠海百锐思焊接技术有限公司

Message display method and device

InactiveCN107526491ASimple switching processSimple and intuitive message displayInput/output processes for data processingApplication softwareUser needs
Owner:SHANGHAI YUDE TECH CO LTD

Communication cell switching method and device, electronic equipment and storage medium

PendingCN112566199ASimple switching processShorten cell switching timeWireless communicationEngineering5G
Owner:CHINA UNITED NETWORK COMM GRP CO LTD

Switching method and device for multiple voice identification models

Owner:BAIDU ONLINE NETWORK TECH (BEIJIBG) CO LTD

Method, system and device for switching antenna modes

ActiveCN101990268AMake full use of uplink and downlink interoperabilityImprove switching efficiencySpatial transmit diversityWireless communicationInteroperability ProblemEngineering
Owner:XIAOMI INC
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products