CN115098200A - Language switching method and device, electronic equipment and storage medium - Google Patents

Language switching method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115098200A
CN115098200A CN202210555902.6A CN202210555902A CN115098200A CN 115098200 A CN115098200 A CN 115098200A CN 202210555902 A CN202210555902 A CN 202210555902A CN 115098200 A CN115098200 A CN 115098200A
Authority
CN
China
Prior art keywords
character
language
text
target
determining
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.)
Pending
Application number
CN202210555902.6A
Other languages
Chinese (zh)
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.)
Beijing Shareit Information Technology Co Ltd
Original Assignee
Beijing Shareit Information 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 Beijing Shareit Information Technology Co Ltd filed Critical Beijing Shareit Information Technology Co Ltd
Priority to CN202210555902.6A priority Critical patent/CN115098200A/en
Publication of CN115098200A publication Critical patent/CN115098200A/en
Pending legal-status Critical Current

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
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04842Selection of displayed objects or displayed text elements

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The disclosure relates to a language switching method, a language switching device, an electronic device and a storage medium. The language switching method provided by the embodiment of the disclosure can comprise the following steps: determining at least one target control needing language switching in an application program, and determining a target language type of characters to be displayed on the target control; determining a first character identifier of the character to be displayed according to the corresponding relation between the character attribute and the character identifier and the target language type; determining a target language to be displayed on the target control according to the first character identifier; and displaying the target control and displaying the target language on the target control.

Description

