CN112596841B - Interface language switching method, device, equipment and storage medium - Google Patents

Interface language switching method, device, equipment and storage medium Download PDF

Info

Publication number
CN112596841B
CN112596841B CN202011557432.4A CN202011557432A CN112596841B CN 112596841 B CN112596841 B CN 112596841B CN 202011557432 A CN202011557432 A CN 202011557432A CN 112596841 B CN112596841 B CN 112596841B
Authority
CN
China
Prior art keywords
auxiliary
class
control
language
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011557432.4A
Other languages
Chinese (zh)
Other versions
CN112596841A (en
Inventor
陈潇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Yealink Network Technology Co Ltd
Original Assignee
Xiamen Yealink Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Yealink Network Technology Co Ltd filed Critical Xiamen Yealink Network Technology Co Ltd
Priority to CN202011557432.4A priority Critical patent/CN112596841B/en
Publication of CN112596841A publication Critical patent/CN112596841A/en
Application granted granted Critical
Publication of CN112596841B publication Critical patent/CN112596841B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • G06F9/454Multi-language systems; Localisation; Internationalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/40Processing or translation of natural language
    • G06F40/58Use of machine translation, e.g. for multi-lingual retrieval, for server-side translation for client devices or for real-time translation

Abstract

The application provides an interface language switching method, an interface language switching device, interface language switching equipment and a storage medium, and relates to the technical field of interface display. The method comprises the following steps: after receiving a language change notification, traversing an auxiliary base class list, wherein the auxiliary base class list comprises: presetting an auxiliary class corresponding to at least one control on an application interface; calling a monitoring language change function, and determining whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed; and calling a language translation function in the target auxiliary class to refresh the display content of the control to be refreshed. Compared with the prior art, the problem that the global behavior is triggered no matter the interface change degree is large or small, and the software performance is influenced is solved.

Description

Interface language switching method, device, equipment and storage medium
Technical Field
The present application relates to the field of interface display technologies, and in particular, to an interface language switching method, apparatus, device, and storage medium.
Background
With the enhancement of external communication, many application software needs to be capable of switching among multiple language interfaces during operation so as to meet the use requirements of people in different countries.
The existing software multi-language hot switching method generally includes that after a system language switching event is monitored, a multi-language management module of software initiates an updating behavior, controls needing multi-language display are searched and captured from a current interface, meanwhile, corresponding translation targets needed on the display controls are obtained, new translation target content is set on the controls again for each display control, and therefore the effect of language switching is achieved.
However, in such a switching manner, not only all currently displayed controls need to be searched in a traversal manner when the language is switched, but all currently displayed controls need to be searched in a traversal manner whenever an interface change occurs, and the searching, traversing, and refreshing behaviors are performed, that is, a global behavior is triggered regardless of the degree of the interface change, so that the software performance is affected.
Disclosure of Invention
An object of the present application is to provide a method, an apparatus, a device, and a storage medium for interface language switching, so as to solve the problem in the prior art that no matter how large or small an interface changes, a global behavior is triggered, which affects software performance.
In order to achieve the above purpose, the technical solutions adopted in the embodiments of the present application are as follows:
in a first aspect, an embodiment of the present application provides an interface language switching method, where the method includes:
after receiving a language change notification, traversing an auxiliary base class list, wherein the auxiliary base class list comprises: presetting an auxiliary class corresponding to at least one control on an application interface; the language change notification includes: a target language;
calling a monitoring language change function, and determining whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed;
and calling a language translation function in a target auxiliary class, refreshing the display content of the control to be refreshed, and switching the display content of the control to be refreshed into the display content corresponding to the target language.
Optionally, the calling a monitoring language change function to determine whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed includes:
and calling the monitoring language change function in the auxiliary base class through a calling inlet in the management class, and determining whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed.
Optionally, the calling a monitoring language change function to determine whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed includes:
calling the monitoring language change function, and judging whether the traversed auxiliary class is an auxiliary class corresponding to a display control;
and if so, determining the traversed auxiliary class as the target auxiliary class.
Optionally, the method further comprises:
if the auxiliary classes in the auxiliary base class list are not the auxiliary classes corresponding to the display control, generating the auxiliary classes corresponding to the display control on the preset application interface by adopting a preset auxiliary class construction function according to a preset auxiliary base class;
and registering the generated auxiliary class into the auxiliary base class list.
Optionally, before traversing the auxiliary base class list, the method further includes:
generating an auxiliary class corresponding to each control according to the member and a preset auxiliary base class included by each control;
and registering the auxiliary class corresponding to each control to the auxiliary base class list.
Optionally, the generating an auxiliary class corresponding to each control according to the member of each control and a preset auxiliary base class includes:
generating multiple preset types of auxiliary classes according to a preset auxiliary base class;
determining the type of the control according to the member of the control;
according to the type of the control, determining an auxiliary class of the type corresponding to the control from the auxiliary classes of the multiple preset types;
and generating an auxiliary class corresponding to the control according to the control and the auxiliary class of the corresponding type.
Optionally, the method further comprises:
and if the parameter of the auxiliary class corresponding to the control is null, adopting the constructor of the control to establish the auxiliary class corresponding to the control.
In a second aspect, another embodiment of the present application provides an interface language switching apparatus, including: the device comprises a traversing module, a determining module and a refreshing module, wherein:
the traversal module is configured to traverse an auxiliary base class list after receiving the language change notification, where the auxiliary base class list includes: presetting an auxiliary class corresponding to at least one control on an application interface; the language change notification includes: a target language;
the determining module is used for calling a monitoring language change function and determining whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed;
the refreshing module is used for calling a language translation function in a target auxiliary class, refreshing the display content of the control to be refreshed, and switching the display content of the control to be refreshed into the display content corresponding to the target language.
Optionally, the determining module is specifically configured to call the monitoring language change function in the auxiliary base class through a call entry in the management class, and determine whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed.
Optionally, the apparatus further comprises: the judging module is used for calling the monitoring language change function and judging whether the traversed auxiliary class is the auxiliary class corresponding to the display control;
the determining module is specifically configured to determine that the traversed auxiliary class is the target auxiliary class.
Optionally, the apparatus further comprises: a registration module, wherein:
the generating module is specifically configured to, if none of the auxiliary classes in the auxiliary base class list is an auxiliary class corresponding to a display control, generate an auxiliary class corresponding to the display control on the preset application interface according to a preset auxiliary base class by using a preset auxiliary class constructor;
the registration module is configured to register the generated auxiliary class into the auxiliary base class list.
Optionally, the generating module is specifically configured to generate an auxiliary class corresponding to each control according to the member corresponding to each control and a preset auxiliary base class;
the registration module is specifically configured to register the auxiliary class corresponding to each control to the auxiliary base class list.
Optionally, the generating module is specifically configured to generate multiple preset types of auxiliary classes according to a preset auxiliary base class;
the determining module is specifically configured to determine the type of the control according to the member of the control; according to the type of the control, determining an auxiliary class of the type corresponding to the control from the auxiliary classes of the multiple preset types;
the generating module is specifically configured to generate an auxiliary class corresponding to the control according to the control and the auxiliary class of the corresponding type.
Optionally, the generating module is specifically configured to, if the parameter of the auxiliary class corresponding to the control is null, create the auxiliary class corresponding to the control by using a constructor of the control.
In a third aspect, another embodiment of the present application provides an interface language switching apparatus, including: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, when the interface language switching device operates, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the method according to any one of the first aspect.
In a fourth aspect, another embodiment of the present application provides a storage medium having a computer program stored thereon, where the computer program is executed by a processor to perform the steps of the method according to any one of the above first aspects.
The beneficial effect of this application is: by adopting the interface language switching method provided by the application, after a language change notification is received, the auxiliary base class list is traversed, whether the traversed auxiliary class is the target auxiliary class corresponding to the control to be refreshed is determined according to the called monitoring language change function, then the language translation function in the target auxiliary class is called to refresh the display content of the space to be refreshed, and the display content corresponding to the target language is refreshed.
Drawings
To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic flowchart of an interface language switching method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of an interface language switching method according to another embodiment of the present application;
FIG. 3 is a schematic structural diagram of an auxiliary base class according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a management class according to an embodiment of the present application;
fig. 5 is a schematic flowchart of an interface language switching method according to another embodiment of the present application;
fig. 6 is a schematic structural diagram of a control provided in an embodiment of the present application;
fig. 7 is a schematic structural diagram of an auxiliary class according to an embodiment of the present application;
fig. 8 is a schematic flowchart of an interface language switching method according to another embodiment of the present application;
FIG. 9 is structural information of auxiliary classes of a preset type;
FIG. 10 is a schematic diagram of an inheritance flow provided by an embodiment of the present application;
fig. 11 is a schematic structural diagram of an interface language switching apparatus according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of an interface language switching apparatus according to another embodiment of the present application;
fig. 13 is a schematic structural diagram of an interface language switching device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments.
The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
Further, the flowcharts used in this application illustrate operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be performed out of order, and steps without logical context may be performed in reverse order or simultaneously. One skilled in the art, under the guidance of this application, may add one or more other operations to, or remove one or more operations from, the flowchart.
The interface language switching method provided by the embodiment of the application can be applied to terminal equipment provided with a preset application program capable of performing language switching, wherein the terminal equipment can be any electronic equipment provided with the preset application program capable of performing language switching, such as a mobile phone, a tablet computer, a notebook computer, a wearable intelligent device and the like, and the application is not limited at all.
An interface language switching method provided by the embodiment of the present application is explained below based on the application scenario in combination with a plurality of specific application examples. Fig. 1 is a schematic flowchart of an interface language switching method according to an embodiment of the present application, where as shown in fig. 1, the method includes:
s101: and traversing the auxiliary base class list after receiving the language change notification.
Optionally, in an embodiment of the present application, since the auxiliary class may be used as an auxiliary base class, when traversing the auxiliary base class list, it is actually a traversal including the auxiliary class, where the auxiliary class is a subclass of the auxiliary base class; the auxiliary base class list can be stored in the terminal device, for example, and after receiving the language change notification, the auxiliary base class list corresponding to the application program is obtained according to the identification information of the preset application program; the auxiliary base class list corresponding to the preset application program may also be stored in the background server of the preset application program, and after receiving the notification of the language change, the terminal device sends an obtaining instruction to the background server of the preset application program to obtain the auxiliary base class list corresponding to the preset application program, where a storage location and an obtaining manner of the specific auxiliary base class list may be flexibly adjusted according to a user requirement, and are not limited to those provided in the above embodiments.
Wherein the list of auxiliary base classes includes: presetting an auxiliary class corresponding to at least one control on an application interface; the preset application interface is a preset application interface corresponding to a preset application program; the language change notification includes: the target language.
Optionally, in an embodiment of the present application, the triggering manner of the language change notification may be, for example; the language switching method comprises the steps that a user clicks a language switching key on a preset application interface to trigger, and a target language is determined according to selection operation of the user in a switching list; or the user triggers the voice change notification in a voice input mode, wherein the language indicated in the voice input by the user is the target language; or presetting the application program to automatically acquire the position of the terminal equipment currently provided with the application program, determining the language type according to the position, if the language type is found to be changed, triggering a language change notification, wherein the target language is a default language corresponding to the position of the terminal equipment currently provided with the application program, for example, if the terminal equipment currently provided with the application program is positioned in the area 1, the corresponding target language is Chinese; the specific voice change notification manner and the determination manner of the target language may be flexibly adjusted according to the user's needs, and are not limited to the two manners given in the above embodiments.
S102: and calling a monitoring language change function, and determining whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed.
The control to be refreshed is a control displayed on a current preset application interface; in an embodiment of the application, each auxiliary class has a control uniquely corresponding thereto, and each auxiliary class is responsible for only its corresponding control, for example, the auxiliary class may be traversed in the auxiliary base class list through each control identifier (unique identity number, etc.) to obtain a target auxiliary class corresponding to each control to be refreshed.
S103: and calling a language translation function in the target auxiliary class to refresh the display content of the control to be refreshed.
Optionally, in an embodiment of the present application, each auxiliary class includes a language translation function, which may be, for example, a LanguageTranslateAction function, and is used to refresh the display content of the control corresponding to the auxiliary class.
And refreshing the display content of the control to be refreshed according to the language translation function in the target auxiliary class, so as to switch the display content of the control to be refreshed into the display content corresponding to the target language, thereby finishing refreshing the control to be refreshed displayed on the current preset application interface.
By adopting the interface language switching method provided by the application, after a language change notification is received, the auxiliary base class list is traversed, whether the traversed auxiliary class is the target auxiliary class corresponding to the control to be refreshed is determined according to the called monitoring language change function, then the language translation function in the target auxiliary class is called to refresh the display content of the space to be refreshed, and the display content corresponding to the target language is refreshed.
Optionally, on the basis of the foregoing embodiment, an embodiment of the present application may further provide an interface language switching method, and an implementation process of interface language switching in the foregoing method is described as follows with reference to the accompanying drawings. Fig. 2 is a schematic flowchart of an interface language switching method according to another embodiment of the present application, and fig. 3 is a schematic structural diagram of an auxiliary base class according to an embodiment of the present application; fig. 4 is a schematic structural diagram of a management class according to an embodiment of the present application, and as shown in fig. 2, S102 may include:
s104: and calling a monitoring language change function, and judging whether the traversed auxiliary class is the auxiliary class corresponding to the display control.
Optionally, in an embodiment of the present application, a monitoring language change function in the auxiliary base class may be called through a call entry in the management class, and it is determined whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed.
As shown in fig. 3, the preset auxiliary base class may be a base class including a plurality of virtual functions, and the functions of each function may include: the specific auxiliary base class may include a register function register helper (), a logout function UnRegisterHelper (), a monitored language change function virtual online languagechange (), a language translation function virtual languagetransitilaceaction (), and the like, and the content included in the specific auxiliary base class may be flexibly adjusted according to the user's needs, which is not limited to the above embodiments.
The preset auxiliary base class provided in the embodiment of the present application includes a basic judgment logic function, which can meet performance requirements of most conventional scenarios, and it should be understood that the auxiliary base class provided in the above embodiment is only an exemplary description, and functions included in the specific auxiliary base class may be refined and adjusted according to actual situations, which is not limited herein.
For example, in the embodiment of the present application, before the above method is executed, the auxiliary base class may register itself in a management class (i.e. a multi-language management class), where each application has its unique corresponding management class, and the registered management class is shown in fig. 4, and the management class includes a List of auxiliary base classes List < languagehelper base > m _ listHelper for recording all auxiliary classes registered in the management class, and further includes a registration function register helper (), a logout function unregister helper (), and a listening language change function onggugechange (). After receiving the language change notification, the management class traverses all the auxiliary classes in the auxiliary base class list and calls a monitoring language change function in the management class, so that the effect of refreshing and displaying the spaces corresponding to all the auxiliary classes registered in the auxiliary base class list of the management class is achieved.
If yes, go to step S105.
S105: and determining the traversed auxiliary class as a target auxiliary class.
If the auxiliary class is traversed, the auxiliary list includes the auxiliary class corresponding to the control on the current preset application interface, and at this time, the traversed auxiliary class is directly determined to be the target auxiliary class corresponding to the control.
If not, go to step S106.
S106: and generating an auxiliary class corresponding to the display control on the preset application interface by adopting a preset auxiliary class constructor according to a preset auxiliary base class.
If the auxiliary class corresponding to the control on the current preset application interface is not included in the auxiliary list, the auxiliary class corresponding to the control needs to be reconstructed at this time.
S107: and registering the generated auxiliary class into an auxiliary base class list.
The generated auxiliary class is registered in the auxiliary base class list, so that the auxiliary class corresponding to the control can be directly obtained from the auxiliary base class list when the preset application interface is refreshed next time without reconstruction.
Optionally, on the basis of the foregoing embodiment, an interface language switching method may also be provided in the embodiments of the present application, and an implementation process of the foregoing method is described as follows with reference to the accompanying drawings. Fig. 5 is a schematic flowchart of an interface language switching method according to another embodiment of the present application, and fig. 6 is a schematic structural diagram of a control according to an embodiment of the present application; fig. 7 is a schematic structural diagram of an auxiliary class according to an embodiment of the present application, and as shown in fig. 5, the method may further include:
s108: and generating an auxiliary class corresponding to each control according to the member corresponding to each control and a preset auxiliary base class.
As shown in fig. 6, each control includes identification information, member information, and presentation information corresponding to the control, where the service owned by each control is different, and the corresponding member and the information content to be presented are not necessarily the same; for example, in the control 1Label1 in FIG. 5, an m _ str string text information string m _ strOriginWord is recorded, and only the string text information needs to be directly displayed after being displayed; the control 2Label2 records a variable user DATA information DATA _ userm _ Usingword, and when displaying, the variable user DATA information needs to be converted into text information in real time, and the converted text information is used as a final result to be displayed; the text and the variable integer can be regarded as members corresponding to the controls. The display text showText () in the control 1 and the display user data showUserData () in the control 2 both convert the data in the member corresponding to each control into the content which needs to be displayed actually through the management class and display the content.
As shown in fig. 7, each auxiliary class has identification information of a control corresponding to the auxiliary class, information to be displayed included in the corresponding control, and method information and display method information executed by the language translation function, for example: the auxiliary class on the left side in fig. 7 is an auxiliary class corresponding to the control 1, and includes identification information Label1 corresponding to the control 1, information string _ original word corresponding to the control 1, method information language helper1 m _ phelprer executed correspondingly to the language translation function, and display text 1showText1 (); the auxiliary class on the right side of fig. 7 is the auxiliary class corresponding to the control 2, and includes the identification information Label2 of the control 2, the corresponding information string _ string using word to be displayed in the control 2, the method information LanguageHelper2 m _ phepper and the display text 2showText2() executed correspondingly by the language translation function.
S109: and registering the auxiliary class corresponding to each control to an auxiliary base class list.
The auxiliary class corresponding to each control generated by the method has no influence on the use of the corresponding control because the auxiliary class and the corresponding control are in a combined relation.
Optionally, on the basis of the foregoing embodiment, an interface language switching method may also be provided in the embodiments of the present application, and an implementation process of generating an auxiliary class corresponding to each control by the foregoing method is described as follows with reference to the accompanying drawings. Fig. 8 is a flowchart illustrating an interface language switching method according to another embodiment of the present application, and fig. 9 is structural information of an auxiliary class of a preset type, as shown in fig. 8, S108 may further include:
s110: and generating multiple preset types of auxiliary classes according to the preset auxiliary base classes.
S111: and determining the type of the control according to the member of the control.
S112: and determining the auxiliary class of the type corresponding to the control from the auxiliary classes of various preset types according to the type of the control.
As shown in fig. 9, in one embodiment of the present application, the preset type of auxiliary class may include: the auxiliary classes corresponding to the invariant text types and the auxiliary classes corresponding to the variable text types, wherein each type of auxiliary class comprises identification information, auxiliary target information and calling function information of the current auxiliary class.
As shown in fig. 9, the left side of fig. 9 is an auxiliary class corresponding to the invariant text type, including identification information auxiliary class 1LanguageHelper1 of the auxiliary class, and auxiliary target information, for example, if the target assisted by the current auxiliary class is control 1, the auxiliary target information is Label1 mm _ phelterrarget at this time, and also includes call function information, because the control is an auxiliary class corresponding to the invariant text type, it only needs to be directly presented when presented, so the call function information of the auxiliary class of this type only includes virtuallanguagetranlateaction () for executing the showText () method in m _ phelterrarget at this time; the right side of fig. 9 is an auxiliary class corresponding to the invariant text type, including an identification information auxiliary class 2LanguageHelper2 of the auxiliary class, and auxiliary target information, for example, if the target assisted by the current auxiliary class is control 2, the auxiliary target information is Label2 mm _ phelterrarget at this time, and also includes calling function information, because the control is an auxiliary class corresponding to the variable text type, it is necessary to display this variable information after converting it into text in real time during display, so that the calling function information of the auxiliary class of this type at this time includes virtuallaugelongigaschange () in addition to virtuallanguagetransitionaction () for executing the showuseusedata () method in m _ pheltarget, and determining whether to call the corresponding operation in combination with the display state of the m _ pheltarget.
S113: and generating an auxiliary class corresponding to the control according to the control and the auxiliary class of the corresponding type.
Optionally, in an embodiment of the present application, if a parameter of an auxiliary class corresponding to the control is null, a constructor of the control is used to create the auxiliary class corresponding to the control.
Fig. 10 is a schematic diagram of an inheritance flow provided by an embodiment of the present application, and as shown in fig. 10, taking a control 1-1 Label 1-1 to inherit a control 1Label1 as an example, the control 1-1 may be, for example, a child control corresponding to the control 1.
Wherein, the class can support the incoming parameters as the basis of the customization members during the construction; if the incoming parameter is null, the class creates the auxiliary class by using a self-default mode, namely, the Label1 creates an auxiliary class 1Helper1 by default, and the Label2 creates an auxiliary class 2Helper2 by default and records the auxiliary class as a member of the class; if the incoming parameter is a certain constructed auxiliary class, the incoming auxiliary class is directly recorded as a member of the auxiliary class.
By the setting mode, if each auxiliary class is inherited, new translation logic or refresh operation is generated, the new operation is completed by the Helper corresponding to the inherited class, and the problem that the Helper in the inherited class plays a role to influence the normal operation of the inherited class is solved.
As shown in FIG. 10, control 1-1 inherits from control 1, and the auxiliary class 1-1LanguageHelp 1-1 of the type corresponding to control 1-1 inherits from the auxiliary class Languagehelper1 corresponding to control 1; when the auxiliary class corresponding to the Label1 is created separately, since the incoming configuration parameter is empty, the control 1 needs to create a corresponding auxiliary class 1Languagehelper1 and record the auxiliary class in m _ Langughelper; when the auxiliary class corresponding to the control 1-1 is created, because the transmitted construction parameters are null, the control 1-1 is required to create the corresponding auxiliary class 1-1Languagehelper 1-1, record the auxiliary class 1-1 in m _ Languagehelper 1-1 and transmit the auxiliary class to the construction of the base class; if the auxiliary class corresponding to the control 1 receives the introduced auxiliary class 1-1LanguageHelper 1-1 of the preset type in the structure, the auxiliary class 1LanguageHelper1 of the preset type does not need to be created, and the type of the auxiliary class 1-1LanguageHelper 1-1 of the preset type is directly recorded into m _ LanguageHelper; that is, both control 1 and control 1-1 record the auxiliary class Helper as a member, but actually, since both points to the same object; therefore, when the language is changed, the management class only operates the auxiliary class Helper, and the situation that the same control Label or the same auxiliary class Helper is repeatedly operated for multiple times due to multiple inheritance does not occur.
By adopting the interface language switching method provided by the application, the auxiliary classes corresponding to the controls are generated through the preset auxiliary base class, and the management classes are used for recording and managing the auxiliary classes registered in the management classes, so that the effect of switching and refreshing the overall controls at one time during language switching is achieved, meanwhile, the management classes do not need to depend on a specific service class method, and the maintainability is high.
The following explains an interface language switching device provided in the present application with reference to the drawings, where the interface language switching device can execute any one of the interface language switching methods shown in fig. 1 to 10, and specific implementation and beneficial effects of the interface language switching device are referred to above, and are not described again below.
Fig. 11 is a schematic structural diagram of an interface language switching apparatus according to an embodiment of the present application, and as shown in fig. 11, the apparatus includes: a traversal module 201, a determination module 202, and a refresh module 203, wherein:
the traversal module 201 is configured to traverse an auxiliary base class list after receiving the language change notification, where the auxiliary base class list includes: presetting an auxiliary class corresponding to at least one control on an application interface; the language change notification includes: a target language;
the determining module 202 is configured to invoke a monitoring language change function, and determine whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed;
the refreshing module 203 is configured to call a language translation function in the target auxiliary class, refresh the display content of the control to be refreshed, and switch the display content of the control to be refreshed into the display content corresponding to the target language.
Optionally, the determining module 202 is specifically configured to call a monitoring language change function in the auxiliary base class through a call entry in the management class, and determine whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed.
Fig. 12 is a schematic structural diagram of an interface language switching apparatus according to an embodiment of the present application, and as shown in fig. 12, the apparatus further includes: the judging module 204 is configured to call a monitoring language change function, and judge whether the traversed auxiliary class is an auxiliary class corresponding to the display control;
the determining module 202 is specifically configured to determine the traversed auxiliary class as the target auxiliary class.
As shown in fig. 12, the apparatus further includes: a generation module 205 and a registration module 206, wherein:
the generating module 205 is specifically configured to, if none of the auxiliary classes in the auxiliary base class list is an auxiliary class corresponding to the display control, generate an auxiliary class corresponding to the display control on the preset application interface according to a preset auxiliary base class by using a preset auxiliary class constructor;
a registering module 206, configured to register the generated auxiliary class into the auxiliary base class list.
Optionally, the generating module 205 is specifically configured to generate an auxiliary class corresponding to each control according to the member corresponding to each control and a preset auxiliary base class;
the registering module 206 is specifically configured to register the auxiliary class corresponding to each control to the auxiliary base class list.
Optionally, the generating module 205 is specifically configured to generate multiple preset types of auxiliary classes according to a preset auxiliary base class;
a determining module 202, specifically configured to determine the type of the control according to the member of the control; determining auxiliary classes of types corresponding to the control from a plurality of preset types of auxiliary classes according to the type of the control;
the generating module 205 is specifically configured to generate an auxiliary class corresponding to the control according to the control and the auxiliary class of the corresponding type.
Optionally, the generating module 205 is specifically configured to, if the parameter of the auxiliary class corresponding to the control is null, create the auxiliary class corresponding to the control by using a constructor of the control.
The above-mentioned apparatus is used for executing the method provided by the foregoing embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
These above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs), among others. For another example, when one of the above modules is implemented in the form of a Processing element scheduler code, the Processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Fig. 13 is a schematic structural diagram of an interface language switching device according to an embodiment of the present application, where the interface language switching device may be integrated in a terminal device or a chip of the terminal device.
As shown in fig. 13, the interface language switching apparatus includes: a processor 501, a storage medium 502, and a bus 503.
The processor 501 is used for storing a program, and the processor 501 calls the program stored in the storage medium 502 to execute the method embodiment corresponding to fig. 1-10. The specific implementation and technical effects are similar, and are not described herein again.
Optionally, the present application also provides a program product, such as a storage medium, on which a computer program is stored, including a program, which, when executed by a processor, performs embodiments corresponding to the above-described method.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to perform some steps of the methods according to the embodiments of the present application. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.

