CN117056001A - Multilingual switching method, multilingual switching device, electronic device, storage medium, and program product - Google Patents

Multilingual switching method, multilingual switching device, electronic device, storage medium, and program product Download PDF

Info

Publication number
CN117056001A
CN117056001A CN202311016290.4A CN202311016290A CN117056001A CN 117056001 A CN117056001 A CN 117056001A CN 202311016290 A CN202311016290 A CN 202311016290A CN 117056001 A CN117056001 A CN 117056001A
Authority
CN
China
Prior art keywords
language
target
picture
text
switching
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
CN202311016290.4A
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.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech 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 China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202311016290.4A priority Critical patent/CN117056001A/en
Publication of CN117056001A publication Critical patent/CN117056001A/en
Pending legal-status Critical Current

Links

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

Landscapes

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

Abstract

The application provides a multilingual switching method, a multilingual switching device, an electronic device, a storage medium and a program product. Relates to the technical field of computers. The method comprises the following steps: receiving a language switching request, acquiring a target language selected by a user based on the language switching request, and generating a switching language notification comprising identification information based on the target language; the language switching request is generated in response to touch operation of a user on a language switching option at an APP interface; acquiring a target text file and a target picture resource from a localization resource library based on the identification information; and generating a system subscription message based on the target text file and the target picture resource, and resetting the target text and the target picture to be displayed based on the system subscription message so that the APP interface performs interface re-rendering based on the target text and the target picture. The method of the application simplifies the operation flow, so that the user can switch the language and the picture in real time when the APP is operated, select the proper language at any time, and improve the satisfaction degree of the user.

Description