Language switching method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of application program technologies, and in particular, to a language switching method and apparatus, an electronic device, and a storage medium.
Background
With the international popularization of application programs, language localization of application programs becomes more and more important. When the application program is used, the languages used by the user are different, and different languages need to be switched.
Currently, for language switching of an application program, after a language switching instruction of a user is received, a language package of a target language to be switched is downloaded, the application program is restarted for language switching after the language package is installed, the user needs to wait for software restarting, and the language switching efficiency is low.
Disclosure of Invention
The embodiment of the disclosure provides a language switching method and device, electronic equipment and a storage medium.
A first aspect of an embodiment of the present disclosure provides a method for switching languages, where the method includes:
determining at least one target control needing language switching in an application program, and determining a target language type of characters to be displayed on the target control;
determining a first character identifier of the character to be displayed according to the corresponding relation between the character attribute and the character identifier and the target language type;
determining a target language to be displayed on the target control according to the first character identifier;
and displaying the target control and displaying the target language on the target control.
In some possible embodiments, the determining at least one target control element in the application program that needs to perform language switching includes:
acquiring a control attribute of at least one control in the application program;
and determining at least one target control needing to be subjected to language switching from the at least one control according to the control attribute.
In some possible embodiments, the determining, according to the correspondence between the text attribute and the text identifier and the target language type, the first text identifier of the text to be displayed includes:
determining a second character identifier of a currently displayed character on the target control;
determining character attributes corresponding to the second character identifications according to the first corresponding relation; wherein the first corresponding relationship comprises: the corresponding relation between the character mark of the current language used by the current displayed character and the character attribute;
determining the first character identification of the target language corresponding to the character attribute according to the second corresponding relation; wherein the preset corresponding relationship comprises: and the corresponding relation between the character identification of the target language and the character attribute.
In some possible embodiments, the text attribute includes: literal name.
In some possible embodiments, before determining the target language to be displayed on the target control according to the first text identifier, the method further includes:
detecting a user operation;
downloading a character resource file of a target language corresponding to the user operation; and the character resource file is used for providing characters of the target language displayed on the target control.
In some possible embodiments, the determining, according to the first text identifier, a target language to be displayed on the target control includes:
determining a first character resource corresponding to the first character identification from the character resource file;
and replacing the second text resource of the currently displayed text with the first text resource to determine the target language to be displayed on the target control.
In some possible embodiments, the method further comprises:
if the first text resource is not inquired in the text resource file, sending an acquisition request aiming at the first text resource to a server;
and receiving the first text resource returned by the server.
A second aspect of the embodiments of the present disclosure provides a language switching apparatus, including:
the first determining module is used for determining at least one target control needing language switching in an application program and determining the target language type of characters to be displayed on the target control;
the second determining module is used for determining the first character identifier of the character to be displayed according to the corresponding relation between the character attribute and the character identifier and the target language type;
a third determining module, configured to determine, according to the first text identifier, a target language to be displayed on the target control;
and the display module is used for displaying the target control and displaying the target language on the target control.
In some possible embodiments, the first determining module, when determining at least one target control that needs to be switched in language in the application program, is configured to:
acquiring control attributes of at least one control in the application program;
and determining at least one target control needing to be subjected to language switching from the at least one control according to the control attribute.
In some possible embodiments, the second determining module, when determining the first text identifier of the text to be displayed according to the correspondence between the text attribute and the text identifier and the target language type, is configured to:
determining a second character identifier of a currently displayed character on the target control;
determining character attributes corresponding to the second character identifications according to the first corresponding relation; wherein the first corresponding relationship comprises: the corresponding relation between the character mark of the current language used by the current displayed character and the character attribute;
determining the first character identification of the target language corresponding to the character attribute according to the second corresponding relation; wherein the preset corresponding relationship comprises: and the corresponding relation between the character identification of the target language and the character attribute.
In some possible embodiments, the text attribute includes: literal name.
In some possible embodiments, the apparatus further comprises a detection module configured to:
detecting a user operation;
downloading a character resource file of a target language corresponding to the user operation; and the character resource file is used for providing characters of the target language displayed on the target control.
In some possible embodiments, when determining the target language to be displayed on the target control according to the first text identifier, the third determining module is configured to:
determining a first text resource corresponding to the first text identifier from the text resource file;
and replacing the second text resource of the currently displayed text with the first text resource to determine the target language to be displayed on the target control.
In some possible embodiments, the system further includes an obtaining module, configured to:
if the first character resource is not inquired in the character resource file, sending an acquisition request aiming at the first character resource to a server;
and receiving the first text resource returned by the server.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
the method comprises the steps of determining a first character identifier of characters to be displayed on a target control according to the corresponding relation between character attributes and character identifiers aiming at the target control which needs to be subjected to language switching in an application program, determining a target language to be displayed on the target control according to the first character identifier, displaying the target language on the target control, directly performing language switching on the characters displayed on the target control of the application program, and effectively improving the language switching efficiency without restarting the application program.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a schematic view of an application scenario of a language switching method according to an embodiment of the present disclosure;
fig. 2 is a schematic flow chart of a language switching method according to an embodiment of the present disclosure;
FIG. 3 is a diagram of an exemplary correspondence between a Chinese character identifier and a character name according to the present disclosure;
FIG. 4 is a schematic diagram of a scheme for language switching in one example of the present disclosure;
FIG. 5 is a schematic diagram of a scheme for language switching in one example of the present disclosure;
fig. 6 is a schematic structural diagram of a language switching device according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of a language switching device according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of an electronic device in one example.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of devices consistent with certain aspects of the present disclosure, as detailed in the appended claims.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should be further understood that the terms "comprises" and/or "comprising," when used in connection with embodiments of the present disclosure, specify the presence of stated features, information, data, steps, operations, elements, and/or components, but do not preclude the presence or addition of other features, information, data, steps, operations, elements, components, and/or groups thereof, as supported by the art. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein indicates at least one of the items defined by the term, e.g., "a and/or B" indicates either implementation as "a", or implementation as "a and B".
To make the objects, technical solutions and advantages of the present disclosure more apparent, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
Fig. 1 is a schematic application scenario diagram of a language switching method according to an embodiment of the present disclosure. Referring to fig. 1, the application scenario includes: and (4) terminal equipment. Determining at least one target control 101 which needs to be subjected to language switching in an application program of terminal equipment, wherein characters of a current language type, namely Chinese shown in the figure, are displayed on the target control 101, and determining the target language type of the characters to be displayed on the target control 101; determining a first character identifier of the character to be displayed according to the corresponding relation between the character attribute and the character identifier and the target language type; determining a target language to be displayed on the target control 101 according to the first character identifier; and displaying the target control 101 on a display interface of the terminal device and displaying the target language, such as English shown in the figure, on the target control 101.
It will be understood by those skilled in the art that the "terminal Device" used herein may be a Mobile phone, a tablet computer, a PDA (Personal Digital Assistant), an MID (Mobile Internet Device), a vehicle-mounted Device, a wearable Device, etc.
It should be understood that fig. 1 illustrates an application scenario in an example, and does not limit the application scenario of the language switching method of the present disclosure, in the scenario, the current language is already displayed in the application program, and the current language is switched to the target language and displayed, and in other application scenarios, the current language may also be switched to the target language and displayed when the application program is not started or is not displayed.
In some possible embodiments, the present disclosure provides a language switching method, which may be applied in a terminal device, as shown in fig. 2, and may include:
step S201, determining at least one target control that needs to perform language switching in an application program, and determining a target language type of a text to be displayed on the target control.
The application program may include a plurality of resources, for example, resources including pictures, words, colors, and the like, each resource is provided with an attribute, and the resource attribute may include a name, a value, and the like, for example, for a word, the word attribute may include a word name.
The control of the application program may be used as a carrier of the resource, for example, to display text and display color, and the control may also be used to provide a functional entry of the application program, and the like.
If the characters are displayed on the control of the application program, the languages of the characters displayed on the control can be switched, namely, the control can be used as a target control.
Specifically, the target control which needs to be switched by the language can be determined through the control attribute of the control.
Wherein the target language type may be a language type of text that the user desires to display the target control.
In a specific implementation process, the target language type of the characters to be displayed on the target control can be determined by receiving input operation of a user.
For example, the user may enter or select the target language type by touch, click, swipe, keyboard entry, and the like.
Step S202, determining a first character identification of the character to be displayed according to the corresponding relation between the character attribute and the character identification and the target language type.
In an editing stage, i.e., a compiling period, of the application program, a unique identifier is generated for both the resource and the control, i.e., a resource identifier is generated for the resource, and a control identifier is generated for the control, e.g., a unique text identifier can be generated for text in the resource.
Wherein the text attribute may include a text name.
In the compiling stage, the identifier changes with the compiling period, but the name of the resource or the control remains unchanged, and a corresponding relationship between the name and the identifier can be generated in the compiling process, that is, for the resource, a corresponding relationship between the resource name and the resource identifier is generated, for example, a corresponding relationship between the character identifier and the character name is generated; and generating a corresponding relation between the control identification and the control name aiming at the control.
The corresponding relationship may exist in a list form, as shown in fig. 3, for one language, characters 1-5 are set with the corresponding relationship between character identification and character name.
Specifically, the text attribute currently displayed may be determined through a corresponding relationship between the text attribute of the currently displayed text and the text identifier on the target control, and the text attribute of the target language type to be displayed is further determined, so as to determine the text identifier to be displayed.
Step S203, determining a target language to be displayed on the target control according to the first character identifier.
In the specific implementation process, if the target language type is determined, the corresponding text resource file, namely the language package of the target language, can be determined according to the target language type, the text resource file provides the text of the target language, and then the target resource of the corresponding text to be displayed is determined from the target resource file according to the first text identifier, so that the text of the target language is displayed.
And S204, displaying the target control and displaying the target language on the target control.
Specifically, in the process of switching languages, the application program can keep a display interface in a continuous display state, and the target control can be maintained to be displayed in the display interface of the application program; or the display interface of the application program is not displayed, and when the display interface is opened, the target control is displayed and the target language is directly displayed.
In the embodiment, the first character identification of the character to be displayed on the target control is determined according to the corresponding relationship between the character attribute and the character identification, the target language to be displayed on the target control is determined according to the first character identification, and the target language is displayed on the target control, so that the language switching of the character displayed on the target control of the application program can be directly performed, the application program does not need to be restarted, and the language switching efficiency can be effectively improved.
The specific process of determining the target control is further described below in conjunction with the embodiments.
In some possible embodiments, the step S201 of determining at least one target control in the application program that needs to be switched between languages may include:
(1) acquiring control attributes of at least one control in the application program;
(2) and determining at least one target control needing language switching from the at least one control according to the control attributes.
In the control attribute of the control supporting language switching, a specific field may be set, for example, in the control supporting language switching, a "lan: enable" may be set through a namespace and a custom attribute.
Specifically, the control attribute of the control in the application program can be traversed, and whether the control can support language switching is determined according to the control attribute, so that the target control is determined.
The above embodiment illustrates a specific determination process of the target control, and a specific process of determining the first text identifier of the text to be displayed will be further described below with reference to the embodiment.
In some possible embodiments, the step S202 determines the first text identifier of the text to be displayed according to the correspondence between the text attribute and the text identifier and the target language type, and may include:
(1) determining a second character identifier of a currently displayed character on the target control;
(2) determining character attributes corresponding to the second character identifications according to the first corresponding relation; wherein the first correspondence comprises: a correspondence between a text identifier of a current language used by a currently displayed text and the text attribute;
(3) determining the first character identification of the target language corresponding to the character attribute according to the second corresponding relation; wherein the preset corresponding relationship comprises: and the corresponding relation between the character identification of the target language and the character attribute.
Specifically, for different language types, the text attribute of the currently displayed text is kept unchanged, that is, the text attribute of the currently displayed text is determined according to the corresponding relationship between the text identifier of the current language used by the currently displayed text and the text attribute, and then the first text identifier is determined according to the text attribute according to the corresponding relationship between the text identifier of the target language and the text attribute.
In the foregoing embodiment, the text attributes of the text in different language types are the same, and in some embodiments, the text attributes of the text in different language types may include the same field, for example, if the text attribute of the Chinese language of the currently displayed text is "Chinese name", and the text attribute of the English language is "English name", the second text attribute of the currently displayed text may be determined according to the correspondence between the text identifier of the current language used by the currently displayed text and the text attribute, the first text attribute of the text to be displayed may be determined according to the same field between the first text attribute and the second text attribute, and then the first text identifier may be determined according to the correspondence between the text identifier of the target language and the text attribute.
The above embodiments illustrate specific processes for determining the first text identifier of the text to be displayed, and the specific processes for determining the target language will be further described with reference to the embodiments.
In some possible embodiments, the method may further include:
(1) detecting a user operation;
(2) downloading a character resource file of a target language corresponding to the user operation; and the character resource file is used for providing characters of the target language displayed on the target control.
Wherein the user operation may be an operation for indicating a target language type selected by the user. The user operation may include touch, click, slide and other operation forms.
The text resource file may include text resources of a target language type required by the text to be displayed on each control in the application program.
In some possible embodiments, the step S203 determining, according to the first text identifier, a target language to be displayed on the target control, may include:
(1) determining a first character resource corresponding to the first character identification from the character resource file;
(2) and replacing the second text resource of the currently displayed text with the first text resource to determine the target language to be displayed on the target control.
Specifically, the second text resource is used for providing currently displayed text on the target control, and the second text resource is replaced by the first text resource, so that the target language, that is, the text of the target language type, can be provided on the target control.
In some possible embodiments, the method may further include:
if the first character resource is not inquired in the character resource file, sending an acquisition request aiming at the first character resource to a server;
and receiving the first text resource returned by the server.
Specifically, if the first text resource is not queried in the text resource file, the first text resource can be obtained from the server, the text resource file is updated, and an update request for the text resource file can be sent to the server, so that the updated text resource file is more complete and comprehensive.
In order to more clearly illustrate the language switching method of the present disclosure, the language switching method of the present disclosure will be further described in detail with reference to examples.
In one example, as shown in fig. 4, the language switching method of the present disclosure may include:
determining a target control needing to be subjected to language switching, namely a character control shown in a figure;
the definition has the characters 'set': the attribute of the currently displayed text is name, and the currently displayed text is value;
when generating the application, the system dynamically generates a second character identifier id (identifier) for the character, which is 1234567899, namely the character id shown in the figure;
and if the language needs to be switched to the language of the specific region, downloading a corresponding character resource file, namely a language package, wherein the downloaded character resource file also comprises the characters:
the character attribute of the target language type is name: "text _ setting", the character to be displayed is value ═ set "(specific region language);
when an application is generated, the system identifies 1899234567 a first character dynamically generated by the character;
when the language is switched, firstly, according to the second character identifier id of the currently displayed character being 1234567899, determining the corresponding character attribute name being text _ setting, namely the character name shown in the figure;
finding text _ setting, namely a multi-language name shown in the figure, in the text resource file; further, find the corresponding first text id 1899234567, i.e. the multi-language id shown in the figure;
determining a corresponding first character resource;
the second character resource of the currently displayed character is replaced by the first character resource of the target language type, the setting displayed on the target control is replaced by the set, namely the multi-language character shown in the figure is replaced, and the multi-language character is displayed on the character control.
In one example, as shown in fig. 5, the language switching method of the present disclosure may include:
downloading the multi-language package;
acquiring characters of a control in an application program, and acquiring a character id;
according to the character name of the character id; the literal name can be one of the aforementioned literal identifiers, i.e., one of the literal attributes.
Inquiring the downloaded multi-language package according to the name of the character to obtain the character id of the character to be replaced;
finding out the characters needing to be replaced according to the character id;
and updating the characters in the control by using the characters needing to be replaced.
The following explains the underlying implementation procedure of the language switching method of the present disclosure with reference to an example.
In one example, the language switching method of the present disclosure may be implemented as follows:
1. setting a control, namely view, by using a namespace and custom attributes:
attr can be defined by the following code "xmlns"; wherein the attr () method is used to set or return the attribute value of the selected element;
2. defining required attribute classes, alternative attributes include: text reference class: textatrr and the like, each base class corresponds to an attribute, and the corresponding variables comprise: attribute name, id (literal identifier), name (filename or control name), type (text);
3. realizing a Factory class, and setting a custom Factory when an onCreate () method of an Activity class needing to support language switching is executed;
wherein, the Factory class may include an interface, an abstract class or a common class; the Activity class is a base class in the Activity type hierarchical structure; the onCreate () method is used to represent "a window is being generated";
4. an interface is defined, for example, the interface may be IDynamicNewView, which is used to add a skin change View and perform multi-language operations, for example, see usage classes: NaviTabIndicatorView, ActionBarView;
5. a language replacement notification mechanism, an observer mode, a class that manages a class that needs to support language replacement, notifies the class to update a User Interface (UI), and replaces a resource file.
6. Resource naming, the premise that all language functions are available, naming of the skin change control is specified, and all text resource files, namely resource names used in a language package, are uniformly started with specific fields, for example, lan _ is started:
lan _ main _ actionbar _ title, r.color lan _ system _ status _ bar _ title, etc.;
the literal resource file, i.e. the resource name in the language package, must be consistent with the corresponding resource file in the target control. And when the apk (Android application package) file is compiled and generated, the file name is kept from being confused, otherwise, the file name cannot be used.
7. The UI shows a page provided for the user to select settings;
8. making and issuing a language package, wherein the language package is a project only containing resource files, and the names of the resource files are consistent with the language control in the main project; the manufactured character resource files of different language types, namely the multi-language packages, need to be uploaded to a server, namely a resource library, and then download addresses are provided, so that cloud control is deployed in a configuration system.
The implementation process may include the following implementation classes:
LanInflaterFactory: the method is used for acquiring the controls supporting language change in the static mode, namely the target controls, maintaining all lists of the supported language change controls and executing language switching operation.
LanManager: the method is used for loading the language files, acquiring the corresponding resource files from the language files, maintaining the language files, needing to set an observer, belonging to the SDK (Software Development Kit) level, and being convenient for modifying the implementation without influencing UI (user interface) calling.
LanManager: one layer of external interface class for encapsulating the caller belongs to the App (application) level. The functions include initializing the SDK, managing the language (providing an interface for external use of the theme), saving user variables, and the like.
LanDownloadmanager: for providing language download management functions.
LanItem: for defining language properties: id (Identity document), fileUrl (file address), md5 (language file md5), and so forth.
According to the language switching method, the first character identification of the character to be displayed on the target control is determined according to the corresponding relation between the character attribute and the character identification, the target language to be displayed on the target control is determined according to the first character identification, the target language is displayed on the target control, the language switching can be directly carried out on the character displayed on the target control of the application program, the application program does not need to be restarted, and the language switching efficiency can be effectively improved.
In some possible embodiments, as shown in fig. 6, there is provided a language switching apparatus including:
a first determining module 601, configured to determine at least one target control that needs to be language-switched in an application program, and determine a target language type of a text to be displayed on the target control;
a second determining module 602, configured to determine a first text identifier of the text to be displayed according to a correspondence between a text attribute and a text identifier and the target language type;
a third determining module 603, configured to determine, according to the first text identifier, a target language to be displayed on the target control;
a display module 604, configured to display the target control and display the target language on the target control.
In some possible embodiments, the first determining module 601, when determining at least one target control that needs to be switched between languages in the application program, is configured to:
acquiring control attributes of at least one control in the application program;
and determining at least one target control needing language switching from the at least one control according to the control attributes.
In some possible embodiments, when determining the first text identifier of the text to be displayed according to the correspondence between the text attribute and the text identifier and the target language type, the second determining module 602 is configured to:
determining a second character identifier of a currently displayed character on the target control;
determining character attributes corresponding to the second character identifications according to the first corresponding relation; wherein the first corresponding relationship comprises: the corresponding relation between the character mark of the current language used by the current displayed character and the character attribute;
determining the first character identification of the target language corresponding to the character attribute according to the second corresponding relation; wherein the preset corresponding relationship comprises: and the corresponding relation between the character identification of the target language and the character attribute.
In some possible embodiments, the text attribute includes: literal name.
In some possible embodiments, as shown in fig. 7, the apparatus further includes a detection module 605 for:
detecting a user operation;
downloading a character resource file of a target language corresponding to the user operation; and the character resource file is used for providing characters of the target language displayed on the target control.
In some possible embodiments, when determining the target language to be displayed on the target control according to the first text identifier, the third determining module 603 is configured to:
determining a first character resource corresponding to the first character identification from the character resource file;
and replacing the second text resource of the currently displayed text with the first text resource to determine the target language to be displayed on the target control.
In some possible embodiments, the system further includes an obtaining module, configured to:
if the first character resource is not inquired in the character resource file, sending an acquisition request aiming at the first character resource to a server;
and receiving the first text resource returned by the server.
According to the language switching device, the first character identification of the character to be displayed on the target control is determined according to the corresponding relation between the character attribute and the character identification, the target language to be displayed on the target control is determined according to the first character identification, the target language is displayed on the target control, the language switching can be directly carried out on the character displayed on the target control of the application program, the application program does not need to be restarted, and the language switching efficiency can be effectively improved.
Fig. 8 is a block diagram illustrating an electronic device 800 in accordance with an example embodiment. For example, the electronic device 800 may be included in a terminal device such as a mobile phone or a mobile computer, or a device such as a server.
Referring to fig. 8, electronic device 800 may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, multimedia data component 810, input/output (I/O) interface 812, sensor component 814, and communication component 816.
The processing component 802 generally controls overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 806 provides power to the various components of the electronic device 800. Power components 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for electronic device 800.
The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 800 is in an operating state, such as a shooting state or a video state. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The multimedia data component 810 is configured to output and/or input multimedia data signals. For example, the multimedia data assembly 810 includes a Microphone (MIC) configured to receive external multimedia data signals when the electronic device 800 is in an operational state, such as a call state, a record state, and a voice recognition state. The received multimedia data signal may further be stored in memory 804 or transmitted via communication component 816.
In some embodiments, the multimedia data component 810 further comprises a speaker for outputting the multimedia data signal.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, such as a keyboard, click wheel, knobs, etc. These operating buttons may include, but are not limited to: a home page operating button, a volume operating button, a start operating button and a lock operating button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the electronic device 800. For example, sensor assembly 814 may detect the open/closed status of device 800, the relative positioning of components, such as a display and keypad of device 800, sensor assembly 814 may also detect a change in position of device 800 or a component of device 800, the presence or absence of user contact with device 800, orientation or acceleration/deceleration of device 800, and a change in temperature of device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communications between the electronic device 800 and other devices in a wired or wireless manner. The electronic device 800 may access a wireless network based on a communication standard, such as Wi-Fi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer readable storage medium including instructions, such as the memory 804 including instructions, executable by the processor 820 of the apparatus 800 to perform the information processing method described above is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
The instructions may include, after being executed by the processor 820:
determining at least one target control needing language switching in an application program, and determining a target language type of characters to be displayed on the target control;
determining a first character identifier of the character to be displayed according to the corresponding relation between the character attribute and the character identifier and the target language type;
determining a target language to be displayed on the target control according to the first character identifier;
and displaying the target control and displaying the target language on the target control.
It can be understood that the determining at least one target control that needs to be switched between languages in the application program includes:
acquiring a control attribute of at least one control in the application program;
and determining at least one target control needing to be subjected to language switching from the at least one control according to the control attribute.
It can be understood that, the determining the first text identifier of the text to be displayed according to the corresponding relationship between the text attribute and the text identifier and the target language type includes:
determining a second character identifier of a currently displayed character on the target control;
determining character attributes corresponding to the second character identifications according to the first corresponding relation; wherein the first corresponding relationship comprises: the corresponding relation between the character mark of the current language used by the current displayed character and the character attribute;
determining the first character identification of the target language corresponding to the character attribute according to the second corresponding relation; wherein the preset corresponding relationship comprises: and the corresponding relation between the character identification of the target language and the character attribute.
As can be understood, the text attributes include: literal name.
It can be understood that, before determining the target language to be displayed on the target control according to the first text identifier, the method further includes:
detecting a user operation;
downloading a character resource file of a target language corresponding to the user operation; and the character resource file is used for providing characters of the target language displayed on the target control.
As can be understood, the determining, according to the first text identifier, a target language to be displayed on the target control includes:
determining a first character resource corresponding to the first character identification from the character resource file;
and replacing the second text resource of the currently displayed text with the first text resource to determine the target language to be displayed on the target control.
As can be appreciated, the method further comprises:
if the first text resource is not inquired in the text resource file, sending an acquisition request aiming at the first text resource to a server;
and receiving the first text resource returned by the server.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method for switching languages, comprising:
determining at least one target control needing language switching in an application program, and determining a target language type of characters to be displayed on the target control;
determining a first character identifier of the character to be displayed according to the corresponding relation between the character attribute and the character identifier and the target language type;
determining a target language to be displayed on the target control according to the first character identifier;
and displaying the target control and displaying the target language on the target control.
2. The method of claim 1, wherein determining at least one target control in the application program that needs to be switched between languages comprises:
acquiring a control attribute of at least one control in the application program;
and determining at least one target control needing language switching from the at least one control according to the control attributes.
3. The method according to claim 1 or 2, wherein the determining the first text identifier of the text to be displayed according to the corresponding relationship between the text attribute and the text identifier and the target language type comprises:
determining a second character identifier of a currently displayed character on the target control;
determining character attributes corresponding to the second character identifications according to the first corresponding relation; wherein the first correspondence comprises: the corresponding relation between the character mark of the current language used by the current displayed character and the character attribute;
determining the first character identification of the target language corresponding to the character attribute according to the second corresponding relation; wherein, the preset corresponding relationship comprises: and the corresponding relation between the character identification of the target language and the character attribute.
4. The method of claim 3, wherein the text attribute comprises: literal name.
5. The method of claim 1, wherein before determining the target language to be displayed on the target control according to the first text label, the method further comprises:
detecting a user operation;
downloading a character resource file of a target language corresponding to the user operation; and the character resource file is used for providing characters of the target language displayed on the target control.
6. The method of claim 5, wherein the determining a target language to be displayed on the target control according to the first text identifier comprises:
determining a first character resource corresponding to the first character identification from the character resource file;
and replacing the second text resource of the currently displayed text with the first text resource to determine the target language to be displayed on the target control.
7. The method of claim 6, further comprising:
if the first text resource is not inquired in the text resource file, sending an acquisition request aiming at the first text resource to a server;
and receiving the first text resource returned by the server.
8. A language switching device, comprising:
the first determining module is used for determining at least one target control needing language switching in an application program and determining the target language type of characters to be displayed on the target control;
the second determining module is used for determining the first character identifier of the character to be displayed according to the corresponding relation between the character attribute and the character identifier and the target language type;
a third determining module, configured to determine, according to the first text identifier, a target language to be displayed on the target control;
and the display module is used for displaying the target control and displaying the target language on the target control.
9. An electronic device, comprising:
a memory for storing processor-executable instructions;
a processor coupled to the memory;
wherein the processor is configured to perform the method as provided in any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium, instructions in which, when executed by a processor of a computer, enable the computer to perform the method as provided in any one of claims 1 to 7.
CN202210555902.6A 2022-05-20 2022-05-20 Language switching method and device, electronic equipment and storage medium Pending CN115098200A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210555902.6A CN115098200A (en) 2022-05-20 2022-05-20 Language switching method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210555902.6A CN115098200A (en) 2022-05-20 2022-05-20 Language switching method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115098200A true CN115098200A (en) 2022-09-23