Claims (6)

1. An interface language switching method, characterized in that the method comprises:
after receiving a language change notification, traversing an auxiliary base class list, wherein the auxiliary base class list comprises: presetting an auxiliary class corresponding to at least one control on an application interface; the language change notification includes: a target language;
calling a monitoring language change function, and determining whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed;
calling a language translation function in a target auxiliary class, refreshing the display content of the control to be refreshed, and switching the display content of the control to be refreshed into display content corresponding to the target language;
the calling of the monitoring language change function to determine whether the traversed auxiliary class is the target auxiliary class corresponding to the control to be refreshed includes:
calling the monitoring language change function in the auxiliary base class through a calling entry in the multi-language management class, and determining whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed;
the calling of the monitoring language change function to determine whether the traversed auxiliary class is the target auxiliary class corresponding to the control to be refreshed includes:
calling the monitoring language change function, and judging whether the traversed auxiliary class is an auxiliary class corresponding to a display control;
if yes, determining the traversed auxiliary class as the target auxiliary class;
before traversing the list of auxiliary base classes, the method further comprises:
generating an auxiliary class corresponding to each control according to the member corresponding to each control and a preset auxiliary base class;
registering the auxiliary class corresponding to each control to the auxiliary base class list;
the generating of the auxiliary class corresponding to each control according to the member of each control and the preset auxiliary base class includes:
generating multiple preset types of auxiliary classes according to a preset auxiliary base class;
determining the type of the control according to the member of the control;
according to the type of the control, determining an auxiliary class of the type corresponding to the control from the auxiliary classes of the multiple preset types;
generating an auxiliary class corresponding to the control according to the control and the auxiliary class of the corresponding type;
before traversing the list of auxiliary base classes, the method further comprises:
registering the auxiliary base class to the multi-language management class.
2. The method of claim 1, wherein the method further comprises:
if the auxiliary classes in the auxiliary base class list are not the auxiliary classes corresponding to the display control, generating the auxiliary classes corresponding to the display control on the preset application interface by adopting a preset auxiliary class construction function according to a preset auxiliary base class;
and registering the generated auxiliary class into the auxiliary base class list.
3. The method of claim 1, wherein the method further comprises:
and if the parameter of the auxiliary class corresponding to the control is null, adopting the constructor of the control to establish the auxiliary class corresponding to the control.
4. An interface language switching apparatus, comprising: the device comprises a traversing module, a determining module and a refreshing module, wherein:
the traversal module is configured to traverse an auxiliary base class list after receiving the language change notification, where the auxiliary base class list includes: presetting an auxiliary class corresponding to at least one control on an application interface; the language change notification includes: a target language;
the determining module is used for calling a monitoring language change function and determining whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed;
the refreshing module is used for calling a language translation function in a target auxiliary class, refreshing the display content of the control to be refreshed, and switching the display content of the control to be refreshed into the display content corresponding to the target language;
the determining module is specifically configured to call the monitoring language change function in the auxiliary base class through a call entry in the multi-language management class, and determine whether the traversed auxiliary class is a target auxiliary class corresponding to the control to be refreshed;
the device further comprises: the judging module is used for calling the monitoring language change function and judging whether the traversed auxiliary class is the auxiliary class corresponding to the display control;
the determining module is specifically configured to determine that the traversed auxiliary class is the target auxiliary class;
the generating module is specifically used for generating an auxiliary class corresponding to each control according to the member corresponding to each control and a preset auxiliary base class;
a registration module, configured to register an auxiliary class corresponding to each control to the auxiliary base class list;
the generating module is specifically used for generating multiple preset types of auxiliary classes according to a preset auxiliary base class;
the determining module is specifically configured to determine the type of the control according to the member of the control; according to the type of the control, determining an auxiliary class of the type corresponding to the control from the auxiliary classes of the multiple preset types;
the generating module is specifically configured to generate an auxiliary class corresponding to the control according to the control and the auxiliary class of the corresponding type;
the registration module is further configured to register the auxiliary base class with the multi-language management class.
5. An interface language switching apparatus, characterized in that the apparatus comprises: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, when the interface language switching device is operated, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to execute the method of any one of the preceding claims 1 to 3.
6. A storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, performs the method of any of the preceding claims 1-3.
CN202011557432.4A 2020-12-24 2020-12-24 Interface language switching method, device, equipment and storage medium Active CN112596841B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011557432.4A CN112596841B (en) 2020-12-24 2020-12-24 Interface language switching method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011557432.4A CN112596841B (en) 2020-12-24 2020-12-24 Interface language switching method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112596841A CN112596841A (en) 2021-04-02
CN112596841B true CN112596841B (en) 2022-08-12