Multilingual switching method, multilingual switching device, electronic device, storage medium, and program product
Technical Field
The present application relates to the field of computer technologies, and in particular, to a multi-language switching method, a multi-language switching device, an electronic device, a storage medium, and a program product.
Background
With the continuous development of computer technology, people's life has been integrated with more and more internationalized elements, so the internationalized multilingual demands of Application programs (APP) are more and more increased, and the multilingual information switching process of the Application programs is directly controlled by an operating system, when the default set language of the operating system is different from the language required by the user, the user needs to switch the default set language of the operating system to the required language.
In the prior art, taking an international multi-language processing method provided by an mobile operating system (iOS) of an apple company as an example, a localization resource file can be created in advance, and translation contents of localization character strings can be input in advance in the localization resource file, further, according to language settings of a user, the localization character strings and the translation contents corresponding to the localization character strings are accessed in an application program based on the international multi-language processing method, so that the system can automatically load the corresponding translation contents.
However, when the APP is to switch languages, the APP interface needs to be exited, the language is switched to the iOS system setting interface for setting the languages, after the system language is changed, the APP needs to be restarted, the APP can be re-entered to change the application program interface, the operation flow is complex, the switching content is single, and the user experience is affected.
Disclosure of Invention
The application provides a multi-language switching method, a device, electronic equipment, a storage medium and a program product, which are used for solving the problems that in the prior art, when APP is switched, an APP interface is required to be exited, the APP is switched to an iOS system setting interface for language setting, after system language is changed, the APP is required to be restarted, the APP interface can be changed only by re-entering the APP, the operation flow is complicated, the switching content is single, and the user experience is influenced.
In a first aspect, the present application provides a multilingual handover method, the method comprising:
receiving a language switching request, acquiring a target language selected by a user based on the language switching request, and generating a switching language notification based on the target language; the language switching request is generated in response to touch operation of a user on a language switching option on an application APP interface; the language switching options are interface controls which are created in advance and used for carrying out language switching; the switching language notification comprises identification information corresponding to a target language;
acquiring a target text file and a target picture resource from a localization resource library based on the identification information; the localization resource library is a database which is created in advance and used for storing text files and picture resources corresponding to various language types; the same identification information corresponds to a text file and a picture resource of one language type;
And generating a system subscription message based on the target text file and the target picture resource, and resetting target text and target picture to be displayed based on the system subscription message so that the APP interface performs interface re-rendering based on the target text and the target picture.
In one possible design, the method further comprises:
acquiring initial text files and initial picture resources corresponding to multiple language types, and filtering the initial text files and the initial picture resources to obtain text files and picture resources;
establishing a mapping relation between a text file and a picture resource corresponding to the same language type;
and creating corresponding identification information for each mapping relation, and storing the identification information, the text file with the mapping relation and the picture resource in a localization resource library.
In one possible design, the method further comprises:
creating a language switching option in a specific position area of a setting interface or a display interface of the application program, and establishing a link relation between the language switching option and multiple types of languages so that the application program determines a corresponding target language based on touch operation of a user on the language switching option.
In one possible design, obtaining the target text file and the target picture resource from the localized resource library based on the identification information includes:
calling a text processing algorithm by using a language manager, and acquiring a target text file from a localization resource library based on the identification information; the language manager is used for processing and changing the language of the application program at the current APP interface;
and calling a picture processing algorithm by using a language manager, and acquiring a target picture resource from a localization resource library based on the identification information.
In one possible design, the APP interface includes a text presentation page control and a picture presentation page control; resetting target text and target pictures to be displayed based on the system subscription message, including:
searching a text display page control and a picture display page control in the APP interface;
resetting target texts to be displayed on the basis of the system subscription message for the text display page control, and resetting target pictures to be displayed on the basis of the system subscription message for the picture display page control;
and after resetting the target text and the target picture to be displayed, releasing resources of the original text and the original picture corresponding to the APP interface so as to optimize the occupied memory.
In one possible design, the switching language notification further includes a date format, a time format, and a number format corresponding to the target language; the method further comprises the steps of:
acquiring a target date, a target time and a target number from a localization resource library based on the date format, the time format and the number format; and the date format, the time format and the number format respectively correspond to the date, the time and the number of the language type and are stored in the localization resource library.
In one possible design, the method further comprises:
detecting whether the re-rendered APP interface meets the user requirement;
if yes, storing the target text and the target picture based on a persistence mechanism, so that the APP automatically loads the target text and the target picture when being started next time;
if not, generating prompt information to prompt the user to set the target language again based on the language switching option on the APP interface.
In a second aspect, the present application provides a multilingual switching device, the device comprising:
the receiving module is used for receiving a language switching request, acquiring a target language selected by a user based on the language switching request, and generating a switching language notification based on the target language; the language switching request is generated in response to touch operation of a user on a language switching option on an application APP interface; the language switching options are interface controls which are created in advance and used for carrying out language switching; the switching language notification comprises identification information corresponding to a target language;
The acquisition module is used for acquiring a target text file and a target picture resource from the localization resource library based on the identification information; the localization resource library is a database which is created in advance and used for storing text files and picture resources corresponding to various language types; the same identification information corresponds to a text file and a picture resource of one language type;
the setting module is used for generating a system subscription message based on the target text file and the target picture resource, and resetting the target text and the target picture to be displayed based on the system subscription message so that the APP interface carries out interface re-rendering based on the target text and the target picture.
In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes the computer-executable instructions stored in the memory to implement the multi-language switching method as described above in the first aspect and the various possible designs of the first aspect.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium having stored therein computer executable instructions which, when executed by a processor, implement the multi-language switching method according to the first aspect and the various possible designs of the first aspect.
In a fifth aspect, embodiments of the present application provide a computer program product comprising a computer program which, when executed by a processor, implements the multi-lingual switching method according to the first aspect and the various possible designs of the first aspect.
The multilingual switching method, the device, the electronic equipment, the storage medium and the program product provided by the application can switch languages in the application program by a user without restarting the application program; specifically, when the user selects the switching language, the language setting of the current application program interface is updated, text files and picture resources on the interface are reloaded, the interface is switched to the corresponding language interface in real time, and when the multi-language switching of pictures in the application program is realized, the corresponding localized picture resources can be dynamically loaded and displayed according to the language selected by the user, so that the operation flow is simplified, more convenient and rapid language switching experience is provided, the user can select the proper language at any time when the APP is operated according to the own requirement, and the satisfaction degree of the user to the application program is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is an application scenario diagram of a multi-language switching method according to an embodiment of the present application;
fig. 2 is a flow chart of a multi-language switching method according to an embodiment of the present application;
FIG. 3 is a flow chart of a specific multi-language switching method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a multi-language switching device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
In order to clearly describe the technical solution of the embodiments of the present application, in the embodiments of the present application, the words "first", "second", etc. are used to distinguish the same item or similar items having substantially the same function and effect. For example, the first device and the second device are merely for distinguishing between different devices, and are not limited in their order of precedence. It will be appreciated by those of skill in the art that the words "first," "second," and the like do not limit the amount and order of execution, and that the words "first," "second," and the like do not necessarily differ.
In the present application, "at least one" means one or more, and "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a alone, a and B together, and B alone, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b, or c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or plural.
In the technical scheme of the application, the related processes of collecting, storing, using, processing, transmitting, providing, disclosing and the like of the information such as financial data or user data are in accordance with the regulations of related laws and regulations, and the public welfare is not violated. The user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of related data is required to comply with related laws and regulations and standards, and is provided with corresponding operation entries for the user to select authorization or rejection.
The following terms are used to explain the present application:
app internationalization: it may refer to adapting the content, user interface and functionality of an application to different language and cultural environments to better meet the user needs of different countries and regions. Through internationalization, applications can be generalized and used worldwide. Specifically, app internationalization includes the following three aspects:
text translation: all text contents in the application program can be translated into target languages, including information such as button labels, menu options, prompt messages, error prompts and the like;
Picture and resource adaptation: it may refer to pictures and resources related to language and culture contained in the applicable application program, with corresponding resources for different language environments. Such as using different icons and background pictures for different language environments to adapt to the changes of different languages;
date, time and number format: the method can refer to the representation modes of date, time and number in different countries and regions, the adaptation is needed according to the language environment of the user, and the display of the date, time and number can be correctly formatted according to the language environment of the user.
Intra-application multilingual handover: the method can be used for enabling the user to switch the languages in the application program by realizing the multilingual switching function in the application program so as to provide better multilingual experience and meet the language requirements of the user. There is typically a multilingual list within the application that is used to update the languages of all interfaces within the application at once based on the selected one of the languages.
Along with the continuous development of computer technology, there is an increasing demand for internationalized multilingual of APP, and the multilingual information switching process of an application program is directly controlled by an operating system, and when the default setting language of the operating system is different from the language required by the user, the user needs to switch the default setting language of the operating system to the required language.
In one possible implementation, the iOS system provides a set of Internationalization (Internationalization) schemes that enable developers to conveniently support multi-lingual and multi-regional localization requirements for applications, with the following development flows: creating a localization resource file in advance, such as creating a strings file in an integrated development environment, for storing translation contents of localization character strings; it may also choose to create strings files in a default basic language package folder or create a named package corresponding to the language, such as an english language package, a french language package, etc., for storing translated content of the corresponding language type.
Further, the localization translation content is filled in the localization resource file in advance, that is, the strings file is opened, and the translation content of the corresponding language is input, for example, for the strings file of the language package, "Hello number" = "Hello" may be input, which indicates "Hello" in english.
After the localization resource file is created and the translation content is filled, language switching can be realized by accessing the localization character string, namely, the localization character string and the translation content corresponding to the localization character string are accessed in the application program based on the international multi-language processing method according to the language setting of the user, so that the system can automatically load the corresponding translation content.
Although the method is convenient and quick, internationalization is needed according to the language set by the iOS system, after the language of the iOS system is changed, an application program is restarted and reenters to change an application program interface, so that the user is inconvenient to use, the operation flow is complicated, the switching content is single, even some users do not know how to set the language at all, and the user experience is affected.
It should be noted that, the automation scheme provided by the iOS system does not perform individual internationalization processing on the picture resources, if different picture resources are to be displayed for different languages, code processing is also required to be performed individually, that is, the current language setting is required to be acquired first, and the picture switching is performed by finding the corresponding resource file name which is agreed in advance.
In view of the above problems, the present application provides a multi-language switching method, which can allow a user to switch languages in an application program without restarting the application program; specifically, when the user selects to switch languages, the language setting of the current application program interface is updated, text files and picture resources on the interface are reloaded based on a localization resource library constructed in advance, the interface is switched to the corresponding language interface in real time, and when the multi-language switching of pictures in the application program is realized, the corresponding localization picture resources can be dynamically loaded and displayed according to the languages selected by the user, so that the operation flow is simplified, more convenient and rapid language switching experience is provided, the user can select the proper language at any time when the APP is operated according to the own requirements, and the satisfaction degree of the user to the application program is improved.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 1 is an application scenario diagram of a multi-language switching method according to an embodiment of the present application. As shown in fig. 1, the application scenario includes: a user's terminal device 101 and an APP application system 102; the display interface of the APP in the terminal device 101 has a language switching option.
Specifically, when the user selects a switching language based on a language switching option on a display interface of an APP based on the terminal device 101, the APP application system 102 responds to a selection operation of the user on the language switching option on the display interface of the APP, generates a language switching request, further updates a current language setting based on the language switching request, reloads text characters and picture resources on the display interface, switches to a corresponding language interface in real time, and further performs visual display on the display interface of the APP.
It should be noted that, the application scenario may be applicable to different APP application systems, such as iOS APP application systems, and the execution main body of the multilingual switching method in the embodiment of the present application is not limited specifically.
Alternatively, the Terminal device may be various electronic devices having a display screen and supporting web browsing, and the Terminal device may also be referred to as a Terminal (Terminal), a User Equipment (UE), a Mobile Station (MS), a Mobile Terminal (MT), or the like. The terminal device may be a mobile phone, a smart television, a wearable device, a smart speaker, a smart security device, a smart gateway, a tablet computer (Pad), a computer with wireless transceiving function, a Virtual Reality (VR) terminal device, an augmented Reality (Augmented Reality, AR) terminal device, a wireless terminal in industrial control (industrial control), a wireless terminal in self-driving (self-driving), a wireless terminal in teleoperation (remote medical surgery), a wireless terminal in smart grid (smart grid), a wireless terminal in transportation security (transportation safety), a wireless terminal in smart city (smart city), a wireless terminal in smart home (smart home), etc. Such terminal devices include, but are not limited to, smartphones, tablet computers, laptop portable computers, desktop computers, and the like.
Based on the application scenario shown in fig. 1, the embodiment of the application further provides a multi-language switching method. Fig. 2 is a flow chart of a multi-language switching method according to an embodiment of the present application. As shown in fig. 2, the multilingual switching method includes:
S201, receiving a language switching request, acquiring a target language selected by a user based on the language switching request, and generating a switching language notification based on the target language; the language switching request is generated in response to touch operation of a user on a language switching option on an application APP interface; the language switching options are interface controls which are created in advance and used for carrying out language switching; the switching language notification comprises identification information corresponding to the target language.
In the embodiment of the application, the language switching options can be buttons, drop-down menus or other user interface controls, the expression forms of the language switching options are not particularly limited, the language switching interfaces can be implemented in an APP interface, and the language switching options are used for linking and calling the interfaces of the corresponding target languages.
The identification information can refer to identification numbers of text files and target picture resources corresponding to different language types, and the text files and the picture resources of the same language type correspond to only one identification number; the representation form of the identification number can be numbers, letters, numbers, letters and the like, and the embodiment of the application is not particularly limited to the number, and can be used for distinguishing text files and picture resources of different language types.
In the step, if a user wants to switch the language type corresponding to the current APP interface in the APP operation process, the APP interface can find a language switching option and click a language switching option button, and further, the APP system responds to the click operation of the user on the language switching option in the APP interface to generate a language switching request, acquires a target language selected by the user, such as English, based on the language switching request and generates a switching language notification containing an identification number corresponding to English based on English; the language types may refer to languages of different countries and regions, such as english, french, chinese, etc., and the number of languages included in the language types according to the embodiment of the present application is not specifically limited.
When the user selects the switching language, the processing logic behind is as follows: the target language selected by the user is obtained, and the target language selected by the user is stored in the application program by using an NSUserDefaults persistence mechanism, and further, a notification is sent to the APP application to notify the application program of switching languages, where the notification may be sent by using an NSNotificationCenter notification mechanism (switching language notification), or may be sent by using a kchangeugenotification mechanism, which is not limited in particular in the embodiment of the present application.
S202, acquiring a target text file and a target picture resource from a localization resource library based on the identification information; the localization resource library is a database which is created in advance and used for storing text files and picture resources corresponding to various language types; the same identification information corresponds to a text file and a picture resource of one language type.
In the embodiment of the application, the localization resource library comprises localization text files and localization picture resource files; the localization text file is a string file for each language type, which is prepared in advance, contains corresponding translation text, can automatically generate the localization text file by using a tool integrating a development environment, and can manually create and edit the localization text file; wherein the localized text file may refer to a localized string.
The localization picture resource file is a picture resource which is prepared in advance and corresponds to different language types, that is, corresponding localization picture resources are respectively prepared for each language type, when the localization picture resource is prepared, different naming can be performed for different language types, for example, pictures are named as 'image_en.png', pictures corresponding to english language, pictures corresponding to french language are named as 'image_fr.png', and the like, and different pictures correspond to different naming, which is not particularly limited in the embodiment of the present application.
In this step, after the switching language notification is generated based on the switching language logic constructed in advance, the text resource (target text file) and the target picture resource to be displayed after the switching language in the App are required to be acquired, that is, after the switching language notification is received, the application program may acquire the localization character string and the picture resource according to the identification number corresponding to the target language selected by the user.
S203, generating a system subscription message based on the target text file and the target picture resource, and resetting target text and target picture to be displayed based on the system subscription message so that the APP interface performs interface re-rendering based on the target text and the target picture.
In the embodiment of the application, in order to ensure the correct localization of the APP interface, the current interface needs to be updated again after the language is switched.
In the step, when the target text file and the target picture resource are loaded, the system notification message is subscribed kChangeLan guageNotification, so that the APP application system resets the text and the picture to be displayed when receiving the system subscription message, and multi-language updating of the page and the picture is realized.
Therefore, the embodiment of the application provides a multi-language switching method, which can realize the multi-language switching function in the App application, so that a user can switch the language and the picture in the application without restarting the App application, simplify the switching step, and meet the language requirement of the user by providing better multi-language experience.
In one possible design, the method further comprises:
acquiring initial text files and initial picture resources corresponding to multiple language types, and filtering the initial text files and the initial picture resources to obtain text files and picture resources;
establishing a mapping relation between a text file and a picture resource corresponding to the same language type;
and creating corresponding identification information for each mapping relation, and storing the identification information, the text file with the mapping relation and the picture resource in a localization resource library.
In the embodiment of the application, the filtering processing can comprise de-duplication processing, abnormal information processing, standardized processing and the like; the de-duplication process may refer to deleting repeated text files and picture resources; the abnormal information processing may refer to performing correction and definition processing on abnormal information such as an erroneous text file or a blurred picture; the standardized processing can refer to unified processing of text files and picture resources in different formats, so that the text files and the picture resources after the standardized processing can be directly used by an APP application system.
In the step, initial text files and initial picture resources corresponding to multiple language types are obtained, and the machine learning model is utilized to filter the initial text files and the initial picture resources, so that the text files and the picture resources meeting the requirements are obtained; the machine learning model may be a deep learning based convolutional neural network model; further, the identification information is created by the text file and the picture resource corresponding to the same language type, and the text file and the picture resource which have mapping relations and are corresponding to the different identification information are stored in the localization resource library.
It should be noted that, the method for filtering the initial text file and the initial picture resource in the embodiment of the present application is not limited in particular, and may be different machine learning models or other filtering algorithms.
Therefore, the embodiment of the application can realize the switching of the languages in the application by creating the localized resource library, and further can provide personalized language settings for the user, so that the user can select the language used in the application program according to the preferred language without being limited by the system language settings, the satisfaction degree of the user on the application can be improved, and the user can more easily understand and use the application program.
In one possible design, the method further comprises:
creating a language switching option in a specific position area of a setting interface or a display interface of the application program, and establishing a link relation between the language switching option and multiple types of languages so that the application program determines a corresponding target language based on touch operation of a user on the language switching option.
In the embodiment of the present application, the specific location area may refer to a location of an appropriate area in the APP interface, such as an upper left corner area, where the specific location area is selected so as not to affect a deployment location of a text file and a picture resource.
In this step, a language switching option is added to the setting interface or other suitable position of the application program, where the language switching option corresponds to a language switching function, and the language switching can be implemented based on interface call.
Therefore, the embodiment of the application can switch the languages when the application program runs by creating the language switching options, and improves the instantaneity of switching.
In one possible design, obtaining the target text file and the target picture resource from the localized resource library based on the identification information includes:
calling a text processing algorithm by using a language manager, and acquiring a target text file from a localization resource library based on the identification information; the language manager is used for processing and changing the language of the application program at the current APP interface;
and calling a picture processing algorithm by using a language manager, and acquiring a target picture resource from a localization resource library based on the identification information.
In the embodiment of the application, the language manager is used for processing and changing the language of the application program, so that the application program can be unnecessary to restart, and the language manager can be LanguageManager; the text processing algorithm may refer to a method for acquiring a localized character string in a specified language, and the text processing algorithm may be a localedstring (for key: value:) method; the image processing algorithm may refer to a method for acquiring localized image resources, and the image processing algorithm may be path (ofType:); the language manager, the text processing algorithm and the picture processing algorithm are not particularly limited in the embodiment of the present application, and the above is only an example.
When the App is started, the App application system can load the iproj file corresponding to the system language set by the current equipment into the main bundle, so that the internationalization scheme provided by the system uses the localized StringForKey of the main bundle, the value table can obtain localized text resources appointed by the system, but cannot obtain text resources corresponding to the appointed language in the application; aiming at obtaining text resources corresponding to the appointed language in the application, the application realizes the effect of independently selecting and appointing the iproj file to localize through a language manager and creating a Bundle object.
Specifically, a language management class such as LanguageManager is created, and a create Bundle method is called, wherein the create Bundle method can create a Bundle object through obtaining a path of a Bundle file of a specified language, the Bundle object is a set of key-value key value pairs, wherein a key is a character string type, a value can be any type of data, the data can be stored into the Bundle file through a put method of the Bundle object, the data can be obtained through a get method, and the Bundle object can be used as a parameter to be transferred when the data is transferred between different components.
Further, in the LanguageManager, a text processing algorithm is called to obtain a localized string, that is, a bundle object is used to call a localedstring (for key: value: table) method to obtain a localized string in a specified language.
Where localized strings are to be displayed, localized strings may be obtained using the localizedString method of LanguageMa nager instead of the NSLocalizedString method of the APP application system.
Further, in the LanguageManager, a picture processing algorithm is called to obtain localized picture resources, namely a band (for resource: ofType) method is called to obtain localized picture resources by using a band object, and through the steps, target text files and target picture resources required by an App switching language can be obtained.
Therefore, the embodiment of the application can realize that the switching language takes effect immediately in the application through the language manager, so that the development and the use are more convenient, the switching time is saved, better multi-language experience is provided, and the satisfaction degree of the user is improved.
In one possible design, the APP interface includes a text presentation page control and a picture presentation page control; resetting target text and target pictures to be displayed based on the system subscription message, including:
Searching a text display page control and a picture display page control in the APP interface;
resetting target texts to be displayed on the basis of the system subscription message for the text display page control, and resetting target pictures to be displayed on the basis of the system subscription message for the picture display page control;
and after resetting the target text and the target picture to be displayed, releasing resources of the original text and the original picture corresponding to the APP interface so as to optimize the occupied memory.
In the embodiment of the application, in order to avoid overlarge memory occupation of the application program, the picture and text loading logic is optimized, and the picture resources and text files of the previous language are timely released when the languages are switched, only the picture resources and text resources required by the current language are loaded and reserved, and the performance of the application program is improved.
Specifically, aiming at a page control with text display, subscribing kChangeLangu ageNotification system notification messages when the control is loaded, so that an APP application system resets a target text to be displayed when receiving the system subscription messages, and multi-language updating of the page is realized; aiming at a page control with picture display, subscribing a kChangeLanguageNotification system notification message when the control is loaded, so that an APP application system resets a target picture to be displayed when receiving a system subscription message, and multi-language updating of the picture is realized; furthermore, the old pictures and the old texts corresponding to the APP interface are released in resource loading, namely, the old pictures and the old texts do not need to be cached, and only the new pictures and the new texts need to be cached and displayed.
Therefore, when the language is dynamically switched, the method and the device for optimizing the loading of the picture resources and the loading of the text resources are built in, so that the running performance of the App is improved, and the memory occupation is reduced.
In one possible design, the switching language notification further includes a date format, a time format, and a number format corresponding to the target language; the method further comprises the steps of:
acquiring a target date, a target time and a target number from a localization resource library based on the date format, the time format and the number format; and the date format, the time format and the number format respectively correspond to the date, the time and the number of the language type and are stored in the localization resource library.
In the embodiment of the present application, the localization resource library is further configured to store a date format, a time format, and a number format corresponding to different language types, and a date, a time, and a number corresponding to the date format, the time format, and the number format.
In the step, determining identification information based on the date format, the time format and the number format, and acquiring a target date, a target time and a target number from a localization resource library based on the identification information; the same identification information corresponds to a date format, a time format and a number format of a language type, and correspondingly, also corresponds to a date, time and number to be converted.
It should be noted that, the switching language notification may further include other kinds of interface contents for enriching interface presentation, and the kind of interface contents included in the switching language notification is not specifically limited in the embodiment of the present application.
Therefore, after the current language setting is updated, the text character string, the picture resource, the localized date, time, number and the like on the APP interface can be reloaded, and the user experience and satisfaction are improved by providing more flexible and personalized settings.
In one possible design, the method further comprises:
detecting whether the re-rendered APP interface meets the user requirement;
if yes, storing the target text and the target picture based on a persistence mechanism, so that the APP automatically loads the target text and the target picture when being started next time;
if not, generating prompt information to prompt the user to set the target language again based on the language switching option on the APP interface.
In the embodiment of the present application, the prompt information may refer to information for indicating that a problem occurs in the re-rendered APP interface, for example, the prompt information is that loading of the picture 1 fails, and the display content and the display form of the prompt information are not specifically limited.
In the step, whether the re-rendered APP interface meets the user requirement or not can be detected through a predefined algorithm; if the user requirements are met, storing the target text and the target picture based on a persistence mechanism, so that the APP can automatically load the target text and the target picture in the current and subsequent use; if the user requirements are not met, generating prompt information, displaying the prompt information on the terminal equipment in a display frame form, prompting the user that the APP interface has problems, and clicking the language switching options again to set the target language; the predefined algorithm is an algorithm for detecting interface abnormality, and the specific algorithm corresponding to the predefined algorithm is not limited in the embodiment of the application.
Optionally, the re-rendered APP interface may be visually displayed, so that the user determines whether the re-rendered APP interface meets the requirement, if yes, the save button is clicked, so that the APP may automatically load the target text and the target picture in this time and every subsequent use; if not, based on the loop point operation, the position of the loop point problem is located, and then the APP system responds to the loop point operation to generate prompt information so as to prompt the user that the APP interface has the problem, and the language switching option is required to be clicked again to set the target language.
Therefore, the embodiment of the application can detect the re-rendered APP interface to determine to generate the APP interface meeting the user requirement, and the language requirement of the user is met by providing a detection flow.
In connection with the above embodiments, fig. 3 is a schematic flow chart of a specific multi-language switching method according to an embodiment of the present application, as shown in fig. 3, where the multi-language switching method includes the following steps:
step A: preparing a localization text file and a localization picture resource file, creating a language switching option in the application, and executing the step B.
And (B) step (B): and C, acquiring a target language selected by a user, locally storing the switched target language, further acquiring a text resource and a picture resource to be displayed after switching the language in the APP, and executing the step C.
Step C: and re-rendering the interface, namely generating a system subscription message based on the text resource and the picture resource to be displayed, and resetting the text and the picture to be displayed based on the system subscription message to form a new APP interface.
Therefore, the multi-language switching method provided by the application can provide more flexible, personalized and better-performance language setting, and simultaneously provides convenience for international market expansion of developers and applications.
In the foregoing embodiment, the multi-language switching method provided by the embodiment of the present application is described, and in order to implement each function in the method provided by the embodiment of the present application, the electronic device as the execution body may include a hardware structure and/or a software module, and each function may be implemented in the form of a hardware structure, a software module, or a hardware structure plus a software module. Some of the functions described above are performed in a hardware configuration, a software module, or a combination of hardware and software modules, depending on the specific application of the solution and design constraints.
For example, fig. 4 is a schematic structural diagram of a multi-language switching device according to an embodiment of the present application, as shown in fig. 4, the device includes: a receiving module 401, an acquiring module 402 and a setting module 403; the receiving module 401 is configured to receive a language switching request, obtain a target language selected by a user based on the language switching request, and generate a switching language notification based on the target language; the language switching request is generated in response to touch operation of a user on a language switching option on an application APP interface; the language switching options are interface controls which are created in advance and used for carrying out language switching; the switching language notification comprises identification information corresponding to a target language;
The obtaining module 402 is configured to obtain a target text file and a target picture resource from a localization resource library based on the identification information; the localization resource library is a database which is created in advance and used for storing text files and picture resources corresponding to various language types; the same identification information corresponds to a text file and a picture resource of one language type;
the setting module 403 is configured to generate a system subscription message based on the target text file and the target picture resource, and reset a target text and a target picture to be displayed based on the system subscription message, so that the APP interface performs interface re-rendering based on the target text and the target picture.
In one possible design, the apparatus further comprises a building module for:
acquiring initial text files and initial picture resources corresponding to multiple language types, and filtering the initial text files and the initial picture resources to obtain text files and picture resources;
establishing a mapping relation between a text file and a picture resource corresponding to the same language type;
and creating corresponding identification information for each mapping relation, and storing the identification information, the text file with the mapping relation and the picture resource in a localization resource library.
In one possible design, the apparatus further includes a creation module to:
creating a language switching option in a specific position area of a setting interface or a display interface of the application program, and establishing a link relation between the language switching option and multiple types of languages so that the application program determines a corresponding target language based on touch operation of a user on the language switching option.
In one possible design, the obtaining module 402 is specifically configured to:
calling a text processing algorithm by using a language manager, and acquiring a target text file from a localization resource library based on the identification information; the language manager is used for processing and changing the language of the application program at the current APP interface;
and calling a picture processing algorithm by using a language manager, and acquiring a target picture resource from a localization resource library based on the identification information.
In one possible design, the APP interface includes a text presentation page control and a picture presentation page control; the setting module 403 is specifically configured to:
searching a text display page control and a picture display page control in the APP interface;
resetting target texts to be displayed on the basis of the system subscription message for the text display page control, and resetting target pictures to be displayed on the basis of the system subscription message for the picture display page control;
And after resetting the target text and the target picture to be displayed, releasing resources of the original text and the original picture corresponding to the APP interface so as to optimize the occupied memory.
In one possible design, the switching language notification further includes a date format, a time format, and a number format corresponding to the target language; the obtaining module 402 is further configured to:
acquiring a target date, a target time and a target number from a localization resource library based on the date format, the time format and the number format; and the date format, the time format and the number format respectively correspond to the date, the time and the number of the language type and are stored in the localization resource library.
In one possible design, the apparatus further comprises a detection module for:
detecting whether the re-rendered APP interface meets the user requirement;
if yes, storing the target text and the target picture based on a persistence mechanism, so that the APP automatically loads the target text and the target picture when being started next time;
if not, generating prompt information to prompt the user to set the target language again based on the language switching option on the APP interface.
The specific implementation principle and effect of the multilingual switching device provided by the embodiment of the present application can be referred to the related description and effect corresponding to the above embodiment, and will not be repeated here.
It should be noted that, it should be understood that the division of the modules of the above apparatus is merely a division of a logic function, and may be fully or partially integrated into a physical entity or may be physically separated. And these modules may all be implemented in software in the form of calls by the processing element; or can be realized in hardware; the method can also be realized in a form of calling software by a processing element, and the method can be realized in a form of hardware by a part of modules. The modules may be processing elements that are individually set up, may be implemented as integrated in a chip of the above-described apparatus, or may be stored in a memory of the above-described apparatus in the form of program codes, and the functions of the above-described modules may be called and executed by a processing element of the above-described apparatus. In addition, all or part of the modules can be integrated together or can be independently implemented. The processing element here may be an integrated circuit with signal processing capabilities. In implementation, each step of the above method or each module above may be implemented by an integrated logic circuit of hardware in a processor element or an instruction in a software form.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 5, the electronic device may include: a transceiver 501, a processor 502, and a memory 503.
Processor 502 executes computer-executable instructions stored in memory, causing processor 502 to perform the aspects of the embodiments described above. The processor 502 may be a general-purpose processor including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
The memory 503 is coupled to the processor 502 via a system bus and communicates with each other, the memory 503 being adapted to store computer program instructions.
The transceiver 501 may be used to receive a language switch request.
The system bus may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The system bus may be classified into an address bus, a data bus, a control bus, and the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus. The transceiver is used to enable communication between the database access device and other computers (e.g., clients, read-write libraries, and read-only libraries). The Memory may include random access Memory (Random Access Memory, RAM) and may also include Non-Volatile Memory (NVM).
The electronic device provided by the embodiment of the application can be an App application system of the above embodiment.
The embodiment of the application also provides a chip for running the instruction, which is used for executing the technical scheme of the multilingual switching method in the embodiment.
The embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores computer instructions, and when the computer instructions run on a computer, the computer is caused to execute the technical scheme of the multilingual switching method in the embodiment.
The embodiment of the application also provides a computer program product, which comprises a computer program stored in a computer readable storage medium, wherein at least one processor can read the computer program from the computer readable storage medium, and the technical scheme of the multi-language switching method in the embodiment can be realized when the at least one processor executes the computer program.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, e.g., the division of modules is merely a logical function division, and there may be additional divisions of actual implementation, e.g., multiple modules may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules illustrated as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.
In addition, each functional module in the embodiments of the present application may be integrated in one processing unit, or each module may exist alone physically, or two or more modules may be integrated in one unit. The units formed by the modules can be realized in a form of hardware or a form of hardware and software functional units.
The integrated modules, which are implemented in the form of software functional modules, may be stored in a computer readable storage medium. The software functional modules described above are stored in a storage medium and include instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or processor to perform some of the steps of the methods of the various embodiments of the application.
It should be understood that the above processor may be a central processing unit (Central Processing Unit, abbreviated as CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, abbreviated as DSP), application specific integrated circuits (Application Specific Integrated Circuit, abbreviated as ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile memory NVM, such as at least one magnetic disk memory, and may also be a U-disk, a removable hard disk, a read-only memory, a magnetic disk or optical disk, etc.
The bus may be an industry standard architecture (Industry Standard Architecture, ISA) bus, an external device interconnect (Peripheral Component Interconnect, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, the buses in the drawings of the present application are not limited to only one bus or to one type of bus.
The storage medium may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random-Access Memory (SRAM), electrically erasable programmable Read-Only Memory (Electrically Erasable Programmable Read Only Memory, EEPROM), erasable programmable Read-Only Memory (Erasable Programmable Read-Only Memory, EPROM), programmable Read-Only Memory (Programmable Read-Only Memory, PROM), read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuits, ASIC for short). Of course, the processor and the storage medium may reside as discrete components in an electronic control unit or master control device.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application.

Claims (11)

1. A method of multi-lingual switching, the method comprising:
receiving a language switching request, acquiring a target language selected by a user based on the language switching request, and generating a switching language notification based on the target language; the language switching request is generated in response to touch operation of a user on a language switching option on an application APP interface; the language switching options are interface controls which are created in advance and used for carrying out language switching; the switching language notification comprises identification information corresponding to a target language;
acquiring a target text file and a target picture resource from a localization resource library based on the identification information; the localization resource library is a database which is created in advance and used for storing text files and picture resources corresponding to various language types; the same identification information corresponds to a text file and a picture resource of one language type;
and generating a system subscription message based on the target text file and the target picture resource, and resetting target text and target picture to be displayed based on the system subscription message so that the APP interface performs interface re-rendering based on the target text and the target picture.
2. The method according to claim 1, wherein the method further comprises:
acquiring initial text files and initial picture resources corresponding to multiple language types, and filtering the initial text files and the initial picture resources to obtain text files and picture resources;
establishing a mapping relation between a text file and a picture resource corresponding to the same language type;
and creating corresponding identification information for each mapping relation, and storing the identification information, the text file with the mapping relation and the picture resource in a localization resource library.
3. The method according to claim 1, wherein the method further comprises:
creating a language switching option in a specific position area of a setting interface or a display interface of the application program, and establishing a link relation between the language switching option and multiple types of languages so that the application program determines a corresponding target language based on touch operation of a user on the language switching option.
4. The method of claim 1, wherein obtaining the target text file and the target picture resource from the localized resource library based on the identification information comprises:
Calling a text processing algorithm by using a language manager, and acquiring a target text file from a localization resource library based on the identification information; the language manager is used for processing and changing the language of the application program at the current APP interface;
and calling a picture processing algorithm by using a language manager, and acquiring a target picture resource from a localization resource library based on the identification information.
5. The method of claim 1, wherein the APP interface comprises a text presentation page control and a picture presentation page control; resetting target text and target pictures to be displayed based on the system subscription message, including:
searching a text display page control and a picture display page control in the APP interface;
resetting target texts to be displayed on the basis of the system subscription message for the text display page control, and resetting target pictures to be displayed on the basis of the system subscription message for the picture display page control;
and after resetting the target text and the target picture to be displayed, releasing resources of the original text and the original picture corresponding to the APP interface so as to optimize the occupied memory.
6. The method of claim 1, wherein the switch language notification further comprises a date format, a time format, and a number format corresponding to the target language; the method further comprises the steps of:
Acquiring a target date, a target time and a target number from a localization resource library based on the date format, the time format and the number format; and the date format, the time format and the number format respectively correspond to the date, the time and the number of the language type and are stored in the localization resource library.
7. The method according to any one of claims 1-6, further comprising:
detecting whether the re-rendered APP interface meets the user requirement;
if yes, storing the target text and the target picture based on a persistence mechanism, so that the APP automatically loads the target text and the target picture when being started next time;
if not, generating prompt information to prompt the user to set the target language again based on the language switching option on the APP interface.
8. A multi-language switching device, the device comprising:
the receiving module is used for receiving a language switching request, acquiring a target language selected by a user based on the language switching request, and generating a switching language notification based on the target language; the language switching request is generated in response to touch operation of a user on a language switching option on an application APP interface; the language switching options are interface controls which are created in advance and used for carrying out language switching; the switching language notification comprises identification information corresponding to a target language;
The acquisition module is used for acquiring a target text file and a target picture resource from the localization resource library based on the identification information; the localization resource library is a database which is created in advance and used for storing text files and picture resources corresponding to various language types; the same identification information corresponds to a text file and a picture resource of one language type;
the setting module is used for generating a system subscription message based on the target text file and the target picture resource, and resetting the target text and the target picture to be displayed based on the system subscription message so that the APP interface carries out interface re-rendering based on the target text and the target picture.
9. An electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the method of any one of claims 1-7.
10. A computer readable storage medium storing computer executable instructions which when executed by a processor are adapted to carry out the method of any one of claims 1 to 7.
11. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-7.
CN202311016290.4A 2023-08-11 2023-08-11 Multilingual switching method, multilingual switching device, electronic device, storage medium, and program product Pending CN117056001A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311016290.4A CN117056001A (en) 2023-08-11 2023-08-11 Multilingual switching method, multilingual switching device, electronic device, storage medium, and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311016290.4A CN117056001A (en) 2023-08-11 2023-08-11 Multilingual switching method, multilingual switching device, electronic device, storage medium, and program product

Publications (1)

Publication Number Publication Date
CN117056001A true CN117056001A (en) 2023-11-14

Family

ID=88668606

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311016290.4A Pending CN117056001A (en) 2023-08-11 2023-08-11 Multilingual switching method, multilingual switching device, electronic device, storage medium, and program product

Country Status (1)

Country Link
CN (1) CN117056001A (en)

Similar Documents

Publication Publication Date Title
US10877826B2 (en) Message processing method and apparatus, storage medium, and computer device
US11269696B2 (en) Application processing method and apparatus
US11868785B2 (en) Application program page processing method and device
WO2018077085A1 (en) Application processing method, device and storage medium
EP3493059B1 (en) Application data migration method and device
EP3647949B1 (en) Application program processing method, device and storage medium
CN108595445A (en) Interpretation method, device and terminal
US9417793B2 (en) Global keyboard shortcuts management for web applications
US11681432B2 (en) Method and terminal for displaying input method virtual keyboard
CN105335132B (en) Method, device and system for customizing application program function
CN110990075B (en) Method, device, equipment and storage medium for starting fast application
CN111026491B (en) Interface display method, device, electronic equipment, server and storage medium
US10489135B2 (en) Electronic device and method for improving installation speed of theme package
WO2015047966A1 (en) Multivariant mobile operating system configuration
CN110019464B (en) Page processing method and device
US20150317059A1 (en) Application management method for a mobile terminal and the mobile terminal
CN108776587B (en) Data acquisition method and device, computer equipment and storage medium
EP3161598A1 (en) Light dismiss manager
CN110780871A (en) Negative one-screen loading method and device, terminal and computer readable storage medium
CN114048415A (en) Form generation method and device, electronic equipment and computer readable storage medium
CN113407288A (en) Data processing method and device and electronic equipment
US20200097271A1 (en) Method and system for operating a software application on a processor of a mobile device
US20210026913A1 (en) Web browser control feature
CN111638907A (en) Method, device, terminal and storage medium for replacing third-party code segment
CN110580156A (en) Page processing method and device and electronic equipment

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