Family

ID=83288508

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210555902.6A Pending CN115098200A (en) 2022-05-20 2022-05-20 Language switching method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115098200A (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109561209A (en) * 2018-11-22 2019-04-02 努比亚技术有限公司 A kind of font switching method, terminal and computer readable storage medium
CN109783172A (en) * 2019-01-08 2019-05-21 北京三快在线科技有限公司 Language switching method, device, electronic equipment and readable storage medium storing program for executing
US20190297206A1 (en) * 2018-03-20 2019-09-26 Canon Kabushiki Kaisha Information processing apparatus that switches languages to be displayed, control method therefor, and storage medium
CN110826296A (en) * 2019-11-01 2020-02-21 广州华多网络科技有限公司 Text font switching method and device, computer readable medium and equipment
CN111061535A (en) * 2019-12-20 2020-04-24 网易(杭州)网络有限公司 Interface switching method and device
CN111104197A (en) * 2019-12-24 2020-05-05 深南电路股份有限公司 Display language switching method and device and storage medium
CN111221617A (en) * 2020-01-20 2020-06-02 厦门靠谱云股份有限公司 Method and system for multi-language switching in single project based on webpage
CN111857924A (en) * 2020-07-21 2020-10-30 哈尔滨海能达科技有限公司 Multi-language implementation method and device for terminal
WO2020248849A1 (en) * 2019-06-14 2020-12-17 平安科技(深圳)有限公司 Webpage language switching method and apparatus, and terminal device
WO2021239019A1 (en) * 2020-05-28 2021-12-02 维沃移动通信有限公司 Method, device, and equipment for switching text language types, and storage medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190297206A1 (en) * 2018-03-20 2019-09-26 Canon Kabushiki Kaisha Information processing apparatus that switches languages to be displayed, control method therefor, and storage medium
CN109561209A (en) * 2018-11-22 2019-04-02 努比亚技术有限公司 A kind of font switching method, terminal and computer readable storage medium
CN109783172A (en) * 2019-01-08 2019-05-21 北京三快在线科技有限公司 Language switching method, device, electronic equipment and readable storage medium storing program for executing
WO2020248849A1 (en) * 2019-06-14 2020-12-17 平安科技(深圳)有限公司 Webpage language switching method and apparatus, and terminal device
CN110826296A (en) * 2019-11-01 2020-02-21 广州华多网络科技有限公司 Text font switching method and device, computer readable medium and equipment
CN111061535A (en) * 2019-12-20 2020-04-24 网易(杭州)网络有限公司 Interface switching method and device
CN111104197A (en) * 2019-12-24 2020-05-05 深南电路股份有限公司 Display language switching method and device and storage medium
CN111221617A (en) * 2020-01-20 2020-06-02 厦门靠谱云股份有限公司 Method and system for multi-language switching in single project based on webpage
WO2021239019A1 (en) * 2020-05-28 2021-12-02 维沃移动通信有限公司 Method, device, and equipment for switching text language types, and storage medium
CN111857924A (en) * 2020-07-21 2020-10-30 哈尔滨海能达科技有限公司 Multi-language implementation method and device for terminal

Similar Documents

Publication Publication Date Title
EP3428790B1 (en) Method and device for displaying application interface
CN107357613B (en) Application updating method and device and computer readable storage medium
CN106095405B (en) Icon updating method and device
CN107463372B (en) Data-driven page updating method and device
CN107402756B (en) Method, device and terminal for drawing page
CN111221613B (en) Program calling method and device and storage medium
CN107368562B (en) Page display method and device and terminal
CN112087544B (en) Prompting method and device
CN110457084B (en) Loading method and device
CN115098200A (en) Language switching method and device, electronic equipment and storage medium
CN114546436A (en) Micro front-end service updating method and device, electronic equipment and storage medium
CN107423060B (en) Animation effect presenting method and device and terminal
CN111767063A (en) Resource updating method, device and equipment for application program
CN106843860B (en) Method, device and system for adjusting display style of search box
CN111104110A (en) Global style sharing method, global style sharing device and electronic device
CN110989987A (en) Portal webpage generation method, portal webpage generation device, client, server and storage medium
CN114416084B (en) Data processing method and device, electronic equipment and storage medium
CN110995767B (en) Request processing method and device
CN116126320B (en) Data processing method and device, electronic equipment and storage medium
CN113934452B (en) Data processing method and device, electronic equipment and storage medium
CN114416218B (en) Data processing method and device, electronic equipment and storage medium
CN111273910B (en) Method, device and storage medium for acquiring resource number identifier
CN114387928B (en) Backlight switching method and device, electronic equipment and storage medium
CN111625251B (en) Method and device for processing application instance
CN110377312B (en) Software upgrading method, device and 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