Family

ID=75202015

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011557432.4A Active CN112596841B (en) 2020-12-24 2020-12-24 Interface language switching method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112596841B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113687860A (en) * 2021-08-20 2021-11-23 北京达佳互联信息技术有限公司 Dynamic configuration method, device, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1259706A (en) * 1998-12-15 2000-07-12 国际商业机器公司 Method, system and computer programme products to supply user's interface using selected displaying language
CN109634684A (en) * 2018-12-07 2019-04-16 万兴科技股份有限公司 Method, apparatus, computer equipment and the storage medium of application program load language
CN110362370A (en) * 2019-06-14 2019-10-22 平安科技(深圳)有限公司 A kind of switching method of homepages language, device and terminal device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8418134B2 (en) * 2010-09-30 2013-04-09 Oracle International Corporation Method for efficiently managing property types and constraints in a prototype based dynamic programming language
CN108710662B (en) * 2018-05-14 2019-12-27 上海跬智信息技术有限公司 Language conversion method and device, storage medium, data query system and method
CN111309301B (en) * 2020-01-17 2023-09-01 广东三维家信息科技有限公司 Program language conversion method, device and conversion equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1259706A (en) * 1998-12-15 2000-07-12 国际商业机器公司 Method, system and computer programme products to supply user's interface using selected displaying language
CN109634684A (en) * 2018-12-07 2019-04-16 万兴科技股份有限公司 Method, apparatus, computer equipment and the storage medium of application program load language
CN110362370A (en) * 2019-06-14 2019-10-22 平安科技(深圳)有限公司 A kind of switching method of homepages language, device and terminal device

Also Published As

Publication number Publication date
CN112596841A (en) 2021-04-02

Similar Documents

Publication Publication Date Title
CN109558748B (en) Data processing method and device, electronic equipment and storage medium
CN111314141B (en) Route updating method and device
CN101902756B (en) M2M (Machine To Machine) business platform and working method thereof
WO2020233369A1 (en) Method for improving software integration system on basis of simulated port, and related device
CN107133309B (en) Method and device for storing and querying process example, storage medium and electronic equipment
US11073970B2 (en) Dashboard generation based on user interaction
CN111831542B (en) API application debugging method and device and storage medium
US20150186195A1 (en) Method of analysis application object which computer-executable, server performing the same and storage media storing the same
CN112596841B (en) Interface language switching method, device, equipment and storage medium
CN113051503A (en) Browser page rendering method and device, electronic equipment and storage medium
CN105955838A (en) System halt reason check method and device
CN113220403B (en) Method and device for h5 intercepting Android return event and electronic equipment
CN108829391B (en) Method and system for identifying control in Fragment
CN108563578A (en) SDK compatibility detection method, device, equipment and readable storage medium storing program for executing
CN114173366A (en) User parameter repairing method and device, computer storage medium and electronic equipment
CN111459547B (en) Method and device for displaying function call link
CN109086116B (en) Communication tool speech real-time monitoring method and device based on auxiliary function service
CN111506644A (en) Application data processing method and device and electronic equipment
CN113946386B (en) Screen capture control method and device, computer equipment and storage medium
CN116048490B (en) Business event processing method, device, computer equipment and storage medium
CN116737767A (en) Database switching method, system, equipment and medium
CN114217926A (en) Multi-process service instance deployment method, device, equipment and readable storage medium
CN111047417A (en) Service monitoring method, device, equipment and storage medium
CN116361187A (en) Annotation-based mock testing method, annotation-based mock testing device, medium and computer equipment
CN111736970A (en) Service processing method, device, equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant